Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

enter image description here

The mobile app of Twitter has a scrollable tab in the middle of the screen when you are on your profile. The top half of the screen displaying your profile info etc doesn't change when you click on the scrollable tabs mid screen : "Tweets & replies", "Media" etc. I am wondering how one would create this? Having half the screen stay the same and then having tabs which change mid screen... At the moment I have react navigation tabs as my main navigation - so on one of these tabs (the profile tab) I want to create the same concept as the picture..

like image 428
Tamsyn Jennifer Avatar asked Oct 03 '18 10:10

Tamsyn Jennifer


People also ask

Where is the scrollable tab in the Twitter mobile app?

The mobile app of Twitter has a scrollable tab in the middle of the screen when you are on your profile. The top half of the screen displaying your profile info etc doesn't change when you click on the scrollable tabs mid screen : "Tweets & replies", "Media" etc.

How to create a scroll bar in Excel?

Then create a scroll bar besides your data headers, please click Developer > Insert, and select Scroll Bar under Form Controls, then drag the cursor to draw a scroll bar as following screenshots: Note: If your Excel do not show the Developer tab, you can go to Excel Options dialog to check Developer tab in the Main tab list. 3.

How to create a horizontal scrollable menu with CSS?

Learn how to create a horizontal scrollable menu with CSS. ... The trick to make the navbar scrollable is by using overflow:auto and white-space: nowrap: Tip: Go to our CSS Navbar Tutorial to learn more about navigation bars. Thank You For Helping Us!

How to make The navbar scrollable?

The trick to make the navbar scrollable is by using overflow:auto and white-space: nowrap: Tip: Go to our CSS Navbar Tutorial to learn more about navigation bars.


2 Answers

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

like image 135
user11237349 Avatar answered Oct 18 '22 02:10

user11237349


I don't know if you've figured it out yet, but you can nest 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
like image 20
displayname Avatar answered Oct 18 '22 02:10

displayname