mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Improve sample app
Summary: Improve RN sample application code quality. Reviewed By: mroch Differential Revision: D39488055 fbshipit-source-id: f6056c0790d6fee473a57b9d29a0ce21841f63c1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
399907fe4a
commit
03cb5aca3f
+28
-27
@@ -26,9 +26,31 @@ import {
|
||||
ReloadInstructions,
|
||||
} from 'react-native/Libraries/NewAppScreen';
|
||||
|
||||
/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
|
||||
* LTI update could not be added via codemod */
|
||||
const Section = ({children, title}): Node => {
|
||||
const styles = StyleSheet.create({
|
||||
sectionContainer: {
|
||||
marginTop: 32,
|
||||
paddingHorizontal: 24,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 24,
|
||||
fontWeight: '600',
|
||||
},
|
||||
sectionDescription: {
|
||||
marginTop: 8,
|
||||
fontSize: 18,
|
||||
fontWeight: '400',
|
||||
},
|
||||
highlight: {
|
||||
fontWeight: '700',
|
||||
},
|
||||
});
|
||||
|
||||
type SectionProps = {
|
||||
title: string,
|
||||
children: Node,
|
||||
};
|
||||
|
||||
function Section({children, title}: SectionProps): Node {
|
||||
const isDarkMode = useColorScheme() === 'dark';
|
||||
return (
|
||||
<View style={styles.sectionContainer}>
|
||||
@@ -52,9 +74,9 @@ const Section = ({children, title}): Node => {
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
const App: () => Node = () => {
|
||||
export default function App(): Node {
|
||||
const isDarkMode = useColorScheme() === 'dark';
|
||||
|
||||
const backgroundStyle = {
|
||||
@@ -93,25 +115,4 @@ const App: () => Node = () => {
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
sectionContainer: {
|
||||
marginTop: 32,
|
||||
paddingHorizontal: 24,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 24,
|
||||
fontWeight: '600',
|
||||
},
|
||||
sectionDescription: {
|
||||
marginTop: 8,
|
||||
fontSize: 18,
|
||||
fontWeight: '400',
|
||||
},
|
||||
highlight: {
|
||||
fontWeight: '700',
|
||||
},
|
||||
});
|
||||
|
||||
export default App;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user