[英]With React Native images disappear after some time when app is reloaded
When I include static images in my React Native apps (tested only on Android) everything works fine, also on a real device, in the beginning . 当我在我的React Native应用程序中包含静态图像(仅在Android上测试)时,一切正常,也可以在真实设备上开始 。 After some time, on the real device, when the app is reloaded, all images are gone (not visible). 一段时间后,在真实设备上,当重新加载应用程序时,所有图像都消失了(不可见)。 I can reproduce this very easy, simply by creating a new project (react-native init myDemo) and then add some images, using code exactly as described in the Docs. 我可以通过创建一个新项目(react-native init myDemo)然后添加一些图像,使用完全如文档中所述的代码来重现这一点。 The code below is my code inserted into a plain new React Native app, and it suffers from the exact same problem (for all the images). 下面的代码是我的代码插入一个普通的新React Native应用程序,它遇到了完全相同的问题(对于所有图像)。
return (
<View style={styles.container}>
<View style={{justifyContent: 'center', alignItems: 'center',}}>
<Image source={require("./img/blue.png")}/>
</View>
<View>
<Image resizeMode="cover" source={require("./img/red.png")}/>
</View>
<View>
<Image resizeMode="contain" source={require("./img/green.png")}/>
</View>
<View>
<Image resizeMode="stretch" source={require("./img/orange.png")}/>
</View>
<Image style={{width: 51, height: 50}} source={require("./img/black.png")}/>
</
View> ); 查看>);
Is this a general Android problem with React Native, or am I missing something here? 这是React Native的一般Android问题,还是我在这里遗漏了什么? Before you mark this a duplicate of other questions, if have tried the following suggestions from similar questions: 在您将此标记与其他问题重复之前,如果您尝试过类似问题的以下建议:
my problem was simply with uuid package that i had used to produce a unique identifier for the users that doesn't like to register. 我的问题只是使用uuid包,我曾经习惯为不喜欢注册的用户生成一个唯一的标识符。
I even had another problem with this package too. 我甚至还有这个包的另一个问题。 It made one of the reactNative apps on my device to logout automatically without any reason! 它使我的设备上的一个reactNative应用程序无需任何理由自动注销!
removing this package reverted everything to natural condition. 删除此包将所有内容恢复到自然状态。
Hope this answer help you too. 希望这个答案对你有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.