0

In-app folder, I have two folder screens and assets I am giving the correct path but the background image is not applied to the emulator.

import React from "react";
import {
  ImageBackground,
  Platform,
  StyleSheet,
  Text,
  View,
} from "react-native";

const image = { uri: "https://reactjs.org/logo-og.png" };

const WelcomeScreen = () => (
  <ImageBackground
    style={styles.background}
    source={require("../assets/background.jpg")}
  >
    <View style={styles.loginButton}></View>
  </ImageBackground>
);

const styles = StyleSheet.create({
  background: {
    top: 0,
    right: 0,
    bottom: 0,
    left: 0,
    position: "absolute",
  },
  loginButton: {
    width: "100%",
    height: 70,
    backgroundColor: "#fc5c65",
  },
});

export default WelcomeScreen;

Here I am using Style sheet but not working I need your help guys kindly help

Thanks in Advance

1 Answers1

1

Can you put a height to the background style and try it once? I think ImageBackground asks for a height if not given.

ref - ImageBackground won't appear