diff --git a/index.android.js b/index.android.js
index 1e88caa..a25af12 100644
--- a/index.android.js
+++ b/index.android.js
@@ -1,53 +1,14 @@
-/**
- * Sample React Native App
- * https://github.com/facebook/react-native
- * @flow
- */
+import React from 'react';
+import { AppRegistry } from 'react-native';
-import React, { Component } from 'react';
-import {
- AppRegistry,
- StyleSheet,
- Text,
- View
-} from 'react-native';
+import App from './dist/index';
-class zxcvbn extends Component {
+class MainApp extends React.Component {
render() {
return (
-
-
- Welcome to React Native!
-
-
- To get started, edit index.android.js
-
-
- Double tap R on your keyboard to reload,{'\n'}
- Shake or press menu button for dev menu
-
-
+
);
}
}
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- justifyContent: 'center',
- alignItems: 'center',
- backgroundColor: '#F5FCFF',
- },
- welcome: {
- fontSize: 20,
- textAlign: 'center',
- margin: 10,
- },
- instructions: {
- textAlign: 'center',
- color: '#333333',
- marginBottom: 5,
- },
-});
-
-AppRegistry.registerComponent('zxcvbn', () => zxcvbn);
+AppRegistry.registerComponent('zxcvbn', () => MainApp);
diff --git a/index.ios.js b/index.ios.js
index 3894b46..a25af12 100644
--- a/index.ios.js
+++ b/index.ios.js
@@ -1,53 +1,14 @@
-/**
- * Sample React Native App
- * https://github.com/facebook/react-native
- * @flow
- */
+import React from 'react';
+import { AppRegistry } from 'react-native';
-import React, { Component } from 'react';
-import {
- AppRegistry,
- StyleSheet,
- Text,
- View
-} from 'react-native';
+import App from './dist/index';
-class zxcvbn extends Component {
+class MainApp extends React.Component {
render() {
return (
-
-
- Welcome to React Native!
-
-
- To get started, edit index.ios.js
-
-
- Press Cmd+R to reload,{'\n'}
- Cmd+D or shake for dev menu
-
-
+
);
}
}
-const styles = StyleSheet.create({
- container: {
- flex: 1,
- justifyContent: 'center',
- alignItems: 'center',
- backgroundColor: '#F5FCFF',
- },
- welcome: {
- fontSize: 20,
- textAlign: 'center',
- margin: 10,
- },
- instructions: {
- textAlign: 'center',
- color: '#333333',
- marginBottom: 5,
- },
-});
-
-AppRegistry.registerComponent('zxcvbn', () => zxcvbn);
+AppRegistry.registerComponent('zxcvbn', () => MainApp);
diff --git a/package.json b/package.json
index 3e50328..c82a778 100644
--- a/package.json
+++ b/package.json
@@ -4,15 +4,18 @@
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
- "build": "tsc"
+ "build": "rm -rf build && tsc"
},
"dependencies": {
"immutable": "=3.8.1",
"react": "=15.3.1",
"react-native": "=0.33.0",
"react-native-progress-bar": "=0.1.2",
- "typescript": "^1.8.10",
+ "typescript": "=1.8.10",
"underscore": "=1.8.3",
"zxcvbn": "=4.3.0"
+ },
+ "devDependencies": {
+ "tslint": "^3.15.1"
}
}
diff --git a/src/index.tsx b/src/index.tsx
new file mode 100644
index 0000000..28f0368
--- /dev/null
+++ b/src/index.tsx
@@ -0,0 +1,43 @@
+// src/index.ts
+
+import React, { Component } from 'react';
+import {
+ StyleSheet,
+ Text,
+ View
+} from 'react-native';
+
+interface Props {
+
+}
+
+interface State {
+
+}
+
+export default class App extends Component {
+ render() {
+ return (
+
+
+ Welcome to React Native!
+
+
+ );
+ }
+}
+
+const styles = StyleSheet.create({
+ container: {
+ flex: 1,
+ justifyContent: 'center',
+ alignItems: 'center',
+ backgroundColor: '#F5FCFF',
+ } as React.ViewStyle,
+
+ text: {
+ fontSize: 20,
+ textAlign: 'center',
+ margin: 10,
+ } as React.TextStyle,
+});
diff --git a/tsconfig.json b/tsconfig.json
index 6003345..cbb9be5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,19 +1,27 @@
{
- "compilerOptions": {
- "target": "es6",
- "allowJs": true,
- "jsx": "react",
- "outDir": "dist",
- "rootDir": "src",
- "sourceMap": true,
- "noImplicitAny": false
- },
- "filesGlob": [
- "typings/**/*.d.ts",
- "src/**/*.ts",
- "src/**/*.tsx"
- ],
- "exclude": [
- "node_modules"
- ]
+ "compilerOptions": {
+ "target": "es2015",
+ "module": "es2015",
+ "jsx": "react",
+ "outDir": "dist",
+ "rootDir": "src",
+ "allowSyntheticDefaultImports": true,
+ "noImplicitAny": true,
+ "experimentalDecorators": true,
+ "preserveConstEnums": true,
+ "allowJs": true,
+ "sourceMap": true
+ },
+ "filesGlob": [
+ "typings/index.d.ts",
+ "src/**/*.ts",
+ "src/**/*.tsx"
+ ],
+ "exclude": [
+ "index.android.js",
+ "index.ios.js",
+ "dist",
+ "node_modules"
+ ],
+ "compileOnSave": false
}
diff --git a/typings.json b/typings.json
index 5c20511..2c63e04 100644
--- a/typings.json
+++ b/typings.json
@@ -4,6 +4,7 @@
"immutable": "registry:npm/immutable#3.7.6+20160411060006"
},
"globalDependencies": {
+ "react": "registry:dt/react#0.14.0+20160829191040",
"react-native": "registry:dt/react-native#0.29.0+20160830141535"
}
}