-
Notifications
You must be signed in to change notification settings - Fork 961
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
[Question] Loading an image saved to a path from RNFS #60
Comments
require() is a build-time directive for bundling resources with the application. You should instead set the image source kind of like this: self.setState({photoSource: { There are examples linked in the tests project of RNFS. Actually it'd be cool if RNFS had a utility function to conver a file path string into a source object like this for direct use with the react-native UI. |
Great thanks! |
I've searched this entire project for uri and looked through the code in the integration tests but I cant find the example you refer to. Is it another project? I did find the pull req for supporting file:// paths. Is that something required to get it working? |
Nevermind sorry, I found the test project and turns out I forgot to provide style information to the image.. Thanks for the help! |
How about a simple code example? |
Hi,
I'm using gl-react-native and use their captureFrame method to save an image to file. I use RNFS to get the path for this file. If I lookup the path I can see that the image is there and can be reviewed using a normal image application.
However, when I want to require() it in an Image tag, I get the error that it cannot be resolved. The path is:
"file:///Users/alex/Library/Developer/CoreSimulator/Devices/6955A1DF-7189-4FD1-91EE-AFE106019086/data/Containers/Data/Application/F19A2400-3339-4C01-9FAA-FB36AE54C00E/Library/Caches/image.png"
Any idea why I cannot require this to show it as an image? I tried with and without the file://, I tried making it a relative path from the MainBundle path but none of them give me the image. Is there something obvious I'm overlooking?
It doesnt work on Android or iOS on either device or simulator.
(RN 0.21 if it matters)
Cheers
The text was updated successfully, but these errors were encountered: