Commit Graph

14 Commits

Author SHA1 Message Date
Rubén Norte 803bb16531 Prepare for next React Native sync with new instance format (#36438)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36438

This makes the `react-native` repository compatible with the next sync from react after the changes in https://github.com/facebook/react/pull/26321 land.

That PR is changing the format of the Fabric instance and we have a few instances where we assume the internal structure of that instance in the repository.

Changelog: [internal]

Reviewed By: yungsters

Differential Revision: D43980374

fbshipit-source-id: 718b504ff7c5bb6088c553e0256489b04d92b653
2023-03-13 05:47:18 -07:00
Sam Zhou 17f221c852 Add annotations to xplat to prepare for LTI
Summary: Changelog: [Internal]

Reviewed By: mvitousek

Differential Revision: D41739285

fbshipit-source-id: 79db8afaad87a2fbba8f6d30d8468a5997c8509d
2022-12-05 14:58:24 -08:00
Tianyu Yao e047eed2eb Fix inspecting for non-fabric
Summary:
Changelog: [Internal]

I think this started to break when https://github.com/facebook/react/pull/25441 was synced to RN. Before, `closestInstance` would only be non-null under Fabric, after it could be non-null in both. And we were using `closestInstance` to determine which data to send to `selectNode` in devtools. This diff makes a change to call `selectNode` once for non-fabric and once for fabric, one of them would not send anything to devtools frontend, this would make sure it works for both platforms.

Reviewed By: mondaychen

Differential Revision: D41366466

fbshipit-source-id: fcf30d03e443f6fa067782cd31b7cfd2e0cd841e
2022-11-17 11:36:33 -08:00
Tianyu Yao 5fb67b0fb2 Fix checking pointer event feature flag
Summary:
Changelog: [Internal]

The feature flag is a function not a boolean, flow didn't caught it..

Reviewed By: rbalicki2

Differential Revision: D41172775

fbshipit-source-id: b8a3365ab65049706b59e7e859f5f931ecab8360
2022-11-11 10:37:55 -08:00
Tianyu Yao bbb3a6146c Fix inspecting on non-fabric
Summary:
Changelog:
[Category][Internal] - Fix inspecting on non-fabric

the pointer events don't work on non-fabric components. In addition to check the pointer events feature flag, we need to check if fabric is on as well.

Reviewed By: rbalicki2

Differential Revision: D41053393

fbshipit-source-id: ab47bd845b578a0859f282ea8ff04ddbff17da02
2022-11-09 10:14:11 -08:00
Tianyu Yao 7e8992705a Use pointer events for hover
Summary:
Changelog:
[Category][Internal] - Uses the new experimental pointer events to enable mouse hover events during element inspection

Reviewed By: rbalicki2

Differential Revision: D40705973

fbshipit-source-id: fd0fb4539866dfc13592cfca1a864c2796497dc6
2022-10-28 11:53:51 -07:00
Tianyu Yao ea15c3c914 Fix an undefined is not function error
Summary:
Changelog: [Internal]

This occurs sometimes on AR, because `measure` doesn't exist on `Suspense`.

Reviewed By: lunaruan

Differential Revision: D40531850

fbshipit-source-id: 4013d660e5e47a28b27d5b6df57bcb7ce88a4ea8
2022-10-20 12:58:34 -07:00
Tianyu Yao c64f25ac85 Avoid redboxes when highlighting
Summary:
Changelog:
[General][Fixed] - Fixed React DevTools element highlighting throwing redbox errors

Reviewed By: lunaruan

Differential Revision: D40367546

fbshipit-source-id: 094c4a512700f717efe06b7bfa304d94b6eed652
2022-10-18 10:35:11 -07:00
Tianyu Yao 94429fb037 Highlight elements on press + hove
Summary:
Changelog:
[General][Added] - Highlight elements on hover while mouse down for React DevTools element inspection.

Since there is probably no mouse hover events for RN, this diff implements something that works similar like hover for RN: user keeps the mouse down and moves the cursor around, and the elements under the mouse is highlighted just like Web.

Reviewed By: lunaruan

Differential Revision: D40369733

fbshipit-source-id: ef223ee0f31f4e0372674fc39dd13bad8c15aa92
2022-10-14 14:58:43 -07:00
Pieter Vanderwerff ff14ff3d92 Add explicit React useState annotations in xplat/js
Reviewed By: SamChou19815

Differential Revision: D39756144

fbshipit-source-id: d34c86b62e82e771723714fb7896058b7f27670f
2022-09-23 15:18:54 -07:00
Tianyu Yao bfb36c2163 Stop inspecting when an element is selected
Summary:
Changelog:
[General][Fixed] In RN devtools, call that method, and then set component state to not inspecting.

Reviewed By: lunaruan

Differential Revision: D38852009

fbshipit-source-id: d14bd4cc4461f0f7ec4ae9cd6098a58eef3e6ab9
2022-09-12 16:56:19 -07:00
Tianyu Yao 6163029d4a Fix selectNode in fabric
Summary:
Changelog:
[General][Fixed] - Currently selectNode doesn't work for Fabric. Passing the instance instead of a tag to `selectNode` works.

Reviewed By: lunaruan

Differential Revision: D38851141

fbshipit-source-id: 7640d0f31fb099346a4d8205981e262da6be4990
2022-09-12 16:56:19 -07:00
Rubén Norte 699dabb2e3 Use findNodeHandle from RendererProxy instead of Paper in usages within the react-native package
Summary:
This replaces all direct references to `ReactNative` within the `react-native` package to use `findNodeHandle` with a reference obtained from `RendererProxy`, which will allow us to select the correct renderer.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D39270689

fbshipit-source-id: a39875281ba7b7b1b00128564124b6adcacebc4d
2022-09-08 11:12:06 -07:00
Tianyu Yao c52df02f84 Enable inspection from devtools
Summary:
Changelog:
[General][Added] - Added an overlay similar to Inspector.js that allows directly selecting elements on RN from React DevTools

This diff updates DevToolsHighlighter into DevToolsOverlay. It now also allows DevTools user to select an element to inspect directly from DevTools.

Depends on https://github.com/facebook/react/pull/25111 to work.

TODOs:
- Currently once an element selected on RN, the inspector toggle isn't turned off automatically.
- Fabric support depends on https://github.com/facebook/react/pull/25118

Reviewed By: lunaruan

Differential Revision: D38815494

fbshipit-source-id: 7e1e3a78f6594960b5dfaec142bafd3ca4b146af
2022-09-01 12:39:03 -07:00