Fix race condition for keyboard tracker (#6902)
This commit is contained in:
parent
da4470bd78
commit
49c242e300
1 changed files with 7 additions and 4 deletions
|
|
@ -24,10 +24,13 @@ export const useKeyboardTrackingPaused = (keyboardTrackingRef: RefObject<Keyboar
|
|||
};
|
||||
|
||||
const commandListener = Navigation.events().registerCommandListener(() => {
|
||||
if (!isPostDraftPaused.current) {
|
||||
isPostDraftPaused.current = true;
|
||||
keyboardTrackingRef.current?.pauseTracking(trackerId);
|
||||
}
|
||||
setTimeout(() => {
|
||||
const visibleScreen = NavigationStore.getVisibleScreen();
|
||||
if (!isPostDraftPaused.current && !screens.includes(visibleScreen)) {
|
||||
isPostDraftPaused.current = true;
|
||||
keyboardTrackingRef.current?.pauseTracking(trackerId);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const commandCompletedListener = Navigation.events().registerCommandCompletedListener(() => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue