我创建了这个包含路线的homeStack.js文件。我想使用一个自定义背景,但是导航器覆盖了它,我似乎不能修复它。
这是我的博客
import { createStackNavigator } from "react-navigation-stack"
import { createAppContainer } from "react-navigation"
import Home from '../components/Home'
import Detail from '../components/Detail'
const screens = {
Home: {
screen: Home,
},
Detail: {
screen: Detail
},
}
const HomeStack = createStackNavigator(screens, {
defaultNavigationOptions: {
headerShown: false
},
});
export default createAppContainer(HomeStack);
这是app.js,我尝试在这里设置我的背景
import { StyleSheet,View,ImageBackground} from 'react-native';
import Navigator from './routes/homeStack'
export default function App() {
// const image = { uri: "./assets/background.jpg" };
const image = require( "./assets/background.jpg");
return (
<View style={styles.container}>
<ImageBackground style={{height:"100%"}} source={image}>
<Navigator />
</ImageBackground>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#E8EAED',
},
});
I want to disable the navigator background so I can use a custom one. I was unable to turn it off.
1条答案
按热度按时间rryofs0p1#
使用此方法: