|
6 | 6 | |---|---| |
7 | 7 | | [](https://dev.azure.com/petter0012/react-native-android-activity/_build/latest?definitionId=1&branchName=master) | [[?branchName=master)](https://dev.azure.com/petter0012/react-native-android-activity/_build/latest?definitionId=2&branchName=master) | |
8 | 8 |
|
9 | | -This sample, which grew out of a [question on Stack Overflow](https://stackoverflow.com/questions/42253397/call-android-activity-from-react-native-code/43675819), demonstrates the interface between React Native JavaScript and Java code in Android host applications/Objective-C in iOS applications. |
| 9 | +This sample, which grew out of a [question on Stack Overflow](https://stackoverflow.com/questions/42253397/call-android-activity-from-react-native-code/43675819), demonstrates the interface between React Native JavaScript and native code – Java on Android, Objective-C on iOS. |
10 | 10 |
|
11 | | -The original version was Android-only; support for iOS was added March 28 2019. |
| 11 | +The original version was Android-only; support for iOS was added in March 2019. |
12 | 12 |
|
13 | 13 | This project demonstrates the following: |
14 | 14 |
|
15 | | -* Call from JavaScript into native modules: |
16 | | - * These use a custom native module called `ActivityStarter`: |
| 15 | +* Calling from JavaScript into native modules: |
| 16 | + * ...using a custom native module called `ActivityStarter`: |
17 | 17 | * Navigate from React Native to a Java activity (or iOS view controller) internal to the host app; |
18 | 18 | * Start an external intent to dial a phone number, passing data from JavaScript; |
19 | 19 | * Query the host app for information. |
20 | | - * This uses the native module `Clipboard`, which [comes with React Native out of the box](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java): |
| 20 | + * ...using the native module `Clipboard`, which [comes with React Native out of the box](https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java): |
21 | 21 | * Copy information to the clipboard. |
22 | | -* Call a JavaScript method from Java or Objective-C, using an officially undocumented approach. |
23 | | -* Demonstrate sending events from the native platform to JavaScript. (When possible, prefer this approach to the undocumented one.) |
24 | | -* Verify that custom edit menu extensions work with React Native `TextInput`. (Android only.) |
25 | | -* Add a custom menu option to React Native debug menu. |
| 22 | +* Calling a JavaScript method from Java or Objective-C, using an officially undocumented approach. |
| 23 | +* Sending events from the native platform to JavaScript. (When possible, prefer this approach to the undocumented one.) |
| 24 | +* Verifying that custom edit menu extensions work with React Native `TextInput`. (Android only.) |
| 25 | +* Adding a custom menu option to React Native debug menu. |
26 | 26 |
|
27 | | -There is no technical difference between the `ActivityStarter` and `Clipboard` native modules, except one is defined here, while the other ships as part of React Native. |
| 27 | +There is no technical difference between the `ActivityStarter` and `Clipboard` native modules, except one is defined in this project while the other ships as part of React Native. |
28 | 28 |
|
29 | 29 | The starting point for this sample is a slightly tweaked standard React Native project as generated by a long-outdated version of `react-native init`. We add six buttons to the generated page: |
30 | 30 |
|
@@ -53,7 +53,8 @@ The `TextInput` box appears only in the Android version. Since both platforms us |
53 | 53 |
|
54 | 54 | ### Android |
55 | 55 |
|
56 | | -* Connect an Android device via USB, or use an emulator. [Don't forget to enable USB Debugging in Developer options](https://developer.android.com/studio/run/device). |
| 56 | +* Connect an Android device via USB, or use an emulator. |
| 57 | +* [Enable USB Debugging in Developer options](https://developer.android.com/studio/run/device). |
57 | 58 | * Open the app in Android Studio and run it. |
58 | 59 | * If this fails with the message "Could not get BatchedBridge, make sure your bundle is packaged correctly", your packager is likely not running. |
59 | 60 | * If it complains about connecting to the dev server, run `adb reverse tcp:8081 tcp:8081` |
|
0 commit comments