forked from facebook/react-native-website
-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #897 from facebook/main
sync
- Loading branch information
Showing
269 changed files
with
46,429 additions
and
431 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
import IOSContent from "./fabric-native-components-ios.md"; | ||
import AndroidContent from "./fabric-native-components-android.md"; | ||
|
||
export function FabricNativeComponentsIOS() { | ||
return <IOSContent />; | ||
} | ||
|
||
export function FabricNativeComponentsAndroid() { | ||
return <AndroidContent />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React from "react"; | ||
import IOSContent from "./turbo-native-modules-ios.md"; | ||
import AndroidContent from "./turbo-native-modules-android.md"; | ||
|
||
export function TurboNativeModulesIOS() { | ||
return <IOSContent />; | ||
} | ||
|
||
export function TurboNativeModulesAndroid() { | ||
return <AndroidContent />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Appendix | ||
|
||
## I. Terminology | ||
|
||
- **Spec** - TypeScript or Flow code that describes the API for a Turbo Native Module or Fabric Native component. Used by **Codegen** to generate boilerplate code. | ||
|
||
- **Native Modules** - Native libraries that have no User Interface (UI) for the user. Examples would be persistent storage, notifications, network events. These are accessible to your JavaScript application code as functions and objects. | ||
- **Native Component** - Native platform views that are available to your application JavaScript code through React Components. | ||
|
||
- **Legacy Native Components** - Components which are running on the old React Native architecture. | ||
- **Legacy Native Modules** - Modules which are running on the old React Native architecture. | ||
|
||
## II. Codegen Typings | ||
|
||
You may use the following table as a reference for which types are supported and what they map to in each platform: | ||
|
||
| Flow | TypeScript | Flow Nullable Support | TypeScript Nullable Support | Android (Java) | iOS (ObjC) | | ||
| -------------------------------------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------ | -------------------------------------------------------------- | | ||
| `string` | `string` | `?string` | <code>string | null</code> | `string` | `NSString` | | ||
| `boolean` | `boolean` | `?boolean` | <code>boolean | null</code> | `Boolean` | `NSNumber` | | ||
| Object Literal<br /><code>{| foo: string, ...|}</code> | <code>{ foo: string, ...} as const</code> | <code>?{| foo: string, ...|}</code> | <code>?{ foo: string, ...} as const</code> | \- | \- | | ||
| Object [[1](#notes)] | Object [[1](#notes)] | `?Object` | <code>Object | null</code> | `ReadableMap` | `@` (untyped dictionary) | | ||
| <code>Array<T></code> | <code>Array<T></code> | <code>?Array<T></code> | <code>Array<T> | null</code> | `ReadableArray` | `NSArray` (or `RCTConvertVecToArray` when used inside objects) | | ||
| `Function` | `Function` | `?Function` | <code>Function | null</code> | \- | \- | | ||
| <code>Promise<T></code> | <code>Promise<T></code> | <code>?Promise<T></code> | <code>Promise<T> | null</code> | `com.facebook.react.bridge.Promise` | `RCTPromiseResolve` and `RCTPromiseRejectBlock` | | ||
| Type Unions<br /><code>'SUCCESS'|'FAIL'</code> | Type Unions<br /><code>'SUCCESS'|'FAIL'</code> | Only as callbacks | | \- | \- | | ||
| Callbacks<br />`() =>` | Callbacks<br />`() =>` | Yes | | `com.facebook.react.bridge.Callback` | `RCTResponseSenderBlock` | | ||
| `number` | `number` | No | | `double` | `NSNumber` | | ||
|
||
### Notes: | ||
|
||
<b>[1]</b> We strongly recommend using Object literals instead of Objects. | ||
|
||
:::info | ||
You may also find it useful to refer to the JavaScript specifications for the core modules in React Native. These are located inside the `Libraries/` directory in the React Native repository. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.