MCPcopy
hub / github.com/callstack/react-native-paper / restorePrefs

Function restorePrefs

example/src/index.native.tsx:95–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93
94 React.useEffect(() => {
95 const restorePrefs = async () => {
96 try {
97 const prefString = await AsyncStorage.getItem(PREFERENCES_KEY);
98 const preferences = JSON.parse(prefString || '');
99
100 if (preferences) {
101 setIsDarkMode(preferences.theme === 'dark');
102
103 if (typeof preferences.rtl === 'boolean') {
104 setRtl(preferences.rtl);
105 }
106 }
107 } catch (e) {
108 // ignore error
109 }
110 };
111
112 restorePrefs();
113 }, []);

Callers 1

PaperExampleFunction · 0.70

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…