You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/the-new-architecture/native-modules-custom-events.md
+7-15
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Both are good use cases for emitting events from a Native Modules. In this guide
10
10
11
11
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.
12
12
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.
14
14
Make sure to be familiar with that guide before diving into this one, potentially implementing the example in the guide.
15
15
16
16
## 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
321
321
322
322
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 typein JS.
323
323
324
-
## Step 5: Run Your App
325
-
326
-
If you now try to run your app, you should see this behavior.
@@ -374,13 +366,13 @@ The `NativeLocalStorageSpecBase` is a base class that provides the `emitOnKeyAdd
374
366
375
367
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.
376
368
369
+
</TabItem>
370
+
</Tabs>
371
+
377
372
## Step 5: Run Your App
378
373
379
374
If you now try to run your app, you should see this behavior.
0 commit comments