Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d66ebbff86 | ||
|
|
df72937d6c | ||
|
|
c6a6f076f9 |
No files matched your search
@@ -41,19 +41,22 @@ See the below table to find out which version of the template to use.
|
|||||||
|
|
||||||
#### React Native <=> Template Version
|
#### React Native <=> Template Version
|
||||||
|
|
||||||
| React Native | Template |
|
| React Native | Template |
|
||||||
|--- |--- |
|
| ------------ | -------- |
|
||||||
| 0.64 | 6.6.* |
|
| 0.64 | 6.6.\* |
|
||||||
| 0.63 | 6.5.* |
|
| 0.63 | 6.5.\* |
|
||||||
| 0.62 | 6.4.* |
|
| 0.62 | 6.4.\* |
|
||||||
| 0.61 | 6.3.* |
|
| 0.61 | 6.3.\* |
|
||||||
| 0.60 | 6.2.* |
|
| 0.60 | 6.2.\* |
|
||||||
|
|
||||||
|
## :warning: React Native CLI
|
||||||
|
|
||||||
|
This template only works with the new CLI. Make sure you have uninstalled the legacy `react-native-cli` first (`npm uninstall -g react-native-cli`), for the below command to work. If you wish to not use `npx`, you can also install the new CLI globally (`npm i -g @react-native-community/cli` or `yarn global add @react-native-community/cli`).
|
||||||
|
|
||||||
|
If you tried the above and still get the *react-native-template-react- native-template-typescript: Not found error*, please try adding the [--ignore-existing](https://github.com/npm/npx#description) flag to the npx call to force npx to ignore any locally installed versions of the CLI.
|
||||||
|
|
||||||
### Note on the legacy CLI
|
|
||||||
There seems to be quite some confusion about the legacy CLI. This template only works with the new CLI. Make sure you have uninstalled the legacy `react-native-cli` first (`npm uninstall -g react-native-cli`), for the below command to work. If you wish to not use `npx`, you can also install the new CLI globally (`npm i -g @react-native-community/cli` or `yarn global add @react-native-community/cli`).
|
|
||||||
|
|
||||||
Further information can be found here: https://github.com/react-native-community/cli#about
|
Further information can be found here: https://github.com/react-native-community/cli#about
|
||||||
|
|
||||||
## :computer: Contributing
|
## :computer: Contributing
|
||||||
|
|
||||||
Contributions are very welcome. Please check out the [contributing document](CONTRIBUTING.md).
|
Contributions are very welcome. Please check out the [contributing document](CONTRIBUTING.md).
|
||||||
|
|||||||
+98
-98
@@ -8,108 +8,108 @@
|
|||||||
* @format
|
* @format
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {
|
import {
|
||||||
SafeAreaView,
|
SafeAreaView,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Text,
|
Text,
|
||||||
useColorScheme,
|
useColorScheme,
|
||||||
View,
|
View,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Colors,
|
Colors,
|
||||||
DebugInstructions,
|
DebugInstructions,
|
||||||
Header,
|
Header,
|
||||||
LearnMoreLinks,
|
LearnMoreLinks,
|
||||||
ReloadInstructions,
|
ReloadInstructions,
|
||||||
} from 'react-native/Libraries/NewAppScreen';
|
} from 'react-native/Libraries/NewAppScreen';
|
||||||
|
|
||||||
const Section: React.FC<{
|
const Section: React.FC<{
|
||||||
title: string;
|
title: string;
|
||||||
}> = ({children, title}) => {
|
}> = ({children, title}) => {
|
||||||
const isDarkMode = useColorScheme() === 'dark';
|
const isDarkMode = useColorScheme() === 'dark';
|
||||||
return (
|
return (
|
||||||
<View style={styles.sectionContainer}>
|
<View style={styles.sectionContainer}>
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
styles.sectionTitle,
|
styles.sectionTitle,
|
||||||
{
|
{
|
||||||
color: isDarkMode ? Colors.white : Colors.black,
|
color: isDarkMode ? Colors.white : Colors.black,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
{title}
|
{title}
|
||||||
</Text>
|
</Text>
|
||||||
<Text
|
<Text
|
||||||
style={[
|
style={[
|
||||||
styles.sectionDescription,
|
styles.sectionDescription,
|
||||||
{
|
{
|
||||||
color: isDarkMode ? Colors.light : Colors.dark,
|
color: isDarkMode ? Colors.light : Colors.dark,
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
{children}
|
{children}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const isDarkMode = useColorScheme() === 'dark';
|
const isDarkMode = useColorScheme() === 'dark';
|
||||||
|
|
||||||
const backgroundStyle = {
|
const backgroundStyle = {
|
||||||
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
|
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={backgroundStyle}>
|
<SafeAreaView style={backgroundStyle}>
|
||||||
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
<StatusBar barStyle={isDarkMode ? 'light-content' : 'dark-content'} />
|
||||||
<ScrollView
|
<ScrollView
|
||||||
contentInsetAdjustmentBehavior="automatic"
|
contentInsetAdjustmentBehavior="automatic"
|
||||||
style={backgroundStyle}>
|
style={backgroundStyle}>
|
||||||
<Header />
|
<Header />
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
||||||
}}>
|
}}>
|
||||||
<Section title="Step One">
|
<Section title="Step One">
|
||||||
Edit <Text style={styles.highlight}>App.js</Text> to change this
|
Edit <Text style={styles.highlight}>App.js</Text> to change this
|
||||||
screen and then come back to see your edits.
|
screen and then come back to see your edits.
|
||||||
</Section>
|
</Section>
|
||||||
<Section title="See Your Changes">
|
<Section title="See Your Changes">
|
||||||
<ReloadInstructions />
|
<ReloadInstructions />
|
||||||
</Section>
|
</Section>
|
||||||
<Section title="Debug">
|
<Section title="Debug">
|
||||||
<DebugInstructions />
|
<DebugInstructions />
|
||||||
</Section>
|
</Section>
|
||||||
<Section title="Learn More">
|
<Section title="Learn More">
|
||||||
Read the docs to discover what to do next:
|
Read the docs to discover what to do next:
|
||||||
</Section>
|
</Section>
|
||||||
<LearnMoreLinks />
|
<LearnMoreLinks />
|
||||||
</View>
|
</View>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
sectionContainer: {
|
sectionContainer: {
|
||||||
marginTop: 32,
|
marginTop: 32,
|
||||||
paddingHorizontal: 24,
|
paddingHorizontal: 24,
|
||||||
},
|
},
|
||||||
sectionTitle: {
|
sectionTitle: {
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
},
|
},
|
||||||
sectionDescription: {
|
sectionDescription: {
|
||||||
marginTop: 8,
|
marginTop: 8,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: '400',
|
fontWeight: '400',
|
||||||
},
|
},
|
||||||
highlight: {
|
highlight: {
|
||||||
fontWeight: '700',
|
fontWeight: '700',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
@@ -45,7 +45,8 @@
|
|||||||
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
"skipLibCheck": false /* Skip type checking of declaration files. */
|
"skipLibCheck": false, /* Skip type checking of declaration files. */
|
||||||
|
"resolveJsonModule": true /* Allows importing modules with a ‘.json’ extension, which is a common practice in node projects. */
|
||||||
|
|
||||||
/* Source Map Options */
|
/* Source Map Options */
|
||||||
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
|||||||
Reference in new issue
Block a user