[ANDROID] [FIXED] - Fix BackHandle callback undefined cause crash issue#48388
[ANDROID] [FIXED] - Fix BackHandle callback undefined cause crash issue#48388ISeekTruth wants to merge 2 commits intofacebook:mainfrom
Conversation
we got an error of `t[n] is not a function. (In 't[n]()', 't[n]' is undefined) \n <unknown> (index.bundle:317:168:317)`, it related the `BackHandle` execute handle function
|
Hi @BleemIs42! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @BleemIs42 in 44705fe When will my fix make it into a release? | How to file a pick request? |
Summary: ## Changelog: [Internal] - Floow-up to facebook#48388, based on the diff discussion (D67648077). Adds a bit better typing to `BackHandler.js`. Differential Revision: D67713236
Summary:
Error message:
we got an error
it related the BackHandle execute handle function.
Investigation result
our project has screen files
App.tsx,Dashboard.tsx, andProfile.tsx.When launching the app, the screen order is
App.tsx->Dashboard.tsx, then user can switch toProfile.tsxFor
App.tsxandDashboard.tsx, we just prevent the hardware button action useusePreventHardwareBackPressEffect()in the first line of screen code.currently,
_backPressSubscriptionshas 2 callback functions.then user switch to
Profile.tsxscreen, and has the below code for hardwareback button and the second doesn'treturn true:currently,
_backPressSubscriptionshas 4 callback functions, include previous 2 and new 2 ofProfile.tsx.When the user press hardwareback button, it will navigate to the login screen, so the issue occurs:
the latest callback will be executed first, then the navigation will let the screen unmount, which will destroy the effect, so the code removing 2 hardwareBackPress callback of
Profile.tsxby executedAfter the navigation ends and the loop is restored, the init
iis 3, theni--,iis 2, then_backPressSubscriptions[2]isundefinednow and executes as a function, so the app crashes.that's the issue I met.
Changelog:
[ANDROID] [FIXED] - Fix BackHandle callback undefined cause crash issue
Test Plan: