Skip to content

Commit 34b6626

Browse files
authored
Merge pull request #897 from facebook/main
sync
2 parents 5ac0dbe + e20b097 commit 34b6626

File tree

269 files changed

+46429
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+46429
-431
lines changed

docs/_fabric-native-components.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react";
2+
import IOSContent from "./fabric-native-components-ios.md";
3+
import AndroidContent from "./fabric-native-components-android.md";
4+
5+
export function FabricNativeComponentsIOS() {
6+
return <IOSContent />;
7+
}
8+
9+
export function FabricNativeComponentsAndroid() {
10+
return <AndroidContent />;
11+
}

docs/_integration-with-existing-apps-kotlin.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ import android.app.Application;
284284
+import com.facebook.react.defaults.DefaultReactHost;
285285
+import com.facebook.react.defaults.DefaultReactNativeHost;
286286
+import com.facebook.soloader.SoLoader;
287+
+import com.facebook.react.soloader.OpenSourceMergedSoMapping
287288
+import java.util.List;
288289

289290
-class MainApplication extends Application {
@@ -312,7 +313,7 @@ import android.app.Application;
312313
@Override
313314
public void onCreate() {
314315
super.onCreate();
315-
+ SoLoader.init(this, false);
316+
+ SoLoader.init(this, OpenSourceMergedSoMapping);
316317
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
317318
+ DefaultNewArchitectureEntryPoint.load();
318319
+ }
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react";
2+
import IOSContent from "./turbo-native-modules-ios.md";
3+
import AndroidContent from "./turbo-native-modules-android.md";
4+
5+
export function TurboNativeModulesIOS() {
6+
return <IOSContent />;
7+
}
8+
9+
export function TurboNativeModulesAndroid() {
10+
return <AndroidContent />;
11+
}

docs/appendix.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Appendix
2+
3+
## I. Terminology
4+
5+
- **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.
6+
7+
- **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.
8+
- **Native Component** - Native platform views that are available to your application JavaScript code through React Components.
9+
10+
- **Legacy Native Components** - Components which are running on the old React Native architecture.
11+
- **Legacy Native Modules** - Modules which are running on the old React Native architecture.
12+
13+
## II. Codegen Typings
14+
15+
You may use the following table as a reference for which types are supported and what they map to in each platform:
16+
17+
| Flow | TypeScript | Flow Nullable Support | TypeScript Nullable Support | Android (Java) | iOS (ObjC) |
18+
| -------------------------------------------------------------------------- | --------------------------------------------------- | ------------------------------------------------------- | ---------------------------------------------------- | ------------------------------------ | -------------------------------------------------------------- |
19+
| `string` | `string` | `?string` | <code>string &#124; null</code> | `string` | `NSString` |
20+
| `boolean` | `boolean` | `?boolean` | <code>boolean &#124; null</code> | `Boolean` | `NSNumber` |
21+
| Object Literal<br /><code>&#123;&#124; foo: string, ...&#124;&#125;</code> | <code>&#123; foo: string, ...&#125; as const</code> | <code>?&#123;&#124; foo: string, ...&#124;&#125;</code> | <code>?&#123; foo: string, ...&#125; as const</code> | \- | \- |
22+
| Object [[1](#notes)] | Object [[1](#notes)] | `?Object` | <code>Object &#124; null</code> | `ReadableMap` | `@` (untyped dictionary) |
23+
| <code>Array&lt;T&gt;</code> | <code>Array&lt;T&gt;</code> | <code>?Array&lt;T&gt;</code> | <code>Array&lt;T&gt; &#124; null</code> | `ReadableArray` | `NSArray` (or `RCTConvertVecToArray` when used inside objects) |
24+
| `Function` | `Function` | `?Function` | <code>Function &#124; null</code> | \- | \- |
25+
| <code>Promise&lt;T&gt;</code> | <code>Promise&lt;T&gt;</code> | <code>?Promise&lt;T&gt;</code> | <code>Promise&lt;T&gt; &#124; null</code> | `com.facebook.react.bridge.Promise` | `RCTPromiseResolve` and `RCTPromiseRejectBlock` |
26+
| Type Unions<br /><code>'SUCCESS'&#124;'FAIL'</code> | Type Unions<br /><code>'SUCCESS'&#124;'FAIL'</code> | Only as callbacks | | \- | \- |
27+
| Callbacks<br />`() =>` | Callbacks<br />`() =>` | Yes | | `com.facebook.react.bridge.Callback` | `RCTResponseSenderBlock` |
28+
| `number` | `number` | No | | `double` | `NSNumber` |
29+
30+
### Notes:
31+
32+
<b>[1]</b> We strongly recommend using Object literals instead of Objects.
33+
34+
:::info
35+
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.
36+
:::

docs/debugging.md

Lines changed: 19 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Debugging Basics
55

66
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
77

8-
## Accessing the Dev Menu
8+
## Opening the Dev Menu
99

1010
React Native provides an in-app developer menu which offers several debugging options. You can access the Dev Menu by shaking your device or via keyboard shortcuts:
1111

@@ -14,97 +14,46 @@ React Native provides an in-app developer menu which offers several debugging op
1414

1515
Alternatively for Android devices and emulators, you can run `adb shell input keyevent 82` in your terminal.
1616

17-
![The React Native Dev Menu](/docs/assets/debugging-dev-menu.jpg)
17+
![The React Native Dev Menu](/docs/assets/debugging-dev-menu-076.jpg)
1818

1919
:::note
2020
The Dev Menu is disabled in release (production) builds.
2121
:::
2222

23-
## Opening the Debugger
23+
## Opening DevTools
2424

25-
The debugger allows you to understand and debug how your JavaScript code is running, similar to a web browser.
25+
[React Native DevTools](./react-native-devtools) is our built-in debugger for React Native. It allows you to inspect and understand how your JavaScript code is running, similar to a web browser.
2626

27-
:::info
28-
**In Expo projects**, press <kbd>j</kbd> in the CLI to directly open the Hermes Debugger.
29-
:::
30-
31-
<Tabs groupId="js-debugger" queryString defaultValue={constants.defaultJsDebugger} values={constants.jsDebuggers}>
32-
<TabItem value="hermes">
33-
34-
Hermes supports the Chrome debugger by implementing the Chrome DevTools Protocol. This means Chrome's tools can be used to directly debug JavaScript running on Hermes, on an emulator or on a physical device.
35-
36-
1. In a Chrome browser window, navigate to `chrome://inspect`.
37-
2. Use the "Configure..." button to add the dev server address (typically `localhost:8081`).
38-
3. You should now see a "Hermes React Native" target with an **"inspect"** link. Click this to open the debugger.
39-
40-
![Overview of Chrome's inspect interface and a connected Hermes debugger window](/docs/assets/debugging-hermes-debugger-instructions.jpg)
41-
42-
</TabItem>
43-
<TabItem value="flipper">
44-
45-
[Flipper](https://fbflipper.com/) is a native debugging tool which provides JavaScript debugging capabilities for React Native via an embedded Chrome DevTools panel.
46-
47-
To debug JavaScript code in Flipper, select **"Open Debugger"** from the Dev Menu. Learn more about Flipper [here](https://fbflipper.com/docs/features/react-native/).
48-
49-
:::info
50-
To debug using Flipper, the Flipper app must be [installed on your system](https://fbflipper.com/docs/getting-started/).
51-
:::
52-
53-
![The Flipper desktop app opened to the Hermes debugger panel](/docs/assets/debugging-flipper-console.jpg)
27+
To open DevTools, either:
5428

55-
:::warning
56-
Debugging React Native apps with Flipper is [deprecated in React Native 0.73](https://github.com/react-native-community/discussions-and-proposals/pull/641). We will eventually remove out-of-the box support for JS debugging via Flipper.
57-
:::
58-
59-
:::tip
29+
- Select "Open DevTools" in the Dev Menu.
30+
- Press <kbd>j</kbd> from the CLI (`npx react-native start`).
6031

61-
#### Alternative debugging tools
32+
On first launch, DevTools will open to a welcome panel, along with an open console drawer where you can view logs and interact with the JavaScript runtime. From the top of the window, you can navigate to other panels, including the integrated React Components Inspector and Profiler.
6233

63-
As React Native transitions away from Flipper, we recommend other existing methods, including first party IDEs, to inspect your application's native code and behaviour.
34+
![React Native DevTools opened to the "Welcome" pane](/docs/assets/debugging-rndt-welcome.jpg)
6435

65-
- [Debugging Native Code](./debugging-native-code)
66-
- <a href="https://shift.infinite.red/why-you-dont-need-flipper-in-your-react-native-app-and-how-to-get-by-without-it-3af461955109" target="_blank">Why you don’t need Flipper in your React Native app … and how to get by without it ↗</a>
67-
68-
:::
36+
React Native DevTools is powered by a dedicated debugging architecture built into React Native and uses a customized build of the [Chrome DevTools](https://developer.chrome.com/docs/devtools) frontend. This enables us to offer familiar, browser-aligned debugging features that are deeply integrated and built for end-to-end reliability.
6937

70-
</TabItem>
71-
<TabItem value="new-debugger">
38+
Learn more in our [React Native DevTools guide](./react-native-devtools).
7239

7340
:::note
74-
**This is an experimental feature** and several features may not work reliably today. When this feature does launch in future, we intend for it to work more completely than the current debugging methods.
41+
React Native DevTools is only available with the Hermes engine, and requires either Google Chrome or Microsoft Edge installed.
7542
:::
7643

77-
The React Native team is working on a new JavaScript debugger experience, intended to replace Flipper, with a preview available as of React Native 0.73.
78-
79-
The new debugger can be enabled via React Native CLI. This will also enable <kbd>j</kbd> to debug.
80-
81-
```sh
82-
npx react-native start --experimental-debugger
83-
```
84-
85-
When selecting **"Open Debugger"** in the Dev Menu, this will launch the new debugger using Google Chrome or Microsoft Edge.
86-
87-
![The new debugger frontend opened to the "Welcome" pane](/docs/assets/debugging-debugger-welcome.jpg)
88-
89-
</TabItem>
90-
</Tabs>
91-
92-
## React DevTools
44+
:::info
9345

94-
You can use React DevTools to inspect the React element tree, props, and state.
46+
#### Flipper and alternative debugging tools
9547

96-
```sh
97-
npx react-devtools
98-
```
48+
React Native DevTools replaces the previous Flipper, Experimental Debugger, and Hermes debugger (Chrome) frontends. If you are on an older version of React Native, please go to the docs [for your version](/versions).
9949

100-
![A React DevTools window](/docs/assets/debugging-react-devtools-blank.jpg)
50+
We continue to offer legacy debugging methods such as Direct JSC Debugging and Remote JS Debugging (deprecated) (see [Other Debugging Methods](./other-debugging-methods)).
10151

102-
:::tip
52+
React Native DevTools is designed for debugging React app concerns, and not to replace native tools. If you want to inspect React Native’s underlying platform layers (for example, while developing a Native Module), please use the debugging tools available in Xcode and Android Studio (see [Debugging Native Code](http://localhost:3000/docs/next/debugging-native-code)).
10353

104-
#### Learn how to use React DevTools!
54+
Other useful links:
10555

106-
- [React DevTools guide](./react-devtools)
107-
- [React Developer Tools on react.dev](https://react.dev/learn/react-developer-tools)
56+
- <a href="https://shift.infinite.red/why-you-dont-need-flipper-in-your-react-native-app-and-how-to-get-by-without-it-3af461955109" target="_blank">Why you don’t need Flipper in your React Native app … and how to get by without&nbsp;it&nbsp;↗</a>
10857

10958
:::
11059

0 commit comments

Comments
 (0)