Description
TypeError: changeHandler is not a function (it is undefined)
This error is coming when i'm running my code this it the part where i used the Event listener :-
useEffect(() => {
const subscription = AppState.addEventListener('change', nextAppState => {
if (
appState.current.match(/inactive|background/) &&
nextAppState === 'active'
) {
console.log('App has come to the foreground!');
} else {
// await camera.current.stopRecording();
console.log('Before checking interview_type, timerStart:', timerStart);
setStartRecording(false);
if (parseInt(candidate?.candidate?.interview_type) != 3) {
console.log("yaha pe aayaaaaaaaa haiiiii")
setTimerStart(false);
}
else{
setTimerStart(true)
}
console.log('App has come to the background check the timer!',timerStart,candidate?.candidate?.interview_type);
console.log('App has come to the background!');
}
appState.current = nextAppState;
setAppsTate(appState.current);
console.log('AppState', appState.current);
});
return () => {
subscription.remove();
};
}, []);
Steps to reproduce
When I run the app and minimize it, then open it again, it restarts
React Native Version
0.77
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 15.4.1
CPU: (11) arm64 Apple M3 Pro
Memory: 70.78 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.17.1
path: ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: Not Found
npm:
version: 9.6.7
path: ~/.nvm/versions/node/v18.17.1/bin/npm
Watchman:
version: 2024.12.02.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK: Not Found
Android SDK:
API Levels:
- "28"
- "29"
- "30"
- "31"
- "32"
- "33"
- "34"
- "35"
Build Tools:
- 30.0.2
- 30.0.3
- 31.0.0
- 34.0.0
- 35.0.0
System Images:
- android-34 | Google APIs ARM 64 v8a
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2023.2 AI-232.10300.40.2321.11567975
Xcode:
version: /undefined
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 12.3.7
wanted: ^12.3.0
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.77.0
wanted: 0.77.0
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: Not found
newArchEnabled: false
Stacktrace or Logs
TypeError: changeHandler is not a function (it is undefined)
MANDATORY Reproducer
https://github.com/Nayan1502
Screenshots and Videos
No response
Description
TypeError: changeHandler is not a function (it is undefined)
This error is coming when i'm running my code this it the part where i used the Event listener :-
useEffect(() => {
const subscription = AppState.addEventListener('change', nextAppState => {
if (
appState.current.match(/inactive|background/) &&
nextAppState === 'active'
) {
console.log('App has come to the foreground!');
} else {
// await camera.current.stopRecording();
console.log('Before checking interview_type, timerStart:', timerStart);
}, []);
Steps to reproduce
When I run the app and minimize it, then open it again, it restarts
React Native Version
0.77
Affected Platforms
Runtime - Android
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
https://github.com/Nayan1502
Screenshots and Videos
No response