Fork me on GitHub
#cljsrn
<
2016-07-28
>
tiensonqin14:07:53

Anyone successfully loading image from local file system?

tiensonqin14:07:06

I've checked the image has been downloaded to that path, i'm using react-native-fs

savelichalex14:07:45

yeah, i did it

pesterhazy14:07:59

@tiensonqin: the "~" part probably won't work, use an absolute path (`/Users/...`)

pesterhazy14:07:51

also, you may want to try file:// as a url (what you have is not a valid url)

pesterhazy14:07:01

the usual way to do this is to use assets

tiensonqin14:07:29

@pesterhazy: @savelichalex thanks, I actually tried the absolute uri and file://, don't work for me, RN 0.29, debug mode

savelichalex14:07:16

Are you sure that file exist?

savelichalex14:07:22

I have an error in snippet

tiensonqin14:07:37

I'm typing (str (.-DocumentDirectoryPath fs) "/avatar.jpg"), and it gives me "/var/mobile/Containers/Data/Application/D4DA0419-D878-4A0C-B083-03A3526AAAC6/Documents/avatar.jpg"

tiensonqin14:07:26

`(file-exists? "/var/mobile/Containers/Data/Application/D4DA0419-D878-4A0C-B083-03A3526AAAC6/Documents/avatar.jpg")

tiensonqin14:07:09

@savelichalex: Is loading working for you in debug mode?

savelichalex14:07:25

For all modes)

tiensonqin14:07:55

Ok, thanks, maybe it's something wrong with me.

savelichalex14:07:59

I’m trying that with just Image and with gl-react-native

pesterhazy14:07:08

maybe absolute paths don't work?

savelichalex14:07:24

they should work with protocol

pesterhazy14:07:26

possibly the simulator is somehow sandboxed

savelichalex14:07:06

That should work in simulator too fine

tiensonqin14:07:18

file:// not work for me too, I'm testing in device

savelichalex14:07:05

For me that work on simulator, ipad2, ipad air 2, android devices

tiensonqin14:07:55

Need to sleep, weird thing, will check it tomorrow, thank you, @savelichalex @pesterhazy