File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import Log from '@libs/Log' ;
12import CONST from '@src/CONST' ;
23
34type CancelHandle = { cancel : ( ) => void } ;
@@ -28,12 +29,17 @@ let promiseForNextTransitionStart = new Promise<void>((resolve) => {
2829
2930/**
3031 * Invokes and removes all pending callbacks.
32+ * Each callback is isolated so that one exception does not prevent the rest from running.
3133 */
3234function flushCallbacks ( ) : void {
3335 const callbacks = pendingCallbacks ;
3436 pendingCallbacks = [ ] ;
3537 for ( const callback of callbacks ) {
36- callback ( ) ;
38+ try {
39+ callback ( ) ;
40+ } catch ( error ) {
41+ Log . warn ( '[TransitionTracker] A pending callback threw an error' , { error} ) ;
42+ }
3743 }
3844}
3945
Original file line number Diff line number Diff line change @@ -32,13 +32,12 @@ const dismiss = (options?: DismissKeyboardOptions): Promise<void> => {
3232 return ;
3333 }
3434
35+ TransitionTracker . startTransition ( ) ;
3536 const subscription = Keyboard . addListener ( 'keyboardDidHide' , ( ) => {
3637 resolve ( ) ;
3738 TransitionTracker . endTransition ( ) ;
3839 subscription . remove ( ) ;
3940 } ) ;
40-
41- TransitionTracker . startTransition ( ) ;
4241 Keyboard . dismiss ( ) ;
4342
4443 if ( options ?. afterTransition ) {
Original file line number Diff line number Diff line change @@ -31,13 +31,12 @@ const dismiss = (options?: DismissKeyboardOptions): Promise<void> => {
3131 return ;
3232 }
3333
34+ TransitionTracker . startTransition ( ) ;
3435 const subscription = Keyboard . addListener ( 'keyboardDidHide' , ( ) => {
3536 resolve ( ) ;
3637 TransitionTracker . endTransition ( ) ;
3738 subscription . remove ( ) ;
3839 } ) ;
39-
40- TransitionTracker . startTransition ( ) ;
4140 Keyboard . dismiss ( ) ;
4241
4342 if ( options ?. afterTransition ) {
Original file line number Diff line number Diff line change @@ -64,9 +64,8 @@ const dismiss = (options?: DismissKeyboardOptions): Promise<void> => {
6464 return resolve ( ) ;
6565 } ;
6666
67- window . visualViewport ?. addEventListener ( 'resize' , handleDismissResize ) ;
68-
6967 TransitionTracker . startTransition ( ) ;
68+ window . visualViewport ?. addEventListener ( 'resize' , handleDismissResize ) ;
7069 Keyboard . dismiss ( ) ;
7170
7271 if ( options ?. afterTransition ) {
You can’t perform that action at this time.
0 commit comments