2

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.

<Image style={styles.avatar} source={{uri: authrization.avatar}} /> 

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.

However, the avatar is not displayed sometimes. See the screenshot.

Does the <Image> component only support static picture file which ends with jpg|png|gif?

1 Answer 1

2

That URL returns a redirect. However, the Image component doesn't support redirects.

As a workaround, use a URL that returns the image. If you want support for redirects please consider sending a pull request.

Checked with curl:

$ curl -I http://bbs.uestc.edu.cn/uc_server/avatar.php?uid=32044&size=middle HTTP/1.1 301 Moved Permanently 
Sign up to request clarification or add additional context in comments.

2 Comments

This issue is fixed by github.com/facebook/react-native/commit/… and it was release in RN 0.26.0.
@talent was this fixed for Android too? It doesnt seem to work for me

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.