Commit 85e2bd12 authored by Travis Nuttall's avatar Travis Nuttall

update simple example

parent 10491242
......@@ -16,11 +16,15 @@
; Ignore polyfills
.*/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/
[options]
emoji=true
......@@ -31,18 +35,20 @@ munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-3]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version]
^0.53.0
^0.67.0
......@@ -51,3 +51,6 @@ buck-out/
*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots
# Bundle artifact
*.jsbundle
......@@ -7,7 +7,7 @@ import {
} from 'react-native';
import { Thread } from 'react-native-threads';
export default class App extends Component<{}> {
export default class App extends Component {
state = { messages: [] }
workerThread = null;
......
......@@ -34,3 +34,20 @@ npm run build-thread-ios
npm run build-thread-android
```
For running android in release mode, you will need to generate a signing key.
Follow these instructions to generate a key: https://facebook.github.io/react-native/docs/signed-apk-android.html#generating-a-signing-key
When you edit your `~/.gradle/gradle.properties` to put in the name of your
release keystore file, alias, and passwords, use the following format, with the
names of your keystore, alias, and actual passwords instead:
```
SIMPLE_EXAMPLE_RELEASE_STORE_FILE=your-release-key.keystore
SIMPLE_EXAMPLE_RELEASE_KEY_ALIAS=your-key-alias
SIMPLE_EXAMPLE_RELEASE_STORE_PASSWORD=*****
SIMPLE_EXAMPLE_RELEASE_KEY_PASSWORD=*****
```
This android project will be looking for the `SIMPLE_EXAMPLE_` prefixed variables
specifically.
import 'react-native';
import React from 'react';
import App from '../App';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
it('renders correctly', () => {
const tree = renderer.create(
<App />
);
});
......@@ -107,6 +107,16 @@ android {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('SIMPLE_EXAMPLE_RELEASE_STORE_FILE')) {
storeFile file(SIMPLE_EXAMPLE_RELEASE_STORE_FILE)
storePassword SIMPLE_EXAMPLE_RELEASE_STORE_PASSWORD
keyAlias SIMPLE_EXAMPLE_RELEASE_KEY_ALIAS
keyPassword SIMPLE_EXAMPLE_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
......@@ -119,6 +129,7 @@ android {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.simpleexample"
android:versionCode="1"
android:versionName="1.0">
package="com.simpleexample">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
......
......@@ -10,3 +10,4 @@ if (__DEV__) {
console.tron = Reactotron;
}
......@@ -54,7 +54,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
......@@ -84,7 +83,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
......
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
......
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "AppDelegate.h"
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
......
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
......
fKWwYO"+62,
\ No newline at end of file
This diff is collapsed.
......@@ -6,19 +6,19 @@
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"build-thread-ios": "node node_modules/react-native/local-cli/cli.js bundle --dev false --assets-dest ./ios --entry-file worker.thread.js --platform ios --bundle-output ./ios/worker.thread.jsbundle",
"build-thread-android": "node node_modules/react-native/local-cli/cli.js bundle --dev false --assets-dest ./android/app/src/main/res/ --entry-file worker.thread.js --platform android --bundle-output ./android/app/src/main/ assets/threads/worker.thread.bundle"
"build-thread-android": "node node_modules/react-native/local-cli/cli.js bundle --dev false --assets-dest ./android/app/src/main/res/ --entry-file worker.thread.js --platform android --bundle-output ./android/app/src/main/assets/threads/worker.thread.bundle"
},
"dependencies": {
"react": "16.0.0-beta.5",
"react-native": "0.49.5",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-threads": "file:../../"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-jest": "23.0.1",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0-beta.5",
"reactotron-react-native": "1.12.3"
"jest": "23.1.0",
"react-test-renderer": "16.3.1",
"reactotron-react-native": "1.14.0"
},
"jest": {
"preset": "react-native"
......
......@@ -11,3 +11,4 @@ self.onmessage = message => {
self.postMessage(`Message #${count} from worker thread!`);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment