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

Prop for Images from URL #6

Closed
kloehz opened this issue Sep 14, 2022 · 2 comments
Closed

Prop for Images from URL #6

kloehz opened this issue Sep 14, 2022 · 2 comments

Comments

@kloehz
Copy link

kloehz commented Sep 14, 2022

Hello!

Thanks for the library <3

im here with a question...can you implement a prop that accept an url for the image? this is because now im fetching the image from backend with react-native-fs, saving it on temp directory, get this file and parse it to base64 to show them.

i mean its a nice feature but i don know how to code them in swift/kotlin to implement it (i try on swift, if i can do it, i write the code on a pr)

Thanks you!

@kloehz kloehz changed the title Images from URL Prop for Images from URL Sep 14, 2022
@avegrv
Copy link
Collaborator

avegrv commented Sep 15, 2022

@kloehz Thank you that you choose our lib.

The lib uses the same props as Image class from react-native.
Basic on the stackoverflow question, I guess you can try something similar:

const RNFS = require('react-native-fs') // https://github.com/itinance/react-native-fs#readme (npm install react-native-fs)
const platformFilePath = Platform.OS === 'android' ? RNFS.DocumentDirectoryPath : RNFS.MainBundlePath;
const filePath = "file://" + platformFilePath + "/" + this.props.imageName

return(
   <ScratchCard source={{uri:filePath}} style={...} /> 
)

@kloehz
Copy link
Author

kloehz commented Sep 15, 2022

I'm using the same code and it works fine for me (:
It was just a comment to make a feature if you saw it well, thank you very much anyway!

@kloehz kloehz closed this as completed Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants