Closed sudhirvkumar closed 8 years ago
I had to comment out the whole if block to make the code work.
Also... I had to change the
function isReactElement(maybeElement) { return maybeElement['$$typeof'] === Symbol.for('react.element'); }
to simply return true... which is a hack.
I guess we have to use var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) || 0xeac7;
to determine if an element is React Element.
Please let me know your thoughts
@ohanhi @mk @eeue56 any ideas?
Copied this issue to https://github.com/elm-native-ui/core/issues/3
@mk @ohanhi @eeue56
in
src/Native/Runtime.js
the following lines throw error in Redbox and nothing works.// React elements have a
$$typeofmarker whose value is an // ES6 Symbol. If
Symboldoes not exist, we bail out early. if (typeof(window.Symbol) === 'undefined') { throw new Error( 'You seem to be running on an unsupported platform.\n' + 'Elm.embedReact is currently only supported for React Native.\n' + 'Please use Elm.embed or Elm.fullscreen instead.' ); }
As I checked the react source. Symbol or a polyfill may or may not be available always and they use a plan number
0xeac7
as fallback to represent ReactElement Type. This happens at runtime so the value forREACT_ELEMENT_TYPE
is not fixed across all compiled files. We need to figure this out in runtime not development time. It has to be dynamic not static.The following is the code from
https://github.com/facebook/react/blob/0.14-stable/src/isomorphic/classic/element/ReactElement.js
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) || 0xeac7;