TheWidlarzGroup / rn-emoji-keyboard

Super performant, lightweight, fully customizable emoji picker 🚀
https://thewidlarzgroup.github.io/rn-emoji-keyboard/
MIT License
326 stars 59 forks source link

Error when loading module in Expo app #87

Closed stevenaanen closed 1 year ago

stevenaanen commented 1 year ago

Describe the bug In our recently set up Expo app, we get a reference error as soon as the module is imported.

The error:

ERROR  TypeError: undefined is not an object (evaluating '_en.default')     // KeyboardContext.tsx:138
ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.

To Reproduce Import the module in a Expo app: import EmojiPicker from "rn-emoji-keyboard"

Screenshots

Screenshot 2022-09-28 at 16 52 04

In this case, I'm running through Expo Go in an iOS simulator. Tested also in an Android simulator and the result is the same.

haikov commented 1 year ago

Apparently, imports referencing module itself like this https://github.com/TheWidlarzGroup/rn-emoji-keyboard/blob/master/src/contexts/KeyboardContext.tsx#L3 aren't working

Changing linked line from

import { en } from 'rn-emoji-keyboard'

to relative import fixes the problem:

import en from '../translation/en'
mateki0 commented 1 year ago

Thanks for reporting and providing a solution. It will be fixed in next release.