Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static images doesn't render on android debug #70

Open
bandojulio opened this issue Jan 18, 2021 · 5 comments
Open

Static images doesn't render on android debug #70

bandojulio opened this issue Jan 18, 2021 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@bandojulio
Copy link

Steps to reproduce:

  1. clone repo
  2. change some url image to a static image
  3. run android in emulator
@waqaspassu
Copy link

I have the same issue. Cannot render static image

@brunolemos brunolemos added good first issue Good for newcomers help wanted Extra attention is needed labels Feb 8, 2021
@WeirdDNA
Copy link

The same thing is happening to me as well. The example ImageBackground imported from react-native works, but I can't define any images of my own. They display correctly on ios though. They also occupy about the right amount of height/width. I think I read this could be due to the android build process not copying the image files into the build? Someone got around a similar issue by adding some parameters to their build command to bundle the images in the right place. I followed the same steps to get the custom files included as resources, but I don't know enough about android apps or react native to wire them to appear in the right places. That line of thinking is probably a red herring anyway. This also appears to prevent (some) material icons from being displayed. Even though it's a bit outside of the scope of this example, react-native-paper will still draw its animated loading indicators, but react-navigation gets blocked from drawing things like the back buttons it gets via react-native-vector-icons, this might also impact web (CRA), but again, works perfectly out-of-the-box on iOS. When I need to draw an image on the web in my own components, I haven't been using the react native Image component (because I assumed it wasn't compatible with react-native-web), but for 3rd party libraries, this issue seems to block their images as well.

@jgo80
Copy link

jgo80 commented Mar 26, 2021

I solved this issue following this tutorial at the very end (scroll down!). The solution is also described here facebook/metro#290 (comment)

Hope it helps.

@WeirdDNA
Copy link

WeirdDNA commented Jun 17, 2021

I solved this issue following this tutorial at the very end (scroll down!). The solution is also described here facebook/metro#290 (comment)

Hope it helps.

Hi @mrsimply, thanks for finding this. Unfortunately I'm a bit green with configuring react native, babel, metro, etc. Could you provide more info on how you managed to get this fixed at least for android? I've tried adjusting the mobile/metro.config.js and mobile/babel.config.js files according to those links and the ones linked in those sections. I've tried installing babel-plugin-module-resolver, and following those configuration steps as well (although this project doesn't have a .bablrc file - can it just be added?)

Any help or examples would be appreciated!

@samzmann
Copy link

Ran into the same issue recently.
@jgo80 Thanks for posting the links! They are a little old, but led me in the right direction.

This more recent comment on issue 290 says to install react-native-monorepo-tools and update the Metro configurations. I did exactly that it, which solved the problem 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants