votrai123 / integrate-multiple-react-native

8 stars 4 forks source link

Mini app cannot read image file when bundle success to run on parent app ? #5

Closed NguyenManh1404 closed 8 months ago

NguyenManh1404 commented 9 months ago

Describe the bug When I just run mini app separately, the image files are displayed successfully. But when I bundle and build in the parent app, I cannot receive the image file

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information): All devices

Smartphone (please complete the following information): All devices

votrai123 commented 9 months ago

Have you done it yet? @NguyenManh1404

hookie256 commented 8 months ago

@votrai123 I place folder assets in root folder MiniApp (miniapp/MiniAppOne/assets/demo.png)

My Code in Mini App:

 <Image
  source={require('./assets/demo.png')}
  style={{height: 300, width: 300}}
 >

error I found Xcode log [native] Could not find image file:///Users/xxx/Library/Developer/CoreSimulator/Devices/B91F3B35-2D8A-4D8D-92CE-7A451C8586D7/data/Containers/Bundle/Application/87CE74C0-49AE-4891-87DE-0D13ED77AA2F/SuperApp.app/assets/assets/demo.png

votrai123 commented 8 months ago

@hookie256 you make sure to copy a file assets from the bundle to supper. --assets-dest

https://fig.io/manual/react-native/bundle refer: https://medium.com/@trai-nguyen/how-to-integrate-multiple-applications-with-react-native-275f13eb76d9

Generate a file bundle of MiniAppOne with

hookie256 commented 8 months ago

ok. thank you, I am done

NguyenManh1404 commented 8 months ago

I fixed bug cannot show image. I use url cannot local file to show image on mini app 😁. Or you can convert to vector icon to show image @votrai123