marcshilling / react-native-idle-timer

A cross-platform bridge that allows you to enable and disable the screen idle timer in your React Native app
MIT License
212 stars 41 forks source link

null is not an object #29

Open guthriet1230 opened 2 years ago

guthriet1230 commented 2 years ago

I downloaded the package and pod installed. i reran my metro server and when i navigate to my camera screen, the code is fired and BOOM...

null is not an object (evaluating '_reactNative.NativeModules.KCKeepAwake.activate')

"react-native": "0.69.3", "react-native-idle-timer": "^2.1.7",

import IdleTimerManager from 'react-native-idle-timer';

within my component useEffect(()=>{ if(isRecording){ IdleTimerManager.setIdleTimerDisabled(true); } else{ IdleTimerManager.setIdleTimerDisabled(false); } },[isRecording])

avishka-codimite commented 1 year ago

same issue

TypeError: null is not an object (evaluating '_reactNativeIdleTimer.default.setIdleTimerDisabled')

bn3t commented 1 year ago

Same result here. My setup is tvOS with react-native-tvos@0.71.7-0rc1. I have another native library which works well in my project.

About the install instructions, I think currently it is not necessary to do react-native link anymore. This was for react-native pre 0.60. So I did (cd ios && pod install).

I currently worked around the problem by calling directly setIdleTimerDisabled when the app is activated, but I would like to use this library to have finer grain control.

[application setIdleTimerDisabled:YES];