react-native-camera-roll-picker
react-native-camera-roll-picker copied to clipboard
containerWidth doesn't update dynamically.
Component is not rerendering when containerWidth updated .
I have the same issue, I was trying to send data that will change width state, but it doesn't update
containerWidth={this.state.width}
_handleLayout = event => {
this.setState({
width: event.nativeEvent.layout.width
});
}
on the render...
<View onLayout={this._handleLayout}>
Uhh I found a solution on the index.js file: on render function, add onLayout:
return (
<View
onLayout={this._handleLayout}
add function_ handleLayout:
_handleLayout = event => {
this.fetch();
this.setState({initialLoading: true, dataSource: new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})});
}