react-native-router-flux: Tabs flag for swiping not working
Version
Tell us which versions you are using:
- react-native-router-flux 4.0.0-beta.40
- react-native 0.55.4
Expected behaviour
When the flag swipeEnabled is set to true, user should be able to swipe through the tabs
I have my tabs layout like this:
<Tabs key="tabbar" tabs={true} swipeEnabled={true} showLabel={false} hideNavBar style={{ marginTop: -50 }} type={ActionConst.RESET}>
<Scene key="contacts" component={Contacts} hideNavBar type={ActionConst.RESET}/>
<Scene key="chats" component={Chats} hideNavBar initial={true} type={ActionConst.RESET}/>
<Scene key="profile" component={Profile} hideNavBar type={ActionConst.RESET}/>
</Tabs>
The same goes for not be able to hide the tab Bar Component which is at the bottom by default.
Actual behaviour
Swiping is not available. Only works switching via bottom nav
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 29 (9 by maintainers)
Commits related to this issue
- Closes #3163: Bring TabBarTop and TabBarBottom back to LegacyTabs — committed to aksonov/react-native-router-flux by daviscabral 6 years ago
<Router> <Tabs key="root" tabs={true} legacy={true} swipeEnabled={true} tabBarPosition={'bottom'}> <Scene hideNavBar key="login" component={Login} title="Login"/> <Scene hideNavBar key="register" component={Register} title="Register"/> <Scene hideNavBar key="home" component={Home}/> </Tabs> </Router>
legacy={true} this works for me
Some additional info, I can confirm this is working as described. But if you use a custom
tabBarComponent
and try to useAction.jump(key)
in it, it won’t trigger the sliding animation.EDIT:
Solved by using
props.jumpTo(key)
instead ofAction.jump(key)
.EDIT 2:
It’s not working in android. The state of the scene and the state of the tabBarComponent gets desynchronized somehow.
@SourceCipher Could you create new issue for this problem? It seems hard to fix,
onNavigationStateChange
is called AFTER react components are mounted.We are using our library on production, too pity that it doesn’t work for you. You may create separate ticket for every issue you have with reproducible fork of Example project. For Android issues please ask @daviscabral
Ok I just fixed by doing this “cheat”. To make tabs to swipe, make sure you have set
tabBarPosition='top'
.To disable the tabBarComponent you have to return null as a component. To do so just do
tabBarComponent={() => null}
By adding these 2 to a Tabs component it will make your tabs swiping without even setting
swipeEnabled={true}