Skip to content

Commit

Permalink
Improve sample app
Browse files Browse the repository at this point in the history
Summary: Improve RN sample application code quality.

Reviewed By: mroch

Differential Revision: D39488055

fbshipit-source-id: f6056c0790d6fee473a57b9d29a0ce21841f63c1
  • Loading branch information
pieterv authored and facebook-github-bot committed Sep 15, 2022
1 parent 399907f commit 03cb5ac
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions template/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand All @@ -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 = {
Expand Down Expand Up @@ -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;
}

0 comments on commit 03cb5ac

Please sign in to comment.