AndrewDongminYoo / react-native-step-counter

[리액트 네이티브 라이브러리] 사용자의 걸음 수를 계산합니다. Android는 StepCounter (or Accelerometer) 센서 API를, iOS는 CoreMotion CMPedometer 를 사용하여 걸음 수를 측정합니다.
https://andrewdongminyoo.github.io/react-native-step-counter/
MIT License
29 stars 10 forks source link

_TurboModuleRegistry.default.getEnforcing #28

Closed aluxmanu closed 1 year ago

aluxmanu commented 1 year ago

TurboModule

Hi, I want to try your library but I'm having some problems making it run on multiple projects.

ERROR TypeError: Cannot read property 'getEnforcing' of undefined, js engine: hermes ERROR TypeError: undefined is not an object (evaluating '_TurboModuleRegistry.default.getEnforcing')

I tried only on the Android with the:

newArchEnabled=false hermesEnabled=true

"@dongminyu/react-native-step-counter": "^0.1.16", "react-native": "0.71.7", also on another project with "react-native": "0.71.8",

So the project is running and is not throwing any error until I import this library into a file. And from the errors that I saw, I think that all are related to this: export default TurboModuleRegistry.getEnforcing('RNStepCounter') as Spec;

I tried to clean everything possible and since the project is running I don't think that is a link problem.

From what I read on react-native Turbo Native Modules is working only with the new architectures. And I see that you mentioned on README that library compatible with both new and legacy architectures

Can you please help me?

AndrewDongminYoo commented 1 year ago

hello. @aluxmanu How are you? I'm happy to announce that I've fixed an error in the library that I found thanks to you, so I committed it on last Saturday, self-tested it, and released a minor version update today. As this is my first React Native module, there were a few small and big issues that I found and fixed quickly, and the error you reported was an issue with the critical logic of interfacing the android/src/newarch/StepCounterSpec.kt file and the android/src/oldarch/NativeStepCounterSpec.kt file as an interface, and we fixed the error by organizing the scattered namespaces of RNStepCounter, StepCounter, etc. that were causing some issues. In my experience developing open source libraries, it's very rewarding to receive and incorporate feedback like this. Thanks for reporting the first issue!!! Feel free to reopen this issue if you see any other issues that follow this, or open a new issue if you encounter any other errors!

p.s. the whole ChangeLogs are here!! Release Notes https://www.npmjs.com/package/@dongminyu/react-native-step-counter/v/0.2.0?activeTab=versions

aluxmanu commented 1 year ago

Hi again @AndrewDongminYoo. I manage to pass the rnx-align-deps error just by removing it the library from the package. And I tested again this issue and now i get this error:

 ERROR  Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StepCounter' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

But this time i get this error when I try to use any methods. Last time I was getting this error directly when i was importing the package.

Thank you for your help with those problems!

aluxmanu commented 1 year ago

@AndrewDongminYoo any updates?