Compare commits

...
2 Commits
5 changed files with 54 additions and 23 deletions

No files matched your search

+16 -3
View File
@@ -18,11 +18,20 @@ node setup.js
### 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?
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?
@@ -31,4 +40,8 @@ this template. This means you don't have to worry about incompatibility issues w
## :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:
+3 -1
View File
@@ -1,6 +1,8 @@
[
"typescript",
"tslint",
"tslint-react",
"@types/react",
"@types/react-native",
"typescript",
"npm-run-all"
]
+1
View File
@@ -11,6 +11,7 @@ const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(),
packageJson.scripts.rn = packageJson.scripts.start;
packageJson.scripts.ts = 'node_modules/.bin/tsc -w';
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));
execSync(`npm i ${devDependencies.join(' ')} --save-dev --save-exact`);
+24 -19
View File
@@ -1,18 +1,23 @@
import * as React from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import * as React from "react";
import { Platform, StyleSheet, Text, View } from "react-native";
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
android: "Double tap R on your keyboard to reload,\n" +
"Shake or press menu button for dev menu",
ios: "Press Cmd+R to reload,\n" +
"Cmd+D or shake for dev menu",
});
interface Props { }
interface State { }
interface IProps {
exampleProp: string;
}
export default class App extends React.Component<Props, State> {
render() {
interface IState {
exampleState: string;
}
export default class App extends React.Component<IProps, IState> {
public render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
@@ -31,19 +36,19 @@ export default class App extends React.Component<Props, State> {
const styles = StyleSheet.create({
container: {
alignItems: "center",
backgroundColor: "#F5FCFF",
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
justifyContent: "center",
},
instructions: {
color: "#333333",
marginBottom: 5,
textAlign: "center",
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
textAlign: "center",
},
});
+10
View File
@@ -0,0 +1,10 @@
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended",
"tslint-react"
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}