Skip to content

Commit

Permalink
Merge 8af3cd8 into 6a3604c
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-cortes authored Nov 16, 2022
2 parents 6a3604c + 8af3cd8 commit cae7796
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-fireants-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Fix navigation lock bug after (un)installing apps, top arrow
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const useLockNavigation = (
useEffect(() => {
exposedManagerNavLockCallback.next(when ? callback : undefined);
lockSubject.next(when);
const listener = navigation.addListener("beforeRemove", e => {
const listenerCleanup = navigation.addListener("beforeRemove", e => {
if (!when) {
// If we don't have unsaved changes, then we don't need to do anything
return;
Expand All @@ -80,7 +80,7 @@ export const useLockNavigation = (
return () => {
lockSubject.next(false);
exposedManagerNavLockCallback.next(undefined);
navigation.removeListener("beforeRemove", listener);
listenerCleanup();
};
}, [callback, navigation, when]);
};
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,11 @@ const PostOnboardingHub = ({ navigation }: NavigationProps) => {
navigation.setOptions({ gestureEnabled: false, headerRight: () => null });
navigation.getParent()?.setOptions({ gestureEnabled: false });
allowClosingScreen.current = false;
const beforeRemoveCallback: EventListenerCallback<
StackNavigationEventMap &
EventMapCore<StackNavigationState<NavigationProps>>,
"beforeRemove"
> = e => {
const listenerCleanup = navigation.addListener("beforeRemove", e => {
if (!allowClosingScreen.current) e.preventDefault();
};
navigation.addListener("beforeRemove", beforeRemoveCallback);
});
return () => {
navigation.removeListener("beforeRemove", beforeRemoveCallback);
listenerCleanup();
clearAnimationTimeout();
cancelAnimation(animDoneValue);
};
Expand Down

0 comments on commit cae7796

Please sign in to comment.