codemotionapps/react-native-dark-mode

TypeError: (0 , _react.useContext) is not a function

Closed this issue · 1 comments

image

I'm using react-native 0.59.10. I've installed this library and got that error. How to fix it, guy?! :((

Looks like you're running and old version of React (not React Native). React Native 0.59 uses React 16.8.3. Install that and this error should go away.
But looking at the call stack it also seems like you're trying to use this package in a class component. That means that after updating React this screen will show up:
image
Please check out the docs to learn how to use hooks: https://reactjs.org/docs/hooks-intro.html
This library is not made to be used with class components.