React-native-web: Image SSR

Created on 17 Feb 2019  路  4Comments  路  Source: necolas/react-native-web

The problem
When rendering an \https://github.com/necolas/react-native-web/issues/543 and saw that there was a change to

When rendered on the server, images now include the 'src' and will be
downloaded by the browser rather than waiting for the client-side JS to
initiate image loading.
how ever the nature does not seem to be functioning correctly as of ^0.10.0.

How to reproduce
I have included a test case of the issue in the codesandbox bellow. I have just printed the result from the SSR to show it is a div rather then an image.
Simplified test case: https://codesandbox.io/s/4qv993qrmx

Steps to reproduce:

  1. Create an app with SSR and Client side
  2. Render a tag with uri
  3. check page and it appears to work but if you disable javascript the image is a div.

Expected behavior
the html from the ReactDOMServer.renderToString should be an img tag but is a div tag and then is changed after the client side is hydrated.

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.10.0
  • React (version): 16.5.2
  • Browser: Firefox/chrome

Additional:
I am pretty sure your intention was to render out the \

Most helpful comment

Duplicate of #543 and reason for the current approach is explained by https://github.com/necolas/react-native-web/issues/543#issuecomment-310844971

If you want to SSR an image use the defaultSource prop.

All 4 comments

I have logged the issue, but have closed it temporarily to make sure it wasn't any thing to do with my browser.

Reopened. The issue became hidden on codesandbox due to the live rerendering of code sandbox.
by going directly to https://4qv993qrmx.codesandbox.io/ where it only renders once until you edit it will show the error.

screenshot from 2019-02-17 18-47-41

Duplicate of #543 and reason for the current approach is explained by https://github.com/necolas/react-native-web/issues/543#issuecomment-310844971

If you want to SSR an image use the defaultSource prop.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DaKaZ picture DaKaZ  路  3Comments

EvanBacon picture EvanBacon  路  3Comments

passion0470 picture passion0470  路  3Comments

zhangking picture zhangking  路  3Comments

necolas picture necolas  路  3Comments