Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/create-react-native-library/src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ export function generateTemplateConfiguration({
const { slug, languages, type } = answers;

const arch =
type === 'legacy-module' || type === 'legacy-view' ? 'legacy' : 'new';
type === 'legacy-module' || type === 'legacy-view' || type === 'library'
? 'legacy'
: 'new';

const project = slug.replace(/^(react-native-|@[^/]+\/)/, '');
let namespace: string | undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState, useEffect } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { multiply } from '<%- project.slug -%>';
import { Text, View, StyleSheet } from 'react-native';
<% if (project.native) { -%>
import { useState, useEffect } from 'react';

export default function App() {
const [result, setResult] = useState<number | undefined>();
Expand All @@ -9,6 +10,12 @@ export default function App() {
multiply(3, 7).then(setResult);
}, []);

<% } else { -%>

const result = multiply(3, 7);

export default function App() {
<% } -%>
return (
<View style={styles.container}>
<Text>Result: {result}</Text>
Expand Down
Loading