expo / config-plugins

Out-of-tree Expo config plugins for packages that haven't adopted the config plugin system yet.
445 stars 95 forks source link

Cannot read properties of undefined (reading 'createClient') #33

Closed dnovacik closed 2 years ago

dnovacik commented 2 years ago

I followed the steps to integrate the config plugin of ble. Then I build it via expo build:android

but it always throws Cannot read properties of undefined (reading 'createClient') on this BleManager line:

BleModule.createClient(options.restoreStateIdentifier || null)

any ideas what could be wrong?

created a bare project for reproduction:

https://github.com/dnovacik/expo-bluetooth-test

EvanBacon commented 2 years ago

Downloaded the repro and ran rm -rf android && expo run:android project ran as expected after resolving some reanimated issues (lock version "react-native-reanimated": "2.2.4",). I imagine you didn't rebuild the project as expected so the native module couldn't be found.

Something I noticed about your repro is that it has some hook loops in it which cause the app to eventually crash.

Try this in the future:

export function useManager() {
  return useMemo(() => new BleManager(), []);
}