fixed reload on settings change

This commit is contained in:
2024-09-19 16:43:27 +02:00
parent d4319d0269
commit 5805bc6bf3
2 changed files with 8 additions and 12 deletions

View File

@@ -1,12 +1,11 @@
import React, { createContext, useContext, useState, useEffect } from 'react';
import axios from 'axios';
import { SettingsContext } from './SettingsProvider';
import { encode as btoa } from 'base-64';
import { format } from 'date-fns';
import Settings from './screens/Settings';
import { ThemeButton, ThemeText } from './common/ThemeTypes';
import React, { createContext, useContext, useEffect, useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { SettingsContext } from './SettingsProvider';
import { ThemeButton, ThemeText } from './common/ThemeTypes';
import { useColors } from './common/colors';
import { decode as atob, encode as btoa } from 'base-64'
import Login from './screens/Login';
export const InterfaceContext = createContext<any>(null);
@@ -17,6 +16,7 @@ const Interface = ({ children }) => {
const [userInformation, setUserInformation] = useState(null);
const [baseData, setBaseData] = useState(null);
const [loading, setLoading] = useState(true);
const [initialLoading, setInitialLoading] = useState(true);
const [error, setError] = useState(false);
const [errorObject, setErrorObject] = useState(null);
@@ -37,6 +37,7 @@ const Interface = ({ children }) => {
setError(true)
} finally {
setLoading(false)
setInitialLoading(false)
}
}
@@ -175,7 +176,7 @@ const Interface = ({ children }) => {
<Login />
</View>
)
if (!loading) return (children)
if (!initialLoading) return (children)
}
return (

View File

@@ -1,7 +1,6 @@
import FontAwesome5 from '@expo/vector-icons/FontAwesome5';
import * as Application from 'expo-application';
import { useContext, useEffect, useRef, useState } from 'react';
import { ActivityIndicator, Alert, Animated, Button, Image, Linking, Platform, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import { ActivityIndicator, Alert, Animated, Button, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import ErrorBoundary from 'react-native-error-boundary';
import { SettingsContext } from '../SettingsProvider';
import Credits from '../common/Credits';
@@ -55,10 +54,6 @@ const Settings = () => {
}
};
const handleLinkPress = (url) => {
Linking.openURL(url);
};
const handleChange = (setter) => (value) => {
setter(value);
showToast(ToastType.Warn, 'Ungespeicherte Änderungen');