ptmt / react-native-macos

[deprecated in favor of https://microsoft.github.io/react-native-windows/] React Native for macOS is an experimental fork for writing desktop apps using Cocoa
MIT License
11.25k stars 429 forks source link

Incompatible with React 16.3 Context Provider API #246

Open kirill-konshin opened 5 years ago

kirill-konshin commented 5 years ago

🐛 Bug Report

To Reproduce

Following code:

const Context = React.createContext();

const Foo = () => (<Context.Provider value={'xxx'}/>);

will result in an error:

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.

I caught this error when I was using react-apollo@2.5.3 https://github.com/apollographql/react-apollo/releases/tag/v2.5.3:

The ApolloProvider / ApolloConsumer implementations have been refactored to use React 16.3's new context API.

React installed in the project is at version 16.9.0.

I suspect it's because react-native-macos is far behind modern react-native which supports hooks and context API properly, see #226.

Environment