Skip to content

Commit cc0da40

Browse files
authored
Merge branch 'main' into cipolleschi/add-swift-linking
2 parents 67475f2 + a995877 commit cc0da40

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

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

+7-15
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> |

Diff for: website/versioned_docs/version-0.78/platform.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,13 @@ Select method returns the most fitting value for the platform you are currently
191191

192192
The `config` parameter is an object with the following keys:
193193

194-
- `android` (any)
195-
- `ios` (any)
196-
- `native` (any)
197-
- `default` (any)
194+
- `android`
195+
- `ios`
196+
- `macos` (only applicable when using [react-native-macos](https://github.com/microsoft/react-native-macos))
197+
- `native` (fallback for all platforms except for `web`)
198+
- `web` (only applicable when using [react-native-web](https://github.com/necolas/react-native-web))
199+
- `windows` (only applicable when using [react-native-windows](https://github.com/microsoft/react-native-windows))
200+
- `default` (fallback for all platforms)
198201

199202
**Example usage:**
200203

0 commit comments

Comments
 (0)