47 lines
985 B
TypeScript
47 lines
985 B
TypeScript
/**
|
|
* Sample React Native App
|
|
* https://github.com/facebook/react-native
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import { StatusBar, StyleSheet, useColorScheme, View } from 'react-native';
|
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
|
|
function App() {
|
|
const isDarkMode = useColorScheme() === 'dark';
|
|
|
|
return (
|
|
<SafeAreaProvider>
|
|
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
|
<AppContent />
|
|
</SafeAreaProvider>
|
|
);
|
|
}
|
|
|
|
import React from 'react';
|
|
import MyText from './components/MyText';
|
|
|
|
function AppContent() {
|
|
const handlePress = React.useCallback(() => {
|
|
alert('You just pressed the text component');
|
|
}, []);
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<MyText yournameherefromprops="Pat" onPress={handlePress} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
backgroundColor: '#fff',
|
|
},
|
|
});
|
|
|
|
export default App;
|