mobile: fix e2e tests

This commit is contained in:
Ammar Ahmed
2025-02-04 19:23:11 +05:00
parent 89fe712104
commit 48ffecfb5f
2 changed files with 7 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ import {
StackActions,
useNavigation
} from "@react-navigation/native";
import React, { useRef, useState } from "react";
import React, { useEffect, useRef, useState } from "react";
import { ActivityIndicator, TextInput, View } from "react-native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import ToggleSwitch from "toggle-switch-react-native";
@@ -103,6 +103,11 @@ const _SectionItem = ({ item }: { item: SettingSection }) => {
}
};
useEffect(() => {
setIsHidden(item.hidden && item.hidden(item.property || current));
setIsDisabled(item.disabled && item.disabled(item.property || current));
}, [current, item]);
return isHidden ? null : (
<Pressable
disabled={item.type === "component" || isDisabled}

View File

@@ -451,7 +451,7 @@ export const settingsGroups: SettingSection[] = [
"local",
"partial"
);
if (result.error) throw result.error as Error;
if (result?.error) throw result.error as Error;
} catch (e) {
DatabaseLogger.error(e);
const error = e;