【问题标题】:React Native TabNavigator is hiding when ScrollView is long当 ScrollView 很长时,React Native TabNavigator 隐藏
【发布时间】:2017-05-22 19:00:57
【问题描述】:

我正在使用这个库中的 TabNavigator https://reactnavigation.org/docs/navigators/tab 在屏幕上我有 ScrollView 它真的很长而且我的标签被隐藏了,要怎么做才能不隐藏标签?

代码如下:

const TabNav = TabNavigator({
    Home: {
        screen: Home,
        navigationOptions: {
            title: 'Home',
            headerLeft: null
        }
    },
    Notes: {
        screen: Notes,
        navigationOptions: {
            title: 'Notes',
            headerLeft: null
        }
    },
    Tasks: {
        screen: Tasks,
        navigationOptions: {
            title: 'Tasks',
            headerLeft: null
        }
    },
    Events: {
        screen: Events,
        navigationOptions: {
            title: 'Events',
            headerLeft: null
        }
    }
}, {
    tabBarOptions: {
        activeTintColor: 'green'
    },
});


const plannings = StackNavigator({
    Login: {
        screen: Login,
        navigationOptions: {
            header: null
        }
    },
    Register: {
        screen: Register,
        navigationOptions: {
            header: null
        }
    },
    Home: {
        screen: TabNav
    }
}, {
    headerMode: 'screen'
});

【问题讨论】:

  • 试图使内容的位置绝对,但它不可滚动
  • 你能给出结果的截图吗,听起来你正在将tabNavigator嵌入到scrollView中。反之亦然
  • 你能在这里告诉我们你的代码结构吗?

标签: react-native tabnavigator


【解决方案1】:

我找到了这个解决方案,它对我有用:

<View style={{flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: 'blue'}}>
     <View style={{height: 400, width: 400}}>                 
       <ScrollView>
         <View style={{backgroundColor: 'green'}}>
            // Your data here
         </View> 
      </ScrollView>
      <TextInput style={{backgroundColor: '#c4c4c4dd', position: 'absolute', bottom: 0, left: 0, right: 0}} />
    </View>
  </View>  

【讨论】:

  • 这段代码来自哪里?我们如何知道问题是如何解决的?
猜你喜欢
  • 2023-03-22
  • 2019-02-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-11
  • 1970-01-01
  • 2018-11-17
  • 1970-01-01
相关资源
最近更新 更多