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

ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StepCounter' could not be found. #44

Closed reneumeh closed 6 months ago

reneumeh commented 6 months ago

React Native Step Counter New Issue

Operating System: Windows

Using: Expo@49.0.23 react-native@0.72.10

System: OS: Windows 11 10.0.22631 CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz Memory: 2.03 GB / 15.86 GB Binaries: Node: version: 18.12.0 path: C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: version: 8.19.2 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: Not Found Visual Studio:

Expected Behavior

Actual Behavior

Steps to Reproduce the Problem

npm install expo-cli --global npx create-expo-app . --template blank-typescript@sdk-49 npm install expo-sensors@12.3.0 npm install --global @expo/ngrok@^4.1.0
npx expo install react-dom react-native-web @expo/metro-runtime
npx expo install @expo/webpack-config@^18.0.1
npm install @dongminyu/react-native-step-counter npm start -- --tunnel

OR

  1. npm install @dongminyu/react-native-step-counter
  2. npm start -- --tunnel
AndrewDongminYoo commented 6 months ago

First of all, thank you for reporting your first issue. Based on your issue description, it sounds like you want to use this library for your Expo application, but it's my understanding that this library is implemented in Turbomodule, one of React Native's newer architectures, so it's not available in Expo Go. We've set up an error message to inform you of this, but it doesn't seem to have gotten through to you. There is a library in the expo faction called expo-sensors that should be able to fully implement the functionality you're looking to implement in this library. I'll close this issue with a simple example.

import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Pedometer } from 'expo-sensors';

export default function App() {
  const [currentStepCount, setCurrentStepCount] = useState(0);

  useEffect(() => {
    const subscription = Pedometer.watchStepCount(result => {
      setCurrentStepCount(result.steps);
    });

    return () => subscription.remove();
  }, []);

  return (
    <View style={styles.container}>
      <Text>Steps taken: {currentStepCount}</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#fff',
  },
});

See More

MaxiAschenbrenner commented 1 month ago

@AndrewDongminYoo Im having the same Problem using RN v74.3 without Expo. (NOBRIDGE) ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'StepCounter' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: true. TurboModule interop: true Any idea on how to fix this?