react-native-keyboard-controller
react-native-keyboard-controller copied to clipboard
TypeError: undefined is not an object (evaluating 'this.InnerNativeModule.installCoreFunctions')
Describe the bug A clear and concise description of what the bug is.
1.Error: Requiring module "node_modules/react-native-keyboard-controller/src/index.ts", which threw an exception: TypeError: undefined is not an object (evaluating 'this.InnerNativeModule.installCoreFunctions')
2.undefined is not an object (evaluating '_$$_REQUIRE(_dependencyMap[6], "react-native-keyboard-controller").KeyboardProvider')
Code snippet Add your code snippet where error has been occurred.
import { KeyboardProvider } from 'react-native-keyboard-controller';
<KeyboardProvider>
<Provider {...Stores}>
<RootSiblingParent key="RootSiblingParent">
<Navigation routeName={routeName} params={params} />
</RootSiblingParent>
</Provider>
</KeyboardProvider>
Repo for reproducing I would be highly appreciate if you can provide repository for reproducing your issue. It can significantly reduce the time for discovering and fixing the problem.
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
- Desktop OS [e.g. Windows 10, MacOS 10.15.5]
- Device: [e.g. iPhone6]
- OS: [e.g. iOS 8.1]
- JS engine [e.g. JSC, Hermes, v8]
- Library version [e.g. 22]
Additional context Add any other context about the problem here.
HI @jamninetyfive
Have you tried to re-run metro server with --reset-cache
option? Seems like metro can not detect the library (according to description problem).
Getting a similar error on expo dev client.
I've tried rebuilding it and resetting the cache.
![image](https://user-images.githubusercontent.com/57633368/184689384-c6fe2f4a-6b24-44d2-be77-ec97ad0190b9.png)
Hi @vbylen
Thank you for the information! I know this library is definitely compatible with Expo (here is an example that it works together).
Did you run npx expo prebuild --clean
command?
@kirillzyusko hmm interesting, I just ran the expo start --dev-client -c
command.
We may need an expo config plugin for this.
@vbylen and with expo start --dev-client -c
it works well?
To be fair I'm not very familiar with expo development (though I understand, it's a big part of react-native
community). I would love to simplify installation process for expo
users, but again, I'm not professional in this framework 🤷♂️
Do you think it will be enough to add kind of warning to installation guide saying something like:
Be sure, that you are running
start
command with--dev-client -c
arguments, i.e.expo start --dev-client -c
, otherwise you may see errors.
Or if I develop plugin - will it be automatically recognized by the expo? And you will not need any extra steps for installation?
I don't know why, but I think I've heard somewhere, that you can develop "config plugins" only for verified packages. Maybe it's not truth - I'm glad to hear your opinion/feedback 🙂
@kirillzyusko ah, I see!
No, I haven't been able to get it to work with that command.
The expo dev client lets you work with native modules without having to build the /ios and /android directories.
To make react-native-keyboard-controller
compatible with the dev client we'll need to create an expo plugin as you mentioned, which you would add in app.json
to the plugins key and from there everything should work smoothly with just running yarn add react-native-keyboard-controller
.
I hope that makes sense to you.
I'm not sure I can help with the config plugin, maybe someone more motivated and knowledgeable can chime in. Although I don't think it would be that hard 😄
@vbylen thank you for the info. Asking from curiosity: how https://github.com/hirbod/keyboard-controller-statusbar-issue-repro app works without additional config setup? 🤔 This app runs on expo
...
@vbylen thank you for the info. Asking from curiosity: how https://github.com/hirbod/keyboard-controller-statusbar-issue-repro app works without additional config setup? 🤔 This app runs on
expo
...
Try deleting /ios and /android folders, and run expo start --dev-client
command.
This library does not need a config plugin, since it just needs autolinking/autoinstalling, which will work from 0.60+
You need to know that you CAN'T run it with Expo Go, since this library adds native code, that is the reason you need to build your own development client (expo-dev-client). Simply running npx expo start --dev-client
it not sufficient enough. You will need to use Android Studio/XCode to build your development client or build it in the cloud with EAS (free)
It happened if you don't link the library. I just re-discovered this bug.
The weird stacktrace is because here I'm passing RCTKeyboardController
(which is derived from NativeModules directly without any null checks). I improved linking error message here: https://github.com/kirillzyusko/react-native-keyboard-controller/pull/78/commits/d38dc3c40f04b206073baf1163807ce18d158518
So now it will have more clean description of the problem and will suggest potential ways for resolving the issue.
I'll close the issue when new release will be published. But feel free to re-open the issue if something is not clear or you reproduced the problem in a different scenario.
Closed, because 1.3.0 has been published.