timomeh / react-native-material-bottom-navigation

💅🔧👌 a beautiful, customizable and easy-to-use material design bottom navigation for react-native
MIT License
710 stars 127 forks source link

Update "activeTab" when BN receives props #1

Closed ChangeSomeCode closed 7 years ago

ChangeSomeCode commented 7 years ago

Hello!

I added updating "activeTab" state when BottomNavigation receives new props. It may be useful if you change tab from other components.

Thanks for your work!

timomeh commented 7 years ago

Hi! Thank you for contributing. Unfortunately, I didn't saw your Pull Request until now. I forgot to turn on email-notifications. 🤦‍♂️

I added this feature today and pushed it.

Although your solution looks very straight-forward, it would just set the Tab active without running all Animations. The Animations (respectively the Ripple Animations) are located in BottomNavigation.js, because overflow: 'visible' doesn't work in Android, and so I can't put the Ripples inside the Tabs. It's a bit hacky (I don't like calling such methods in other Components via this.refs), but in my experiments it was the only way to achive this.

I'm very sorry I didn't saw your PR earlier and thus implemented it without you. I turned on email-notifications, pinky swear.

ChangeSomeCode commented 7 years ago

good job!

Although your solution looks very straight-forward, it would just set the Tab active without running all Animations.

It because I didn't press on tab. Animation - is a visual feedback for user action.

0.3.0 works fine for me, but if I change tab from some menu (e.g drawer), animation is still running.

timomeh commented 7 years ago

Animation - is a visual feedback for user action.

That's a good point. The small Ripple-TouchFeedback shouldn't be visible. But imho the transition of the background color should stay the same, no matter if the user pressed the tab or the change was triggered programmatically.