[Image] Can't display avatar with HTTP 301
just4fun opened this issue · 15 comments
I created an iOS APP for university BBS (built in PHP) with React Native 0.14.
When I send request to fetch user info, I will get a record including filed avatar
, which has value like http://bbs.uestc.edu.cn/uc_server/avatar.php?uid=32044&size=middle
, and I assigned it to source
filed of <Image>
like below,
<Image
style={styles.avatar}
source={{uri: authrization.avatar}} />
Updated recently:
It seems like a PHP method (I'm not familiar with PHP), since the value of avatar
will become http://bbs.uestc.edu.cn/uc_server/data/avatar/000/03/20/44_avatar_middle.jpg
if I type the original value in the browser.
I tried to display http://bbs.uestc.edu.cn/uc_server/avatar.php?uid=32044&size=middle
in html with <img> tag
, it will get 301 code and then get the right picture with extension.
However, the avatar is not displayed sometimes with RN. See the screenshot.
Seems like RN didn't support the redirect well even in latest 0.21.
Does the <Image>
component only support static picture file which ends with jpg|png|gif
?
Hey just4fun, 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.
- If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag
react-native
or for more real time interactions, ask on Discord in the #react-native channel. - If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
- We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
@just4fun I'm having the same problem, images without extension aren't showed. Did you resolve the issue?
@k7k0 No, there is no feedback both on Github issue and StackOverflow.
@ide Any ideas?
@just4fun on my case it turned to be a file-format problem, it's a WebP file instead of regular JPG. Not supported on iOS yet http://stackoverflow.com/questions/34815053/load-remote-image-without-extension/34825697#34825697
@k7k0 thank you, in my case, there is no any extension, the url seems like a PHP method.
I think the issue here is not the type, but redirect that happens and that might not be supported in RN itself. If you could display image straight away w/o redirecting, that should solve the problem.
@grabbou yes, there is no extension but redirect in my case, I also think it's not supported well in RN. But sometimes it works well, it's weird.
I tried to display http://bbs.uestc.edu.cn/uc_server/avatar.php?uid=32044&size=middle
in html with <img>
tag, it will get 301
code and then get the right picture with extension.
Seems like RN didn't support the redirect well even in latest 0.21.
@facebook-github-bot bugfix
Hey @just4fun, we're a small team and rely on the community to fix issues that don't affect fb apps. If you're sure this is a bug can you send a pull request with a fix?
GitHub bot closes PRs and merges them manually - see the commit reference above :)