【问题标题】:Native Base, React Native.. Should I be setting the tab size somehowNative Base,React Native ..我应该以某种方式设置标签大小
【发布时间】:2016-10-07 19:18:56
【问题描述】:

使用带有 Native Base 的标签栏,工作正常。除了每个标签的页面会泄漏到另一个标签中。我应该打赌在某处设置宽度吗?我该怎么做?

例如,我可以选择 Tab1,然后您会在右侧看到 Tab2。

还有没有办法将标签栏放在标题中?所以当我在页面上滚动时它会保留。

  <Content theme={maintheme}>
                        <Tabs>
                            <ChatList tabLabel='Chat' />
                            <Discover tabLabel='Discover' />
                            <Notifications tabLabel='Notifications' />
                            <Profile tabLabel='Profile' />

                        </Tabs>
                    </Content>

我的问题是因为我的某些页面是用&lt;View&gt; &lt;/View&gt; 而不是<Container> </Container> 包装的吗?

【问题讨论】:

    标签: react-native native-base


    【解决方案1】:

    我在同样的问题上苦苦挣扎。您需要为每个选项卡文件包含一个容器和内容。

    index.ios.js:

    <Tabs>
        <TabOne tabLabel="Tab 1"  />
        <TabTwo tabLabel="Tab 2"  />
    </Tabs>
    

    tabOne.js:

    export default class TabOne extends Component {
      render() {
        return (
          <Container>
            <Content>
              <Text>I am Tab 1</Text>
            </Content>
          </Container>
        );
      }
    };
    

    tabTwo.js:

    export default class TabTwo extends Component {
      render() {
        return (
          <Container>
            <Content>
              <Text>I am Tab 2</Text>
            </Content>
          </Container>
        );
      }
    };
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-05
      • 1970-01-01
      • 2020-01-15
      • 2016-02-11
      • 2018-04-24
      相关资源
      最近更新 更多