A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
mobile: fix dialog calling onClose after pressing positive button
Ammar Ahmed0cd3bd57390a
diff --git a/apps/mobile/app/components/dialog/index.js b/apps/mobile/app/components/dialog/index.jsindex 1a36c035d..1549f93d6 100644--- a/apps/mobile/app/components/dialog/index.js+++ b/apps/mobile/app/components/dialog/index.js@@ -80,8 +80,9 @@ export const Dialog = ({ context = "global" }) => {return;}}-- hide();+ setChecked(false);+ values.current.inputValue = undefined;+ setVisible(false);};const show = useCallback(@@ -104,14 +105,14 @@ export const Dialog = ({ context = "global" }) => {eUnSubscribeEvent(eOpenSimpleDialog, show);eUnSubscribeEvent(eCloseSimpleDialog, hide);};- }, [show]);+ }, [hide, show]);- const hide = () => {+ const hide = React.useCallback(() => {setChecked(false);values.current.inputValue = undefined;setVisible(false);- dialogInfo.onClose();- };+ dialogInfo.onClose?.();+ }, [dialogInfo]);const onNegativePress = async () => {if (dialogInfo.onClose) {diff --git a/apps/mobile/app/screens/settings/section-item.tsx b/apps/mobile/app/screens/settings/section-item.tsxindex 1aa1895ad..fabe2d1bf 100644--- a/apps/mobile/app/screens/settings/section-item.tsx+++ b/apps/mobile/app/screens/settings/section-item.tsx@@ -41,7 +41,10 @@ import { RouteParams, SettingSection } from "./types";const _SectionItem = ({ item }: { item: SettingSection }) => {const { colors } = useThemeColors();- const settings = useSettingStore((state) => state.settings);+ const [settings, itemProperty] = useSettingStore((state) => [+ state.settings,+ item.property ? state.settings[item.property] : null+ ]);const navigation = useNavigation<NavigationProp<RouteParams>>();const current = item.useHook && item.useHook(item);const [isHidden, setIsHidden] = useState(@@ -106,7 +109,7 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {useEffect(() => {setIsHidden(item.hidden && item.hidden(item.property || current));setIsDisabled(item.disabled && item.disabled(item.property || current));- }, [current, item]);+ }, [current, item, itemProperty]);return isHidden ? null : (<Pressable