I am new to react-native I have this weird error I tried to solve but unable. I already checked all the same issue posted on GitHub and stack overflow but didn't solve my problem following is my code. react-native (react-native-cli: 2.0.1) node (v14.18.2)
import React from "react";
import { Image, ImageBackground, StyleSheet, View } from 'react-native-web';
function WelcomeScreen(props) {
return (
<ImageBackground
style={styles.background}
source={require("../assets/background.jpg")}>
<Image style={styles.logo} source={require("../assets/logo-red.png")} />
<View style={styles.loginButton}></View>
<View style={styles.registerButton}></View>
</ImageBackground>
);
}
const styles = StyleSheet.create({
background:{
flex:1,
justifyContent: "flex-end",
},
loginButton:{
width: "100%",
height: 70,
backgroundColor: '#fc5c65',
},
registerButton:{
width: "100%",
height: 70,
backgroundColor: '#4ecdc4 ',
},
logo:{
width: 100,
height: 100
},
});
export default WelcomeScreen;
CodePudding user response:
It was the file import problem I have to use
react-native
instead of
react-native-web
if any one have the above error used the bellow import
import { Image, StyleSheet, ImageBackground, View, Text} from 'react-native';
CodePudding user response:
Use react-native import instead of react-native-web