J'ai fait une vue simple avec une image d'arrière-plan et quelques icônes sur le dessus. En cliquant sur les icônes, naviguez vers différentes pages. Cela fonctionne bien. Le problème est que lorsque je navigue vers d'autres pages, je reviens à la page d'accueil et que 7 à 8 fois l'image d'arrière-plan disparaît de tous les écrans. Ci-dessous le code de l'écran d'accueil et d'écranL'image de fond disparaît après avoir navigué plusieurs fois Réagir natif
<Image
source={require('../images/background.jpg')}
style={{
justifyContent:'center',
resizeMode: "stretch",
height: height,
width: width,
alignItems: "center"
}} >
<StatusBar
backgroundColor="#4e0870"
barStyle="light-content"
/>
<Image style={{ height: 125, width: 125 }} source={require('../images/guru_logo.png')} />
<View style={{
marginTop: 30,
flexDirection: 'row'
}}>
<TouchableOpacity activeOpacity={.5} onPress={() => {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
navigate("LiveTV")
}
}
>
<Image
source={require('../images/live.png')}
style={{
resizeMode: "stretch",
height: 75,
width: 75
}} /></TouchableOpacity>
<TouchableOpacity activeOpacity={.5} onPress={() => {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
navigate("VideoPage")
}}>
<Image
source={require('../images/youtube.png')}
style={{
marginTop: 5,
resizeMode: "stretch",
marginLeft: 100,
height: 75,
width: 75
}} />
</TouchableOpacity>
</View>
<View
style={{
flexDirection: 'row',
marginTop: 20
}}>
<Text
style={{
marginLeft: -5,
fontSize: 20,
color: "#FFF"
}}>Live Tv</Text>
<Text
style={{
fontSize: 20,
color: "#FFF",
marginLeft: 125
}}>Video</Text>
</View>
<View
style={{
flexDirection: 'row',
marginTop: 20
}}>
<TouchableOpacity activeOpacity={.5} onPress={() => {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
navigate("FacebookPage")
}}>
<Image
source={require('../images/facebook-logo.png')}
style={{
resizeMode: "stretch",
height: 75,
width: 75
}} /></TouchableOpacity>
<TouchableOpacity activeOpacity={.5} onPress={() => {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
navigate("AudioPage")
}}>
<Image
source={require('../images/icon.png')}
style={{
resizeMode: "stretch",
marginLeft: 100,
height: 75,
width: 75
}} /></TouchableOpacity>
</View>
<View
style={{
flexDirection: 'row',
marginTop: 20
}}>
<Text
style={{
marginLeft: -20,
fontSize: 20,
color: "#FFF"
}}>Facebook</Text>
<Text
style={{
fontSize: 20,
color: "#FFF",
marginLeft: 110
}}>Audio</Text>
</View>
<TouchableOpacity activeOpacity={.5} onPress={() => {
BackHandler.removeEventListener('hardwareBackPress', this.handleBackButton);
navigate("ContactPage")
}}>
<Image
source={require('../images/contact.png')}
style={{
marginTop: 20,
resizeMode: "stretch",
height: 75,
width: 75
}} /></TouchableOpacity>
<Text style={{
fontSize: 20,
color: "#FFF"
}}>Contact Us</Text>
</Image>
Vous ne savez pas, mais parfois, que cela se produit lors du test dans l'émulateur, essayez de créer une version de version, puis testez la même chose. Si le problème persiste, vous devez vérifier le code/css. –
J'utilise déjà la version release et les tests sur le périphérique –
Utilisez-vous webpack par hasard? – foobar