Skip to content Skip to sidebar Skip to footer

React Navigation Imagebackground Displaying White Screen

Update: Its my AppNavigator thats causing the problem, if I remove it, it displays the background. How can I use ImageBackground with my AppNavigator: const config = { initialR

Solution 1:

ImageBackground component has a props called resizeMode.It has these options ('cover', 'contain', 'stretch', 'repeat', 'center') please try the below code with different options and check if your requirement fullfils.

export default class App extends React.Component {   render() {
    return (
      <ImageBackground
        source={require("./assets/images/TC_background.jpg")}
        style={styles.container}
        resizeMode= "stretch"
      >
        {Platform.OS === "ios" && <StatusBar barStyle="default" />}
        <Provider store={store}>
          <AppNavigator />
        </Provider>
      </ImageBackground>
    );   } }

const styles = StyleSheet.create({   container: {
    flex: 1,
    fontFamily: "lato-regular",
    width: "100%",
    height: "100%" 
} });

Post a Comment for "React Navigation Imagebackground Displaying White Screen"