Merge pull request #7684 from BlueWallet/man

FIX: DIscard changes alert was not working
This commit is contained in:
GLaDOS 2025-03-09 19:00:23 +00:00 committed by GitHub
commit 0b1c3dd9f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 9 deletions

View file

@ -364,7 +364,7 @@ const DetailViewStackScreensStack = () => {
options={navigationStyle({ options={navigationStyle({
headerBackVisible: false, headerBackVisible: false,
gestureEnabled: false, gestureEnabled: false,
presentation: 'containedModal', presentation: 'fullScreenModal',
title: loc.wallets.manage_title, title: loc.wallets.manage_title,
statusBarStyle: 'auto', statusBarStyle: 'auto',
})(theme)} })(theme)}

View file

@ -192,7 +192,7 @@ const ManageWallets: React.FC = () => {
const { wallets: storedWallets, setWalletsWithNewOrder, txMetadata, handleWalletDeletion } = useStorage(); const { wallets: storedWallets, setWalletsWithNewOrder, txMetadata, handleWalletDeletion } = useStorage();
const { setIsDrawerShouldHide } = useSettings(); const { setIsDrawerShouldHide } = useSettings();
const walletsRef = useRef<TWallet[]>(deepCopyWallets(storedWallets)); // Create a deep copy of wallets for the DraggableFlatList const walletsRef = useRef<TWallet[]>(deepCopyWallets(storedWallets)); // Create a deep copy of wallets for the DraggableFlatList
const { navigate, setOptions, goBack } = useExtendedNavigation(); const { navigate, setOptions, goBack, dispatch: navigationDispatch } = useExtendedNavigation();
const [state, dispatch] = useReducer(reducer, initialState); const [state, dispatch] = useReducer(reducer, initialState);
const debouncedSearchQuery = useDebounce(state.searchQuery, 300); const debouncedSearchQuery = useDebounce(state.searchQuery, 300);
const bounceAnim = useBounceAnimation(state.searchQuery); const bounceAnim = useBounceAnimation(state.searchQuery);
@ -227,13 +227,15 @@ const ManageWallets: React.FC = () => {
return JSON.stringify(walletsRef.current) !== JSON.stringify(state.tempOrder.map(item => item.data)); return JSON.stringify(walletsRef.current) !== JSON.stringify(state.tempOrder.map(item => item.data));
}, [state.tempOrder]); }, [state.tempOrder]);
usePreventRemove(hasUnsavedChanges, async () => { usePreventRemove(hasUnsavedChanges, ({ data: preventRemoveData }) => {
await new Promise<void>(resolve => { Alert.alert(loc._.discard_changes, loc._.discard_changes_explain, [
Alert.alert(loc._.discard_changes, loc._.discard_changes_explain, [ { text: loc._.cancel, style: 'cancel' },
{ text: loc._.cancel, style: 'cancel', onPress: () => resolve() }, {
{ text: loc._.ok, style: 'default', onPress: () => resolve() }, text: loc._.ok,
]); style: 'destructive',
}); onPress: () => navigationDispatch(preventRemoveData.action),
},
]);
}); });
const handleClose = useCallback(() => { const handleClose = useCallback(() => {