Skip to content

Commit 2bf6465

Browse files
authored
[RN][Doc]Fix Event guide (facebook#4570)
1 parent 7aa3d4f commit 2bf6465

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

docs/the-new-architecture/native-modules-custom-events.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Both are good use cases for emitting events from a Native Modules. In this guide
1010

1111
In this example, you will learn how to emit an event when a new key is added to the storage. Changing the value of the key will not emit the event, but adding a new key will.
1212

13-
This guide starts from the iOS implementation of the [Native Module](/docs/next/turbo-native-modules-introduction) guide.
13+
This guide starts from the [Native Module](/docs/next/turbo-native-modules-introduction) guide.
1414
Make sure to be familiar with that guide before diving into this one, potentially implementing the example in the guide.
1515

1616
## Step 1: Update the Specs of NativeLocalStorage
@@ -321,14 +321,6 @@ First, you need to import a couple of types that you need to use to create the e
321321
322322
Secondly, you need to implement the logic that actually emits the event to JS. In case of complex types, like the `KeyValuePair` defined in the specs, Codegen will generate a function that expects a `ReadableMap` as a parameter. You can create the `ReadableMap` by using the `Arguments.createMap()` factory method, and use the `apply` function to populate the map. It's your responsibility to make sure that the the keys you are using in the map are the same properties that are defined in the spec type in JS.
323323
324-
## Step 5: Run Your App
325-
326-
If you now try to run your app, you should see this behavior.
327-
328-
<center>
329-
<img src="/docs/assets/turbo-native-modules-events-android.gif" width="30%" height="30%"/>
330-
</center>
331-
332324
</TabItem>
333325
<TabItem value="ios" label="iOS">
334326
@@ -374,13 +366,13 @@ The `NativeLocalStorageSpecBase` is a base class that provides the `emitOnKeyAdd
374366
375367
In case of complex types, like the `KeyValuePair` defined in the specs, Codegen will generate a generic dictionary that you can populate on the native side. It's your responsibility to make sure that the the keys you are using in the dictionary are the same properties that are defined in the spec type in JS.
376368
369+
</TabItem>
370+
</Tabs>
371+
377372
## Step 5: Run Your App
378373
379374
If you now try to run your app, you should see this behavior.
380375
381-
<center>
382-
<img src="/docs/assets/turbo-native-modules-events-ios.gif" width="30%" height="30%"/>
383-
</center>
384-
385-
</TabItem>
386-
</Tabs>
376+
| <center>Android</center> | <center>iOS</center> |
377+
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
378+
| <center><img src="/docs/assets/turbo-native-modules-events-android.gif" width="75%" height="75%"/></center> | <center><img src="/docs/assets/turbo-native-modules-events-ios.gif" width="75%" height="75%"/></center> |

0 commit comments

Comments
 (0)