TypeError: changeHandler is not a function (it is undefined)
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
[!WARNING] Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.
[!WARNING] Could not parse version: We could not find or parse the version number of React Native in your issue report. Please use the template, and report your version including major, minor, and patch numbers - e.g. 0.76.2.
[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
- For majority of bugs: send us a Pull Request with the RNTesterPlayground.js edited to reproduce your bug.
- If your bug is UI related: a Snack
- If your bug is build/upgrade related: a project using our Reproducer Template
You can read more about about it on our website: How to report a bug.
@Nayan1502 Thanks for raising this. It would be helpful if you could provide a valid reproducer using this template. Also provide exact steps to repro this.
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.
This issue is waiting for author's feedback since 24 days. Please provide the requested feedback or this will be closed in 7 days.
This issue was closed because the author hasn't provided the requested feedback after 7 days.