使用组件react-native react-native-router-flux包装场景选项卡

时间:2016-12-03 07:07:21

标签: react-native react-native-router-flux

我有一个tabbar组件,我希望在其中包含一个自定义本机模块,用于在react的css(线性不透明度渐变)中不可用的自定义样式行为。

  <Scene key="video" tabs={true} tabBarStyle={styles.tabBarStyle}>
    <Scene key="profile" title="profile" component={MyProfile} icon={TabIcon} hideNavBar />
    <Scene key="trend" title="trend" component={TrendMenuScene} icon={TabIcon} hideNavBar />
    <Scene key="home" title="home" component={MainMenuScene} initial icon={TabIcon} hideNavBar />
    <Scene key="star" title="star" component={Favourite} icon={TabIcon} hideNavBar />
    <Scene key="discover" title="discover" component={Search} icon={TabIcon} hideNavBar />
  </Scene>

我的第一次尝试和想法是将组件属性添加到包装场景组件的顶层。在该组件内部可能类似于。

return (
        <LinearGradient key="gradientWrap" colors={['transparent', 'rgba(0, 0, 0, 0.5)']} style={styles.linearGradient}>
        {this.props.children}
        </LinearGradient>
    )

这不起作用并抛出错误。我已经尝试过克隆道具,但我将所有内容都包装好,整个页面都包含在线性渐变中:/

那么如何在线性渐变中包装tabbar呢?或者更一般地说是任何包装组件。

0 个答案:

没有答案