Images not showing after publishing on iOS

After publishing the app, and loading it in Expo iOS Client, assets are not visible. In place of image there is just blank space. Same happens for iOS app created using exp build:ios. When I connect to local packager everything works fine.

Since it works locally, it make me think that assets are not accessible in Expo cloud for some reason. Expo e-mail support wasn’t able to respond to my queries so I cannot diagnose it in any way.

I tried to reproduce this problem but I wan’t able to do it with minimal setup. All new projects works as they should.

One the examples of how I require an image:

const IntroductionHeader = () =>
  <Image style={styles.logo} source={require('../../../assets/logo.png')} />

package.json:

{
  "name": "dummy",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "dependencies": {
    "firebase": "^4.3.0",
    "lodash": "^4.17.4",
    "moment": "^2.18.1",
    "react-navigation": "^1.0.0-beta.11",
    "expo": "^21.0.0",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-21.0.0.tar.gz"
  },
  "devDependencies": {
    "babel-jest": "20.0.3",
    "babel-preset-react-native": "2.1.0",
    "jest": "20.0.4",
    "react-test-renderer": "16.0.0-alpha.12",
    "react-native-scripts": "1.5.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js"
}

Someone had similar problem and was able to resolve it?

Is assets there a subdirectory of the root of your project (where app.json is placed)?

It is in app/. I tried to move it to the root but problem persisted.

Solved it!

Expo needs babel-preset-expo preset for babel. Otherwise it cannot find assets and doesn’t upload them at all. Adding it to .babelrc resolves the issue.

2 Likes

Can you share more especific details of what did you do to solve this problem?

1 Like