Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

Rerendering TabBarBottom #78

Open
ifalldev opened this issue Jun 15, 2018 · 1 comment
Open

Rerendering TabBarBottom #78

ifalldev opened this issue Jun 15, 2018 · 1 comment

Comments

@ifalldev
Copy link

Do you want to request a feature or report a bug?
I think its kind both.

What is the current behavior?
If the current behavior is a bug, please provide necessary steps for reproduction of this issue, or better the reduced test case (without any external dependencies, if possible).

  1. I have an app with bottom navigation and one of the tabs has a badge with a count of notifications

  2. The notifications is fetch when the app starts but the component have to wait the server response

  3. The response arrive and change the redux state and the component props as well

  4. The badge doesn't shows up because the navigation is still on same index and the TabBarBottom doesn't rerender

  5. Changing the active tab the TabBarBottom rerender and the badge shows up

What is the expected behavior?
The TabBarBottom rerender even with the same index navigation if I want

To work in my scenario I commented out those lines:

shouldComponentUpdate(nextProps: Props) {
    const { index } = this.props.navigationState
    const { index: nextIndex } = nextProps.navigationState
    return index !== nextIndex
 }

Environment (include versions). Did this work in previous versions?

  • React-Native (version): 0.52.0
  • React-Router (version): ^4.2.0
  • React-Router-Navigation (version): 1.0.0-rc.4

I can work on a PR if that feature is good to the package as whole.

@simonbuerger
Copy link
Contributor

You could put mapStateToProps on the component inside the renderTabIcon function. Should bypass your issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants