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

update simple example

parent 10491242
...@@ -16,11 +16,15 @@ ...@@ -16,11 +16,15 @@
; Ignore polyfills ; Ignore polyfills
.*/Libraries/polyfills/.* .*/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
[include] [include]
[libs] [libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/ node_modules/react-native/flow/
node_modules/react-native/flow-github/
[options] [options]
emoji=true emoji=true
...@@ -31,18 +35,20 @@ munge_underscores=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.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=$FlowIssue
suppress_type=$FlowFixMe suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState 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\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(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\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
unsafe.enable_getters_and_setters=true
[version] [version]
^0.53.0 ^0.67.0
...@@ -51,3 +51,6 @@ buck-out/ ...@@ -51,3 +51,6 @@ buck-out/
*/fastlane/report.xml */fastlane/report.xml
*/fastlane/Preview.html */fastlane/Preview.html
*/fastlane/screenshots */fastlane/screenshots
# Bundle artifact
*.jsbundle
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
} from 'react-native'; } from 'react-native';
import { Thread } from 'react-native-threads'; import { Thread } from 'react-native-threads';
export default class App extends Component<{}> { export default class App extends Component {
state = { messages: [] } state = { messages: [] }
workerThread = null; workerThread = null;
......
...@@ -34,3 +34,20 @@ npm run build-thread-ios ...@@ -34,3 +34,20 @@ npm run build-thread-ios
npm run build-thread-android 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 { ...@@ -107,6 +107,16 @@ android {
abiFilters "armeabi-v7a", "x86" 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 { splits {
abi { abi {
reset() reset()
...@@ -119,6 +129,7 @@ android { ...@@ -119,6 +129,7 @@ android {
release { release {
minifyEnabled enableProguardInReleaseBuilds minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
} }
} }
// applicationVariants are e.g. debug, release // applicationVariants are e.g. debug, release
......
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.simpleexample" package="com.simpleexample">
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<application <application
android:name=".MainApplication" android:name=".MainApplication"
android:allowBackup="true"
android:label="@string/app_name" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
......
...@@ -10,3 +10,4 @@ if (__DEV__) { ...@@ -10,3 +10,4 @@ if (__DEV__) {
console.tron = Reactotron; console.tron = Reactotron;
} }
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
<TestableReference <TestableReference
...@@ -84,7 +83,6 @@ ...@@ -84,7 +83,6 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
......
/** /**
* Copyright (c) 2015-present, Facebook, Inc. * Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
* *
* This source code is licensed under the BSD-style license found in the * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. An additional grant * LICENSE file in the root directory of this source tree.
* of patent rights can be found in the PATENTS file in the same directory.
*/ */
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
/** /**
* Copyright (c) 2015-present, Facebook, Inc. * Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
* *
* This source code is licensed under the BSD-style license found in the * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. An additional grant * LICENSE file in the root directory of this source tree.
* of patent rights can be found in the PATENTS file in the same directory.
*/ */
#import "AppDelegate.h" #import "AppDelegate.h"
......
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
/** /**
* Copyright (c) 2015-present, Facebook, Inc. * Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
* *
* This source code is licensed under the BSD-style license found in the * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. An additional grant * LICENSE file in the root directory of this source tree.
* of patent rights can be found in the PATENTS file in the same directory.
*/ */
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
/** /**
* Copyright (c) 2015-present, Facebook, Inc. * Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
* *
* This source code is licensed under the BSD-style license found in the * This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree. An additional grant * LICENSE file in the root directory of this source tree.
* of patent rights can be found in the PATENTS file in the same directory.
*/ */
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
......
fKWwYO"+62,
\ No newline at end of file
This diff is collapsed.
...@@ -6,19 +6,19 @@ ...@@ -6,19 +6,19 @@
"start": "node node_modules/react-native/local-cli/cli.js start", "start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest", "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-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": { "dependencies": {
"react": "16.0.0-beta.5", "react": "16.3.1",
"react-native": "0.49.5", "react-native": "0.55.4",
"react-native-threads": "file:../../" "react-native-threads": "file:../../"
}, },
"devDependencies": { "devDependencies": {
"babel-jest": "21.2.0", "babel-jest": "23.0.1",
"babel-preset-react-native": "4.0.0", "babel-preset-react-native": "4.0.0",
"jest": "21.2.1", "jest": "23.1.0",
"react-test-renderer": "16.0.0-beta.5", "react-test-renderer": "16.3.1",
"reactotron-react-native": "1.12.3" "reactotron-react-native": "1.14.0"
}, },
"jest": { "jest": {
"preset": "react-native" "preset": "react-native"
......
...@@ -11,3 +11,4 @@ self.onmessage = message => { ...@@ -11,3 +11,4 @@ self.onmessage = message => {
self.postMessage(`Message #${count} from worker thread!`); 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