ohanhi / elm-native-ui

[CLOSED] Experiment: mobile apps in Elm using React Native.
BSD 3-Clause "New" or "Revised" License
1.54k stars 76 forks source link

can pass local images to react native #85

Closed GTDev87 closed 7 years ago

GTDev87 commented 7 years ago

Seems that react native when requiring an image example: const checked = require('./app/Task/Images/checked@2x.png');, the returned opaque type returned as an integer. This allows it to be passed through into the source field of images. https://facebook.github.io/react-native/docs/image.html#defaultsource.

Still learning elm so this is a quick and dirty pass through. I can also try and modify the Source type to accept Int.

GTDev87 commented 7 years ago

Ended up not being necessary. Found a way around using it.

ohanhi commented 7 years ago

@GTDev87 Sorry, I've missed this PR due to the way GitHub notifications work. Can you document how you went around it?

GTDev87 commented 7 years ago

Sure. Been trying to do a todoMVC on react native to learn Elm (and react native).
Have local images working with a combination of these 2 files.

https://github.com/GTDev87/elm-native-ui-todo-mvc/blob/master/app/Native/Image.js https://github.com/GTDev87/elm-native-ui-todo-mvc/blob/master/app/Image/Image.elm

Just treats them as integers. Seems to work.