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/new-architecture-library-intro.md
+34-2Lines changed: 34 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,19 @@ In general, this means you can use primitive types (strings, numbers, booleans),
130
130
131
131
> See Appendix [I. Flow Type to Native Type Mapping](./new-architecture-appendix#i-flow-type-to-native-type-mapping). (TypeScript to Native Type Mapping will be added soon.)
132
132
133
+
### Codegen helper types
134
+
135
+
You can use predefined types for your JavaScript spec, here is a list of them:
136
+
137
+
- `Double`
138
+
- `Float`
139
+
- `Int32`
140
+
- `WithDefault<Type, Value>` - Sets default value for type
141
+
- `BubblingEventHandler<T>` - For bubbling events (eg: `onChange`).
142
+
- `DirectEventHandler<T>` - For direct events (eg: `onClick`).
143
+
144
+
Later on those types are compiled to coresponding equivalents on target platforms.
145
+
133
146
### Be Consistent Across Platforms and Eliminate Type Ambiguity
134
147
135
148
Before adopting the new architecture in your native module, you will need to ensure your methods are consistent across platforms. This is something you will realize as you set out to write the JavaScript spec for your native module - remember, that JavaScript spec defines what the methods will look like on all supported platforms.
@@ -181,7 +194,7 @@ While we know that all deprecations are a hassle, this guide is intended to help
181
194
3. Migrating off `setNativeProps`
182
195
4. Move the call to `requireNativeComponent` to a separate file
183
196
5. Migrating off `dispatchViewManagerCommand`
184
-
6. Using `codegenNativeComponent`
197
+
6. Creating NativeCommands with `codegenNativeCommands`
185
198
186
199
### Migrating `findNodeHandle` / getting a `HostComponent`
Similar to one above, in an effort to avoid calling methods on the UIManager, all view manager methods are now called through an instance of `NativeCommands`. `codegenNativeCommands` is a new API to code-generate `NativeCommands` given an interface of your view manager’s commands.
@@ -491,7 +523,7 @@ class MyComponent extends React.Component<Props> {
491
523
}
492
524
```
493
525
494
-
**Creating the NativeCommands with `codegenNativeCommands`**
526
+
**Creating NativeCommands with `codegenNativeCommands`**
495
527
496
528
```ts title="MyCustomMapNativeComponent.js"
497
529
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.68/new-architecture-library-intro.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -81,6 +81,19 @@ In general, this means you can use primitive types (strings, numbers, booleans),
81
81
82
82
> See Appendix [I. Flow Type to Native Type Mapping](#i-flow-type-to-native-type-mapping).
83
83
84
+
### Codegen helper types
85
+
86
+
You can use predefined types for your JavaScript spec, here is a list of them:
87
+
88
+
- `Double`
89
+
- `Float`
90
+
- `Int32`
91
+
- `WithDefault<Type, Value>` - Sets default value for type
92
+
- `BubblingEventHandler<T>` - For bubbling events (eg: `onChange`).
93
+
- `DirectEventHandler<T>` - For direct events (eg: `onClick`).
94
+
95
+
Later on those types are compiled to coresponding equivalents on target platforms.
96
+
84
97
### Be Consistent Across Platforms and Eliminate Type Ambiguity
85
98
86
99
Before adopting the new architecture in your native module, you will need to ensure your methods are consistent across platforms. This is something you will realize as you set out to write the JavaScript spec for your native module - remember, that JavaScript spec defines what the methods will look like on all supported platforms.
@@ -132,7 +145,7 @@ While we know that all deprecations are a hassle, this guide is intended to help
132
145
3. Migrating off `setNativeProps`
133
146
4. Move the call to `requireNativeComponent` to a separate file
134
147
5. Migrating off `dispatchViewManagerCommand`
135
-
6. Using `codegenNativeComponent`
148
+
6. Creating NativeCommands with `codegenNativeCommands`
136
149
137
150
### Migrating `findNodeHandle` / getting a `HostComponent`
Copy file name to clipboardExpand all lines: website/versioned_docs/version-0.69/new-architecture-library-intro.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,6 +130,19 @@ In general, this means you can use primitive types (strings, numbers, booleans),
130
130
131
131
> See Appendix [I. Flow Type to Native Type Mapping](./new-architecture-appendix#i-flow-type-to-native-type-mapping). (TypeScript to Native Type Mapping will be added soon.)
132
132
133
+
### Codegen helper types
134
+
135
+
You can use predefined types for your JavaScript spec, here is a list of them:
136
+
137
+
- `Double`
138
+
- `Float`
139
+
- `Int32`
140
+
- `WithDefault<Type, Value>` - Sets default value for type
141
+
- `BubblingEventHandler<T>` - For bubbling events (eg: `onChange`).
142
+
- `DirectEventHandler<T>` - For direct events (eg: `onClick`).
143
+
144
+
Later on those types are compiled to coresponding equivalents on target platforms.
145
+
133
146
### Be Consistent Across Platforms and Eliminate Type Ambiguity
134
147
135
148
Before adopting the new architecture in your native module, you will need to ensure your methods are consistent across platforms. This is something you will realize as you set out to write the JavaScript spec for your native module - remember, that JavaScript spec defines what the methods will look like on all supported platforms.
@@ -181,7 +194,7 @@ While we know that all deprecations are a hassle, this guide is intended to help
181
194
3. Migrating off `setNativeProps`
182
195
4. Move the call to `requireNativeComponent` to a separate file
183
196
5. Migrating off `dispatchViewManagerCommand`
184
-
6. Using `codegenNativeComponent`
197
+
6. Creating NativeCommands with `codegenNativeCommands`
185
198
186
199
### Migrating `findNodeHandle` / getting a `HostComponent`
0 commit comments