codemotionapps/react-native-dark-mode

Cannot read property 'initialMode' of undefined

Closed this issue · 4 comments

I am getting the following error:

Cannot read property 'initialMode' of undefined.

I am just importing

import { useDarkMode } from 'react-native-dark-mode';

then calling

const isDarkMode = useDarkMode();

It gives me this error. I am on React Native 0.60.4 and react-native-dark-mode 0.1.2.

That's strange. initialMode isn't pascal case. I need more information. Does this happen on Android only or on iOS only or both? If it's only iOS did you run pod install after npm install/yarn add?

Sorry, I updated it to camelCase. So, this error is in iOS and not in android.

After I saw your reply, I did a pod install and it worked. Do you want me to make a pull request to update the doc in the Readme for this?

I had to add your library to the transformIgnorePatterns since export was being unrecognized

Screen Shot 2020-04-04 at 14 52 10

Screen Shot 2020-04-04 at 14 47 37