Skip to content
Permalink
Browse files

Fix some typos in NativeModulesAndroid.md

Summary:
Hi, here are some typo fixes in the documentation related to Android native modules:
* Add missing package and imports for the second part of the basic tutorial (register module)
* Add missing `public` keyword
* Remove incongruous word
Closes #11938

Differential Revision: D4439220

Pulled By: hramos

fbshipit-source-id: e7086fe384ed6238306abf0ee72c944fac53ad7b
  • Loading branch information...
Minishlink authored and facebook-github-bot committed Jan 20, 2017
1 parent 10a29aa commit fa21822241ef1347ef0a932654569b1e544fd622
Showing with 14 additions and 2 deletions.
  1. +14 −2 docs/NativeModulesAndroid.md
@@ -98,7 +98,19 @@ Read more about [ReadableMap](https://github.com/facebook/react-native/blob/mast
The last step within Java is to register the Module; this happens in the `createNativeModules` of your apps package. If a module is not registered it will not be available from JavaScript.

```java
class AnExampleReactPackage implements ReactPackage {
package com.facebook.react.modules.toast;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class AnExampleReactPackage implements ReactPackage {
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
@@ -326,7 +338,7 @@ componentWillMount: function() {

### Getting activity result from `startActivityForResult`

You'll need to listen to `onActivityResult` if you want to get results from an activity you started with `startActivityForResult`. To do this, the you must extend `BaseActivityEventListener` or implement `ActivityEventListener`. The former is preferred as it is more resilient to API changes. Then, you need to register the listener in the module's constructor,
You'll need to listen to `onActivityResult` if you want to get results from an activity you started with `startActivityForResult`. To do this, you must extend `BaseActivityEventListener` or implement `ActivityEventListener`. The former is preferred as it is more resilient to API changes. Then, you need to register the listener in the module's constructor,

```java
reactContext.addActivityEventListener(mActivityResultListener);

0 comments on commit fa21822

Please sign in to comment.
You can’t perform that action at this time.