React native 使用组件反应本机路由器通量包裹场景选项卡

React native 使用组件反应本机路由器通量包裹场景选项卡,react-native,react-native-router-flux,React Native,React Native Router Flux,我有一个tabbar组件,我想在其中使用自定义本机模块包装,以实现react的css(线性不透明度渐变)中不可用的自定义样式行为 我的第一次尝试和想法是在包裹场景组件的顶层添加组件属性。该组件内部可能类似于 return ( <LinearGradient key="gradientWrap" colors={['transparent', 'rgba(0, 0, 0, 0.5)']} style={styles.linearGradient}>

我有一个tabbar组件,我想在其中使用自定义本机模块包装,以实现react的css(线性不透明度渐变)中不可用的自定义样式行为


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

return (
        <LinearGradient key="gradientWrap" colors={['transparent', 'rgba(0, 0, 0, 0.5)']} style={styles.linearGradient}>
        {this.props.children}
        </LinearGradient>
    )
返回(
{this.props.children}
)
这不起作用,并抛出一个错误。我尝试过克隆道具,但我包装了所有东西,整个页面都包装在线性渐变中:/

那么,如何在线性渐变中仅包装选项卡栏呢?或者更一般地说,任何包装组件

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