Open chetankotkar opened 7 years ago
any update on this ?? I have a similar issue to this one so if you guys can tell how can we achieve it, that would help greatly
Did you implement the component functions in the example?
componentWillReceiveProps(nextProps) {
if (!this.props.isFocused && nextProps.isFocused) {
// screen enter (refresh data, update ui ...)
}
if (this.props.isFocused && !nextProps.isFocused) {
// screen exit
}
}
shouldComponentUpdate(nextProps) {
// Update only once after the screen disappears
if (this.props.isFocused && !nextProps.isFocused) {
return true
}
// Don't update if the screen is not focused
if (!this.props.isFocused && !nextProps.isFocused) {
return false
}
// Update the screen if its re-enter
return !this.props.isFocused && nextProps.isFocused
}
Expected behaviour
Now when I press the Cartitem tab I want to refresh the component Cartitem.
Actual behaviour
Currently all tabs are loaded at the initial stage. when I use lazy load the tab loaded once I go to that tab. but when I visit that tab second time it does not reaload.
Environment
react-navigation ^1.0.0-beta.7:
react-native ^0.44.0:
Android 6.0:
react-navigation-is-focused-hoc
^1.0.0: