Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: undefined is not an object (evaluating 'this.InnerNativeModule.installCoreFunctions') #46

Closed
Yunnathai opened this issue Aug 8, 2022 · 11 comments
Assignees
Labels
🐛 bug Something isn't working

Comments

@Yunnathai
Copy link

Yunnathai commented Aug 8, 2022

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:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. 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.

@Yunnathai Yunnathai added the 🐛 bug Something isn't working label Aug 8, 2022
@kirillzyusko
Copy link
Owner

kirillzyusko commented Aug 8, 2022

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).

@cloudorbush
Copy link

Getting a similar error on expo dev client.

I've tried rebuilding it and resetting the cache.

image

@kirillzyusko
Copy link
Owner

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?

@cloudorbush
Copy link

cloudorbush commented Aug 15, 2022

@kirillzyusko hmm interesting, I just ran the expo start --dev-client -c command.

We may need an expo config plugin for this.

@kirillzyusko
Copy link
Owner

@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 🙂

@cloudorbush
Copy link

cloudorbush commented Aug 15, 2022

@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 😄

@kirillzyusko
Copy link
Owner

@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...

@cloudorbush
Copy link

@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.

@hirbod
Copy link
Contributor

hirbod commented Aug 29, 2022

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)

@kirillzyusko
Copy link
Owner

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: d38dc3c

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.

@kirillzyusko
Copy link
Owner

Closed, because 1.3.0 has been published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants