I am facing an issue with local images in a React Native app. I have a file where I require all of my app icons, something like this:
export const icons = {
a: require("a.png"),
b: require("b.png"),
c: require("c.png")
};
Then I use these files in the React Native Image
component. For instance:
import { icons } from "icons";
<Image
source={icons.a}
/>
It works fine in dev mode on both iOS and Android. It also works fine on iOS archive in p开发者_JAVA技巧roduction. But in Android production bundle, the icons seem to be randomly switched up. Sometimes icon a
is displayed instead of icon b
, sometimes it is icon c
that is displayed instead of icon a
, and so on... Sometimes one of the icon is not even displayed at all.
Can the problem come from requiring all the files in the same file ?
I would appreciate any clue. Thanks a lot.
精彩评论