The best way to create a scrollable tab in the middle of the screen?

落花浮王杯 提交于 2019-12-05 09:13:59

Late answer but (for anyone else and future reference), react-navigation uses this package, react-native-tab-view: https://github.com/react-native-community/react-native-tab-view

for their tabs.

You can nest this within a screen, just like you desire (the previous answer only addresses the navigator inside navigator and that isn't what you want).

Here is an example (not exactly like you want, but you get the idea that you can. so instead of a background image, swap it out and use a view or scrollview accordingly to create that layout):

https://snack.expo.io/@satya164/collapsible-header-with-tabview

cheers :)

EDIT: i just found a way with just using react-navigation after all:

https://snack.expo.io/@mattx/collapsible-header-tabs

check it out

and another library: https://github.com/benevbright/react-navigation-collapsible

I don't know if you've figured it out yet. But, you can nested the TabNavigator inside a StackNavigator. That way, you can have a scrollable Tab.

    class ProfileMenu extends React.Component{
    render() {
     return(
      //whatever you wanted at the top 
      )
     }
    }

    const TabNaviga = createMaterialTopTabNavigator({
      Tweets: {screen: TweetScreen,},
      Replies: {screen: RepliesScreen,},
    })

    const YNavigator = createStackNavigator ({
      Home:{screen: TabNaviga,
        navigationOptions: ({navigation}) => ({
          header: <ProfileMenu navigation= {navigation} />,
        })
      }
    })
export default YNavigator
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!