-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
can't load static image,when i put the jsbundle and images in server #5142
Comments
Hey huangqiaobo, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
I find that the RCTImageLoader load image from 'http://10.10.30.96/assets/.../image.png'. var match = scriptURL && scriptURL.match(/^https?://.*?//); when I change the code like this var match = scriptURL && scriptURL.match(/^https?://.*//); Then I can get true image URL. It's a bug? |
The image source is not need server URL only.The pathname is also necessary |
Hey @huangqiaobo, this behaviour is intentional. When you build an offline bundle with The better way to do this is by packaging everything into an archive, downloading and unzipping it somewhere into I'm closing this as not-an-issue, but feel free to comment if you have any questions. P.S. I do agree that that regex looks strange. Feel free to send a PR |
+1 |
@sdyxch rn不推荐在release包里面直接用server的bundle,事实上如果你的项目有在build的时候运行RN的脚本的话,那么在release包里面,jsbundle和assets已经有一份在mainbundle里面,release包直接加载mainbundle里面的jsbundle就可以了。如果你想做热更新,可以把mainbundle里面的jsbundle和assets复制到你可以控制的目录下。 |
@huangqiaobo |
"react-native": "^0.17.0"
I run the commond:
react-native bundle
--entry-file index.ios.js
--platform ios
--dev false
--bundle-output ./main.jsbundle
--assets-dest ./ \
then I get
main.jsbundle and assets/
I found that all of my image is in assets folder.
Then I push the main.jsbundle and assets into service.
Then I use the url to load the bundle :
jsCodeLocation = [NSURL URLWithString:[NSString stringWithFormat:@"http://10.10.30.96/ota/main.jsbundle"];
then i find that ,I cant load the image.
what's the right way to load static images from server?
The text was updated successfully, but these errors were encountered: