Skip to content

Instantly share code, notes, and snippets.

@agustinfece
Created June 18, 2021 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustinfece/11aa7650a9d64c3f8a01446b16cd71bd to your computer and use it in GitHub Desktop.
Save agustinfece/11aa7650a9d64c3f8a01446b16cd71bd to your computer and use it in GitHub Desktop.
App.js
import { StatusBar } from 'expo-status-bar';
import React, { useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';
export default function App() {
const getTheme = async () => {
try {
const value = await AsyncStorage.getItem('theme');
console.log('value', value);
} catch(error) {
console.log('error', error);
};
};
useEffect(() => {
getTheme();
}, []);
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment