diff --git a/App.js b/App.js index e2136f4..31d6be0 100644 --- a/App.js +++ b/App.js @@ -8,12 +8,25 @@ import { LogBox, DevSettings, } from 'react-native'; +import AsyncStorage from '@react-native-async-storage/async-storage'; LogBox.ignoreLogs(['Require cycle:']); const App = () => { const [showStorybook, setShowStorybook] = useState(false); + useEffect(() => { + const getStoredShowStorybook = async () => { + setShowStorybook((await AsyncStorage.getItem('@storybook')) === 'true'); + }; + + getStoredShowStorybook(); + }, []); + + useEffect(() => { + AsyncStorage.setItem('@storybook', String(showStorybook)); + }, [showStorybook]); + useEffect(() => { DevSettings.addMenuItem('Toggle Storybook', () => { setShowStorybook(v => !v);