peter-mach / react-navigation-is-focused-hoc

Ready to use solution using HOC to expose props.isFocused for react-navigation. No Redux needed.
MIT License
169 stars 21 forks source link

isFocused immediately true in TabNavigator #2

Closed MSchmidt closed 6 years ago

MSchmidt commented 7 years ago

Thanks for trying to figure this out. I've added this to the second tab in a TabNavigator and it mostly works. However, when the TabNavigator loads (on first tab) the prop (for second tab) is immediately true. Then no componentWillReceiveProps is triggered when I switch to the tab. After that everything works as expected.

cidylle commented 7 years ago

I'm having the same issue, with TabNavigator, isFocused is true by default on every single component it is attached to. Only after switching tabs first then the value is correctly updated.

ugiacoman commented 7 years ago

Check out the PR @cidylle @MSchmidt

MSchmidt commented 7 years ago

@ugiacoman nice, put this in and it works great.

peter-mach commented 6 years ago

The fix is in the v.1.1.0