Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76c70cf207 | ||
|
|
d727d3c7e6 | ||
|
|
eae5bed476 | ||
|
|
94c175664a | ||
|
|
98c6517801 | ||
|
|
9e832e69c6 | ||
|
|
93b8ef0173 | ||
|
|
604fce0372 | ||
|
|
56a7a57654 | ||
|
|
b009ff628d | ||
|
|
f770415db3 | ||
|
|
88a5fc6ad6 | ||
|
|
049943c7bd | ||
|
|
990f52d702 | ||
|
|
76e0acdb31 | ||
|
|
7947ef1d36 | ||
|
|
de9d3f0804 | ||
|
|
0ab55f4385 | ||
|
|
0b54ba54c6 | ||
|
|
9d2f745914 | ||
|
|
651d111624 | ||
|
|
cbe99e2b0f | ||
|
|
fdcc07aa80 | ||
|
|
2376f89dcc | ||
|
|
5706e87500 | ||
|
|
12ed73a490 | ||
|
|
5635eb9106 |
No files matched your search
+13
-9
@@ -1,13 +1,17 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
cache:
|
||||
directories:
|
||||
- "node_modules"
|
||||
deploy:
|
||||
on:
|
||||
tags: true
|
||||
provider: npm
|
||||
email: "emin@emin.ch"
|
||||
api_key: "${NPM_TOKEN}"
|
||||
skip_cleanup: true
|
||||
- provider: npm
|
||||
on:
|
||||
condition: $TRAVIS_BRANCH == "master" && -n $TRAVIS_TAG
|
||||
email: "emin@emin.ch"
|
||||
api_key: "${NPM_TOKEN}"
|
||||
skip_cleanup: true
|
||||
- provider: npm
|
||||
on:
|
||||
condition: $TRAVIS_BRANCH == "master-cli-v2" && -n $TRAVIS_TAG
|
||||
email: "emin@emin.ch"
|
||||
api_key: "${NPM_TOKEN}"
|
||||
skip_cleanup: true
|
||||
tag: next
|
||||
@@ -1,51 +1,118 @@
|
||||
/**
|
||||
* Sample React Native App
|
||||
* https://github.com/facebook/react-native
|
||||
*
|
||||
*
|
||||
* Generated with the TypeScript template
|
||||
* https://github.com/emin93/react-native-template-typescript
|
||||
*
|
||||
* https://github.com/react-native-community/react-native-template-typescript
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import React, {Component} from 'react';
|
||||
import {Platform, StyleSheet, Text, View} from 'react-native';
|
||||
import React, {Fragment} from 'react';
|
||||
import {
|
||||
SafeAreaView,
|
||||
StyleSheet,
|
||||
ScrollView,
|
||||
View,
|
||||
Text,
|
||||
StatusBar,
|
||||
} 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',
|
||||
});
|
||||
import {
|
||||
Header,
|
||||
LearnMoreLinks,
|
||||
Colors,
|
||||
DebugInstructions,
|
||||
ReloadInstructions,
|
||||
} from 'react-native/Libraries/NewAppScreen';
|
||||
|
||||
interface Props {}
|
||||
export default class App extends Component<Props> {
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.welcome}>Welcome to React Native!</Text>
|
||||
<Text style={styles.instructions}>To get started, edit App.tsx</Text>
|
||||
<Text style={styles.instructions}>{instructions}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
const App = () => {
|
||||
const usingHermes = typeof HermesInternal === 'object' && HermesInternal !== null;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
<StatusBar barStyle="dark-content" />
|
||||
<SafeAreaView>
|
||||
<ScrollView
|
||||
contentInsetAdjustmentBehavior="automatic"
|
||||
style={styles.scrollView}>
|
||||
<Header />
|
||||
{!usingHermes ? null : (
|
||||
<View style={styles.engine}>
|
||||
<Text style={styles.footer}>Engine: Hermes</Text>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.body}>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>Step One</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
|
||||
screen and then come back to see your edits.
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>See Your Changes</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
<ReloadInstructions />
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>Debug</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
<DebugInstructions />
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.sectionContainer}>
|
||||
<Text style={styles.sectionTitle}>Learn More</Text>
|
||||
<Text style={styles.sectionDescription}>
|
||||
Read the docs to discover what to do next:
|
||||
</Text>
|
||||
</View>
|
||||
<LearnMoreLinks />
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
backgroundColor: '#F5FCFF',
|
||||
scrollView: {
|
||||
backgroundColor: Colors.lighter,
|
||||
},
|
||||
welcome: {
|
||||
fontSize: 20,
|
||||
textAlign: 'center',
|
||||
margin: 10,
|
||||
engine: {
|
||||
position: 'absolute',
|
||||
right: 0,
|
||||
},
|
||||
instructions: {
|
||||
textAlign: 'center',
|
||||
color: '#333333',
|
||||
marginBottom: 5,
|
||||
body: {
|
||||
backgroundColor: Colors.white,
|
||||
},
|
||||
});
|
||||
sectionContainer: {
|
||||
marginTop: 32,
|
||||
paddingHorizontal: 24,
|
||||
},
|
||||
sectionTitle: {
|
||||
fontSize: 24,
|
||||
fontWeight: '600',
|
||||
color: Colors.black,
|
||||
},
|
||||
sectionDescription: {
|
||||
marginTop: 8,
|
||||
fontSize: 18,
|
||||
fontWeight: '400',
|
||||
color: Colors.dark,
|
||||
},
|
||||
highlight: {
|
||||
fontWeight: '700',
|
||||
},
|
||||
footer: {
|
||||
color: Colors.dark,
|
||||
fontSize: 12,
|
||||
fontWeight: '600',
|
||||
padding: 4,
|
||||
paddingRight: 12,
|
||||
textAlign: 'right',
|
||||
},
|
||||
});
|
||||
|
||||
export default App;
|
||||
@@ -4,6 +4,8 @@ Contributing to this project should be as easy and transparent as possible.
|
||||
|
||||
## Workflow
|
||||
|
||||
Right now there are two master branches in order to keep support for the old React Native CLI (for more info, check out the [related issue](https://github.com/react-native-community/react-native-template-typescript/issues/39)).
|
||||
|
||||
We use [GitHub Flow](https://guides.github.com/introduction/flow/), so all code changes happen through pull requests.
|
||||
|
||||
1. Fork the repository and create your branch from `master`.
|
||||
|
||||
@@ -1,52 +1,46 @@
|
||||
# :space_invader: React Native Template TypeScript · [](https://travis-ci.org/emin93/react-native-template-typescript)
|
||||
# :space_invader: React Native Template TypeScript
|
||||
|
||||
Clean and minimalist React Native template for a quick start with TypeScript.
|
||||
<p>
|
||||
<a href="https://travis-ci.org/react-native-community/react-native-template-typescript">
|
||||
<img alt="Build Status" src="https://img.shields.io/travis/react-native-community/react-native-template-typescript.svg" target="_blank" />
|
||||
</a>
|
||||
<a href="https://github.com/react-native-community/react-native-template-typescript#readme">
|
||||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" target="_blank" />
|
||||
</a>
|
||||
<a href="https://github.com/react-native-community/react-native-template-typescript/graphs/commit-activity">
|
||||
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" target="_blank" />
|
||||
</a>
|
||||
<a href="https://github.com/react-native-community/react-native-template-typescript/blob/master/LICENSE">
|
||||
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" target="_blank" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
[](https://medium.com/@emin93/react-native-typescript-b965059109d3)
|
||||
> Clean and minimalist React Native template for a quick start with TypeScript.
|
||||
|
||||
## :star: Features
|
||||
|
||||
- Seamlessly integrated into the React Native CLI! :sparkles:
|
||||
- Elegant usage directly within the [React Native CLI](https://github.com/react-native-community/cli)
|
||||
- Consistent with the default React Native template
|
||||
- Always latest dependencies :raised_hands:
|
||||
- Minimal additional dependencies
|
||||
|
||||
## :arrow_forward: Quick Start
|
||||
## :arrow_forward: Usage
|
||||
|
||||
```bash
|
||||
### React Native >= 0.60
|
||||
|
||||
```sh
|
||||
npx react-native init MyApp --template react-native-template-typescript@next
|
||||
```
|
||||
|
||||
### React Native <= 0.59
|
||||
|
||||
```sh
|
||||
react-native init MyApp --template typescript
|
||||
```
|
||||
|
||||
## :question: FAQ
|
||||
|
||||
### What additional dependencies are included in this template?
|
||||
|
||||
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
||||
- [Type definitions for React & React Native](https://github.com/DefinitelyTyped/DefinitelyTyped)
|
||||
|
||||
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.
|
||||
|
||||
Lots of :heart: and credits to the owners and maintainers of those packages.
|
||||
|
||||
### Does debugging work?
|
||||
|
||||
Yes it does. :tada:
|
||||
|
||||
[](https://medium.com/@emin93/react-native-typescript-b965059109d3)
|
||||
|
||||
### How to do type checking?
|
||||
|
||||
`npx tsc`
|
||||
|
||||
## :globe_with_meridians: Links
|
||||
|
||||
- ["Using React Native with TypeScript just became simple" on Medium](https://medium.com/@emin93/react-native-typescript-b965059109d3)
|
||||
- ["24 tips for React Native you probably want to know" on Albert Gao's blog](http://albertgao.xyz/2018/05/30/24-tips-for-react-native-you-probably-want-to-know/#9-For-Typescript)
|
||||
- ["3 Easy Steps to Set Up React Native with TypeScript, Jest and Enzyme" on Medium by Jan Hesters](https://medium.com/@jan.hesters/3-easy-steps-to-set-up-react-native-with-typescript-jest-and-enzyme-592ca042262f)
|
||||
|
||||
## :computer: Contributing
|
||||
|
||||
Contributions are very welcome. Please check out the [contributing document](https://github.com/emin93/react-native-template-typescript/blob/master/CONTRIBUTING.md).
|
||||
Contributions are very welcome. Please check out the [contributing document](CONTRIBUTING.md).
|
||||
|
||||
### Donations
|
||||
## :bookmark: License
|
||||
|
||||
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:
|
||||
This project is [MIT](LICENSE) licensed.
|
||||
@@ -58,3 +58,6 @@ buck-out/
|
||||
|
||||
# Bundle artifact
|
||||
*.jsbundle
|
||||
|
||||
# CocoaPods
|
||||
/ios/Pods/
|
||||
Generated
+527
-363
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -25,6 +25,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/emin93/react-native-template-typescript#readme",
|
||||
"devDependencies": {
|
||||
"standard": "12.0.1"
|
||||
"standard": "13.0.2"
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,17 @@ const projectFilesToDelete = ['.flowconfig', 'App.js', '__tests__/App-test.js']
|
||||
|
||||
const templateFilesToDelete = ['setup.js', 'README.md', 'LICENSE']
|
||||
|
||||
const deleteFile = filePath => {
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return
|
||||
}
|
||||
|
||||
fs.unlinkSync(filePath)
|
||||
}
|
||||
|
||||
const projectPath = path.join(__dirname, '..', '..')
|
||||
const deleteProjectFile = fileName => fs.unlinkSync(path.join(projectPath, fileName))
|
||||
const deleteTemplateFile = fileName => fs.unlinkSync(path.join(__dirname, fileName))
|
||||
const deleteProjectFile = fileName => deleteFile(path.join(projectPath, fileName))
|
||||
const deleteTemplateFile = fileName => deleteFile(path.join(__dirname, fileName))
|
||||
|
||||
projectFilesToDelete.forEach(deleteProjectFile)
|
||||
templateFilesToDelete.forEach(deleteTemplateFile)
|
||||
Reference in new issue
Block a user