You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
598 B
21 lines
598 B
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
import {Theme} from "@react-navigation/native";
|
|
|
|
export const storeTheme = async (theme) => {
|
|
try {
|
|
const jsonValue = JSON.stringify(theme)
|
|
await AsyncStorage.setItem('@theme', jsonValue)
|
|
console.log("theme stored")
|
|
} catch (e) {
|
|
console.log(e);
|
|
}
|
|
}
|
|
|
|
export const getTheme = async () => {
|
|
try {
|
|
const jsonValue = await AsyncStorage.getItem('@theme')
|
|
return jsonValue != null ? JSON.parse(jsonValue) as Theme : null;
|
|
} catch(e) {
|
|
console.log(e);
|
|
}
|
|
} |