1
I am unable to add an SVG to a component (SplashScreen
), follows the code:
import {LinearGradient} from 'expo-linear-gradient'
import React from 'react';
import {Text, View, Image} from "react-native";
import Estilos from './styles'
export default function (){
return(
<LinearGradient style={Estilos.gradiente} colors={['#0095FF', '#0048FF']}>
<View style={Estilos.rectangle}>
<Image source={require('./Vector 5.svg')}/>
<Text style={Estilos.text}>otation</Text>
</View>
</LinearGradient>
);
};
Follow the code of stylization:
import {StyleSheet} from "react-native";
export default StyleSheet.create({
gradiente:{
flex : 1,
justifyContent : 'center',
alignItems: 'center'
},
text: {
fontStyle: 'normal',
fontWeight: 'bold',
fontSize: 40,
backgroundColor : 'white',
borderRadius : 20
},
rectangle: {
position: 'absolute',
justifyContent : 'center',
width: 266,
height: 100,
backgroundColor: 'white',
borderRadius: 20
}
});
I guarantee I am referencing all the files correctly. Any idea what might be wrong?
Project folders:
The screenshot of the app:
You imported the dependencies into the project to use image. SVG ??
– hugocsl
Check the image path, something like: ". /Vector5.Pn" to ". /Splash Screen/Vector5.png"
– acb09