如何在视图的ImageBackround内添加createStackNavigator以具有共同的背景图像?

问题描述 投票:1回答:1

我正在尝试从外部文件导入createStackNavigator并将其添加到View的ImageBackground中,以便可以从上到下使用通用的背景图像流,但是却遇到类似 TypeError:在导航状态中找不到“路线”

代码:

      <View style={styles1}>
        <ImageBackground source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/3/36/Hopetoun_falls.jpg' }} style={{width: '100%', height: '100%'}}>
 <componentNavigator style={{ backgroundColor: 'transparent' }} navigation={navigation} />
   <View></View>

        </ImageBackground>
        {/*</ImageBackground>*/}
      </View >

为了解决我添加的上述问题静态路由器= AccountsNavigator.router; //将其添加到构造函数下方

然后,我得到Connot读取了未定义的属性“路由器”我不确定如何修复它,即使它修复了,也会拍摄背景图片吗?

javascript reactjs react-native react-router react-native-navigation
1个回答
1
投票
我找到了解决方案,通过在navigationOptions内添加headerTransparent:true,尽管我必须将以下容器的位置放在绝对位置,但我仍能够获得透明背景:>
© www.soinside.com 2019 - 2024. All rights reserved.