From fa21822241ef1347ef0a932654569b1e544fd622 Mon Sep 17 00:00:00 2001 From: Louis Lagrange Date: Thu, 19 Jan 2017 17:04:53 -0800 Subject: [PATCH] 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 https://github.com/facebook/react-native/pull/11938 Differential Revision: D4439220 Pulled By: hramos fbshipit-source-id: e7086fe384ed6238306abf0ee72c944fac53ad7b --- docs/NativeModulesAndroid.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/NativeModulesAndroid.md b/docs/NativeModulesAndroid.md index 3d7135b59c1..fff9814d4c9 100644 --- a/docs/NativeModulesAndroid.md +++ b/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> 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);