Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eba8db895 | ||
|
|
bc93c59868 |
No files matched your search
@@ -18,11 +18,20 @@ node setup.js
|
|||||||
|
|
||||||
### Why the post install script?
|
### Why the post install script?
|
||||||
|
|
||||||
The React Native CLI currently supports automatic installation only of production dependencies. Since TypeScript type definitions are dev dependencies, the post install script is being used to install those.
|
The React Native CLI supports automatic installation of production dependencies only. Since TypeScript type definitions are dev dependencies, the post install script is being used mainly to install those.
|
||||||
|
|
||||||
|
### What is included in this template?
|
||||||
|
|
||||||
|
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
||||||
|
- [TypeScript type definitions for React & React Native](https://github.com/DefinitelyTyped/DefinitelyTyped)
|
||||||
|
- [TSLint](https://github.com/palantir/tslint)
|
||||||
|
- [TSLint React](https://github.com/palantir/tslint-react)
|
||||||
|
|
||||||
|
This template always uses the latest versions of the dependencies at the time when the `react-native init` command is being executed. This means you don't have to worry about old versions.
|
||||||
|
|
||||||
### What about Jest?
|
### What about Jest?
|
||||||
|
|
||||||
Currently this template does not cover Jest. For more info on the current status check the [open issue](https://github.com/emin93/react-native-template-typescript/issues/1).
|
This template does not cover Jest yet. For more info on the current status check the [open issue](https://github.com/emin93/react-native-template-typescript/issues/1).
|
||||||
|
|
||||||
### How will this template affect the React Native CLI workflow?
|
### How will this template affect the React Native CLI workflow?
|
||||||
|
|
||||||
@@ -31,4 +40,8 @@ this template. This means you don't have to worry about incompatibility issues w
|
|||||||
|
|
||||||
## :hearts: Contributing
|
## :hearts: Contributing
|
||||||
|
|
||||||
Contributions are of course very welcome. Please try to stay consistent with the other files I've created.
|
Contributions are very welcome. Please try to stay consistent with the other files I've created.
|
||||||
|
|
||||||
|
### Donations
|
||||||
|
|
||||||
|
I created this project in my spare time because I enjoy coding. Of course you can support me by [buying me a coffee](https://www.paypal.me/emin93) if you wish. :coffee: :relieved:
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
[
|
[
|
||||||
|
"typescript",
|
||||||
|
"tslint",
|
||||||
|
"tslint-react",
|
||||||
"@types/react",
|
"@types/react",
|
||||||
"@types/react-native",
|
"@types/react-native",
|
||||||
"typescript",
|
|
||||||
"npm-run-all"
|
"npm-run-all"
|
||||||
]
|
]
|
||||||
@@ -11,6 +11,7 @@ const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(),
|
|||||||
packageJson.scripts.rn = packageJson.scripts.start;
|
packageJson.scripts.rn = packageJson.scripts.start;
|
||||||
packageJson.scripts.ts = 'node_modules/.bin/tsc -w';
|
packageJson.scripts.ts = 'node_modules/.bin/tsc -w';
|
||||||
packageJson.scripts.start = 'npm-run-all -p -r rn ts';
|
packageJson.scripts.start = 'npm-run-all -p -r rn ts';
|
||||||
|
packageJson.scripts.lint = 'tslint -c tslint.json "src/**/*.{ts,tsx}"';
|
||||||
writeFile('package.json', JSON.stringify(packageJson, null, 2));
|
writeFile('package.json', JSON.stringify(packageJson, null, 2));
|
||||||
|
|
||||||
execSync(`npm i ${devDependencies.join(' ')} --save-dev --save-exact`);
|
execSync(`npm i ${devDependencies.join(' ')} --save-dev --save-exact`);
|
||||||
|
|||||||
+24
-19
@@ -1,18 +1,23 @@
|
|||||||
import * as React from 'react';
|
import * as React from "react";
|
||||||
import { Platform, StyleSheet, Text, View } from 'react-native';
|
import { Platform, StyleSheet, Text, View } from "react-native";
|
||||||
|
|
||||||
const instructions = Platform.select({
|
const instructions = Platform.select({
|
||||||
ios: 'Press Cmd+R to reload,\n' +
|
android: "Double tap R on your keyboard to reload,\n" +
|
||||||
'Cmd+D or shake for dev menu',
|
"Shake or press menu button for dev menu",
|
||||||
android: 'Double tap R on your keyboard to reload,\n' +
|
ios: "Press Cmd+R to reload,\n" +
|
||||||
'Shake or press menu button for dev menu',
|
"Cmd+D or shake for dev menu",
|
||||||
});
|
});
|
||||||
|
|
||||||
interface Props { }
|
interface IProps {
|
||||||
interface State { }
|
exampleProp: string;
|
||||||
|
}
|
||||||
|
|
||||||
export default class App extends React.Component<Props, State> {
|
interface IState {
|
||||||
render() {
|
exampleState: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class App extends React.Component<IProps, IState> {
|
||||||
|
public render() {
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Text style={styles.welcome}>
|
<Text style={styles.welcome}>
|
||||||
@@ -31,19 +36,19 @@ export default class App extends React.Component<Props, State> {
|
|||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
alignItems: "center",
|
||||||
|
backgroundColor: "#F5FCFF",
|
||||||
flex: 1,
|
flex: 1,
|
||||||
justifyContent: 'center',
|
justifyContent: "center",
|
||||||
alignItems: 'center',
|
},
|
||||||
backgroundColor: '#F5FCFF',
|
instructions: {
|
||||||
|
color: "#333333",
|
||||||
|
marginBottom: 5,
|
||||||
|
textAlign: "center",
|
||||||
},
|
},
|
||||||
welcome: {
|
welcome: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
textAlign: 'center',
|
|
||||||
margin: 10,
|
margin: 10,
|
||||||
},
|
textAlign: "center",
|
||||||
instructions: {
|
|
||||||
textAlign: 'center',
|
|
||||||
color: '#333333',
|
|
||||||
marginBottom: 5,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"defaultSeverity": "error",
|
||||||
|
"extends": [
|
||||||
|
"tslint:recommended",
|
||||||
|
"tslint-react"
|
||||||
|
],
|
||||||
|
"jsRules": {},
|
||||||
|
"rules": {},
|
||||||
|
"rulesDirectory": []
|
||||||
|
}
|
||||||
Reference in new issue
Block a user