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

World's worst high-five not rendering in second code sample #14566

Closed
dirkstoop opened this issue Jun 16, 2017 · 7 comments
Closed

World's worst high-five not rendering in second code sample #14566

dirkstoop opened this issue Jun 16, 2017 · 7 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@dirkstoop
Copy link
Contributor

Description

Visited https://facebook.github.io/react-native/, tried second example (under header "A React Native app is a real mobile app") in a react-native project. Image does not render

Reproduction Steps

  1. Add the below JSX to any component that won't apply a styleSheet to it:
    <Image source={{uri: 'https://i.chzbgr.com/full/7345954048/h7E2C65F9/'}} />
  2. npm start ios
  3. notice how the image does not render

Sample Code

App.js:

import React from 'react';
import { Image } from 'react-native';

export default class HighFives extends React.Component {
render() {
return (
<Image source={{uri: 'https://i.chzbgr.com/full/7345954048/h7E2C65F9/'}}/>
);
}
}

Solution

Adding style={{width:320 height:240}} fixes it, but not sure if that's the right fix. New to this.

Additional Information

  • React Native version: "react-native": "^0.44.0"
  • Platform: iOS
  • Development Operating System: macOS el capitan
  • Build tools: N/A, running Expo app
@dirkstoop
Copy link
Contributor Author

Isolating issue: replacing the uri with "https://media0.giphy.com/media/xUA7baC8zM9BAVFYLC/giphy.gif" does not address issue, showing that problem is not related to original gif no longer being world's worst high-five ever.

@hramos
Copy link
Contributor

hramos commented Jun 16, 2017

Interesting - I thought I had fixed this, but it looks like I didn't get around to pushing a fix. Yes, the fix is to add style={{width:320 height:240}} as React Native needs to know the dimensions for a remote image ahead of time. Do you want to send a PR? Should be a quick fix.

@dirkstoop
Copy link
Contributor Author

Sure thing, I'll put one up in a minute. Cheers!

dirkstoop added a commit to bubbleelectric/react-native that referenced this issue Jun 16, 2017
Test Plan: - run website, visit in browser, verify example code renders correctly
- copy and paste example code of second example on landing page into App.js of a freshly created react native app
- prepend "export default" to line 4 of code
- run the app for ios or android (npm start ios)
- verify that image of terrible high-five renders in the app

Issue: facebook#14566
@peterp
Copy link
Contributor

peterp commented Jun 17, 2017

@hramos I've seen this issue hit a few web-dev-people, do you think there's value in adding a runtime warning to images loaded over the network that don't specify dimensions? Something along the lines of "Remote images must specify dimensions, style={{ height: 100, width: 100 }}, ahead of time."

@ItsNoHax
Copy link

ItsNoHax commented Jul 18, 2017

I don't know if it is related to this but if an Image has a borderRadius style and resizeMode 'contain', it won't load the image in RN 0.46.1, 0.46.2, 0.46.3 (the ones I've tested so far)

@peterp
Copy link
Contributor

peterp commented Jul 18, 2017

@ItsNoHax Can you reproduce in an expo demo?

@ItsNoHax
Copy link

ItsNoHax commented Jul 18, 2017

@peterp #15053

@facebook facebook locked as resolved and limited conversation to collaborators Jun 27, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants