Skip to content

Commit 6a76c3f

Browse files
committed
feat: handle example app
1 parent 6ae9205 commit 6a76c3f

File tree

1 file changed

+20
-2
lines changed
  • packages/create-react-native-library/templates/common-example/example/src

1 file changed

+20
-2
lines changed

packages/create-react-native-library/templates/common-example/example/src/App.tsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
import * as React from 'react';
22

3-
<% if (project.view) { -%>
3+
<% if (project.view && project.module) { -%>
4+
import { StyleSheet, View, Text } from 'react-native';
5+
import { <%- project.name -%>View, multiply } from '<%- project.slug -%>';
6+
<% } else if (project.view) { -%>
47
import { StyleSheet, View } from 'react-native';
58
import { <%- project.name -%>View } from '<%- project.slug -%>';
69
<% } else { -%>
710
import { StyleSheet, View, Text } from 'react-native';
811
import { multiply } from '<%- project.slug -%>';
912
<% } -%>
1013

11-
<% if (project.view) { -%>
14+
<% if (project.view && project.module) { -%>
15+
export default function App() {
16+
const [result, setResult] = React.useState<number | undefined>();
17+
18+
React.useEffect(() => {
19+
multiply(3, 7).then(setResult);
20+
}, []);
21+
22+
return (
23+
<View style={styles.container}>
24+
<Text>Result: {result}</Text>
25+
<<%- project.name -%>View color="#32a852" style={styles.box} />
26+
</View>
27+
);
28+
}
29+
<% } else if (project.view) { -%>
1230
export default function App() {
1331
return (
1432
<View style={styles.container}>

0 commit comments

Comments
 (0)