-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component renders twice / showing up in nav bar twice #2024
Comments
Please always mention version
… 13 июля 2017 г., в 12:39, Almog Koren ***@***.***> написал(а):
This is a wired issue, not sure why it's happing but it looks like the my home component is getting rendered twice attached gif as you can see the nav bar has home twice and you can go back to home even though
home is the first view.
My code
<Provider store={store}>
<ConnectedRouter>
<Scene key="root">
<Scene key="login" component={Login} initial={true} title={'Login'} />
<Scene key="ResetPassword" component={ResetPassword} title={'Reset Password'} />
<Scene key="tabBar" tabs hideNavBar={true}>
<Scene key="tab1" title="Home" tabBarLabel="Home" icon={HomeTabIcon}>
<Scene key='Home' component={Home} title='Home' initial={true} />
<Scene key='teams' component={Teams} title='Teams' initial={false} />
</Scene>
<Scene key="tab2" title="Photos" tabBarLabel="Photos" icon={PhotosTabIcon}>
<Scene key='Photos' component={Photos} title='Photos' initial={false} />
</Scene>
<Scene key="tab3" title="Site Diary" tabBarLabel="Site Diary" icon={SiteDiaryTabIcon}>
<Scene key='SiteDiary' component={SiteDiary} title='SiteDiary' initial={false} />
</Scene>
</Scene>
</Scene>
</ConnectedRouter>
</Provider>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
No problem "react-native-router-flux": "4.0.0-beta.7", |
Always try latest one before creating of issue ;) Please check with beta.8 |
Same issue with 8 |
Could you reproduce it with Example? Have you added console logs and see re-rendering several times? |
Ok, please reproduce with Example and latest beta.8 |
Isn't the example code outdated for version 4? |
Why? I've just increased dep to beta.8 if it is what you are saying. |
My code is different than the example code more, I'm not going to rewrite the entire example to like mine and just because the example is not showing this issue does not mean it's not a bug. And this is a bug |
Sorry, I can't guess the problem, I need to see the code. All I see from screenshot is some weird navbar transition and it could happen because of hidden navbar for tabbar. For such cases look at |
I debugged the issue, I don't think we need to create examples for each issue if you look at the code that should help, this is how StackOverflow works when you ask for help. This is definitely a bug If I'm for example a login screen and have Which is a component inside a tab bar, the first one you get that issue because the lib loads the tab bar and the home component. If you do the following It loads the tab bar which in turn loads the fist component, or it just gets loaded once. |
Then try to fix it by yourself - RNRF is just wrapper around react-navigation and build all screens for you. As far as I can see when you are calling Actions.Home - you are telling react-navigation to PUSH Home - but Home is already exist as start screen, so you will have two screens as the result |
I already fixed it, just did Actions.tabBar(); |
That is why I said. So it is not bug, but incorrect usage. |
No, I still think it's a bug, but you can explain. I have a 3 tabs each have 1 view component How do I navigate between tabs because if I do
The second tab it loads the photos component tab twice |
To follow up it seems that if your component is inside a tabs scene and you use Actions.xx to call it for some reason it loads that component twice |
Can you reopen this, it's definitely an issue. Did you understand how it's happing |
As I said RNRF is just wrapper. |
@aksonov I understood that I was saying we should keep it open until 476 is fixed |
Please try PR #2025, I did some workaround |
Tried testing it, PR has an issue |
- Enhancement: support inheritance of scene props (useful for `headerMode` attribute for different RN StackNavigator animation) - Fix: attempt to fix react-navigation pushes instead of jumping when user taps the same tab (#2024) - Enhancement: use navBarButtonColor or tintColor or headerTintColor for image button tintcolor (#2028) - Fix: use backBehavior='initialRoute' by default (#2026) - Enhancement: allow right/leftTitle, right/leftButtonImage to be static functions within scene component - Enhancement: allow wrapping all screens and navbar buttons with `wrapBy` parameter for `Router`. It could be `observer` from MobX, or `connect` from Redux or any other function. - Fix: eslint formatting, fix CircleCI build
I can confirm this still happens with beta 9 and I'm on "react-navigation": "^1.0.0-beta.11", I'm calling |
You should call direct tabs child
… 14 июля 2017 г., в 18:16, Almog Koren ***@***.***> написал(а):
I can confirm this still happens with beta 9 and I'm on "react-navigation": "^1.0.0-beta.11", I'm calling
Actions.Photos(); which is inside a tab bar
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
How do I do that? What is the code? |
Actions.tab2()
… 14 июля 2017 г., в 18:40, Almog Koren ***@***.***> написал(а):
How do I do that? What is the code?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks perfect and working great |
The bottom navigation switch, the page is reloaded, resulting in slow switching and waste of traffic |
This is a wired issue, not sure why it's happing but it looks like the my home component is getting rendered twice attached gif as you can see the nav bar has home twice and you can go back to home even though
home is the first view.
My code
The text was updated successfully, but these errors were encountered: