Compare commits

...

1 Commits

Author SHA1 Message Date
Ammar Ahmed
82e8bc80ae mobile: fix dialog calling onClose after pressing positive button 2025-02-11 10:24:25 +05:00
2 changed files with 12 additions and 8 deletions

View File

@@ -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) {

View File

@@ -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