README.md 1.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
# React Native Threads Simple Example

A simple example of using react-native-threads.

A single button sends a message to the worker thread, and the thread responds
with a message count that is displayed in the UI.

This example also shows how to use Reactotron for debugging.

## Running the example
I assume that you have Node.js, react-native-cli, and the necessary iOS/Android
dependencies installed.

To see debugging messages, [install Reactotron](https://github.com/infinitered/reactotron/blob/master/docs/installing.md)
and open it before running the app.

```shell
git clone https://github.com/Traviskn/react-native-threads.git

cd react-native-threads/examples/SimpleExample

npm install

react-native run-ios
# or
react-native run-android
```

To run in release mode first build the release thread bundles with the example's
npm scripts:

```shell
npm run build-thread-ios

npm run build-thread-android
```
Travis Nuttall's avatar
Travis Nuttall committed
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

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.