UNPKG

arm-components

Version:

components for react-native

32 lines (29 loc) 625 B
import React, { Component } from 'react'; import { View } from 'react-native'; export default class Container extends Component{ constructor(props){ super(props); this.state = { style: this.props.style, children: this.props.children, onLayout: this.props.onLayout } } componentWillReceiveProps(newProps){ this.setState({ style: newProps.style, children: newProps.children }); } render(){ let { style, children, onLayout } = this.state; return( <View style={[{width: '100%'}, style]} onLayout={onLayout} > { children } </View> ) } }