react-native 0.84.0-nightly-20251118-d314e5f4e → 0.84.0-nightly-20251119-79b09ce9c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/Libraries/Components/View/ViewPropTypes.js +10 -0
  2. package/Libraries/Core/ReactNativeVersion.js +1 -1
  3. package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
  4. package/Libraries/Types/CoreEventTypes.js +31 -0
  5. package/React/Base/RCTVersion.m +1 -1
  6. package/React/CxxModule/RCTCxxUtils.mm +1 -1
  7. package/React/FBReactNativeSpec/react/renderer/components/FBReactNativeSpec/Props.h +14 -0
  8. package/ReactAndroid/api/ReactAndroid.api +2 -14
  9. package/ReactAndroid/gradle.properties +1 -1
  10. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +0 -7
  11. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.kt +0 -10
  12. package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +58 -2
  13. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.kt +0 -18
  14. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +0 -54
  15. package/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.kt +3 -27
  16. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +1 -1
  17. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +0 -9
  18. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceView.kt +52 -0
  19. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +10 -0
  20. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSKeyDispatcher.kt +65 -0
  21. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +0 -8
  22. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +0 -8
  23. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +0 -16
  24. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/KeyDownEvent.kt +23 -0
  25. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/KeyEvent.kt +156 -0
  26. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/KeyUpEvent.kt +24 -0
  27. package/ReactAndroid/src/main/jni/react/tracing/PerformanceTracerCxxInterop.cpp +1 -1
  28. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  29. package/ReactCommon/jsi/jsi/test/testlib.cpp +2 -2
  30. package/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp +1 -1
  31. package/ReactCommon/react/runtime/ReactInstance.cpp +1 -1
  32. package/index.js.flow +3 -0
  33. package/package.json +9 -9
  34. package/sdks/hermes-engine/version.properties +1 -1
  35. package/types_generated/Libraries/Components/View/ViewPropTypes.d.ts +9 -3
  36. package/types_generated/Libraries/Types/CoreEventTypes.d.ts +29 -1
  37. package/types_generated/index.d.ts +2 -2
  38. package/ReactAndroid/src/main/java/com/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener.kt +0 -36
  39. package/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.kt +0 -157
  40. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.kt +0 -30
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<8d60fc88563648fbefac174fb0e5c729>>
7
+ * @generated SignedSource<<4da3aadedac8d4a8ac1051dfab06b9f2>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
10
  * Original file: packages/react-native/Libraries/Types/CoreEventTypes.js
@@ -315,3 +315,31 @@ export type MouseEvent = NativeSyntheticEvent<Readonly<{
315
315
  pageY: number;
316
316
  timestamp: number;
317
317
  }>>;
318
+ export type KeyEvent = Readonly<{
319
+ /**
320
+ * The actual key that was pressed. For example, F would be "f" or "F" depending on the shift key.
321
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
322
+ */
323
+ key: string;
324
+ /**
325
+ * The key code of the key that was pressed. For example, F would be "KeyF"
326
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
327
+ */
328
+ code: string;
329
+ altKey: boolean;
330
+ ctrlKey: boolean;
331
+ metaKey: boolean;
332
+ shiftKey: boolean;
333
+ /**
334
+ * A boolean value that is true if the given key is being held down such that it is automatically repeating.
335
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
336
+ */
337
+ repeat?: boolean;
338
+ /**
339
+ * Returns a boolean value indicating if the event is fired within a composition session
340
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/isComposing
341
+ */
342
+ isComposing?: boolean;
343
+ }>;
344
+ export type KeyUpEvent = NativeSyntheticEvent<KeyEvent>;
345
+ export type KeyDownEvent = NativeSyntheticEvent<KeyEvent>;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<328e267fad7a818130aa2532a87d7455>>
7
+ * @generated SignedSource<<51dcf454cb297798e6069477f4640162>>
8
8
  *
9
9
  * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
10
  * Original file: packages/react-native/index.js.flow
@@ -151,7 +151,7 @@ export { default as useColorScheme } from "./Libraries/Utilities/useColorScheme"
151
151
  export { default as useWindowDimensions } from "./Libraries/Utilities/useWindowDimensions";
152
152
  export { default as UTFSequence } from "./Libraries/UTFSequence";
153
153
  export { default as Vibration } from "./Libraries/Vibration/Vibration";
154
- export type { BlurEvent, FocusEvent, GestureResponderEvent, LayoutChangeEvent, LayoutRectangle, MouseEvent, PointerEvent, NativeMouseEvent, NativePointerEvent, NativeScrollEvent, NativeSyntheticEvent, NativeTouchEvent, NativeUIEvent, ResponderSyntheticEvent, ScrollEvent, TargetedEvent, TextLayoutEvent } from "./Libraries/Types/CoreEventTypes";
154
+ export type { BlurEvent, FocusEvent, GestureResponderEvent, KeyDownEvent, KeyEvent, KeyUpEvent, LayoutChangeEvent, LayoutRectangle, MouseEvent, PointerEvent, NativeMouseEvent, NativePointerEvent, NativeScrollEvent, NativeSyntheticEvent, NativeTouchEvent, NativeUIEvent, ResponderSyntheticEvent, ScrollEvent, TargetedEvent, TextLayoutEvent } from "./Libraries/Types/CoreEventTypes";
155
155
  export type { TurboModule } from "./Libraries/TurboModule/RCTExport";
156
156
  export type * from "./Libraries/Types/CodegenTypesNamespace";
157
157
  export type { HostInstance, NativeMethods, NativeMethodsMixin, MeasureInWindowOnSuccessCallback, MeasureLayoutOnSuccessCallback, MeasureOnSuccessCallback } from "./src/private/types/HostInstance";
@@ -1,36 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- package com.facebook.react.bridge
9
-
10
- import com.facebook.react.common.annotations.internal.LegacyArchitecture
11
- import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
12
-
13
- /**
14
- * Interface for receiving notification for bridge idle/busy events. Should not affect application
15
- * logic and should only be used for debug/monitoring/testing purposes. Call
16
- * [ ][CatalystInstance.addBridgeIdleDebugListener] to start monitoring.
17
- *
18
- * NB: onTransitionToBridgeIdle and onTransitionToBridgeBusy may be called from different threads,
19
- * and those threads may not be the same thread on which the listener was originally registered.
20
- */
21
- @Deprecated("NotThreadSafeBridgeIdleDebugListener will be deleted in the new architecture.")
22
- @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
23
- public interface NotThreadSafeBridgeIdleDebugListener {
24
- /**
25
- * Called once all pending JS calls have resolved via an onBatchComplete call in the bridge and
26
- * the requested native module calls have also run. The bridge will not become busy again until a
27
- * timer, touch event, etc. causes a Java->JS call to be enqueued again.
28
- */
29
- public fun onTransitionToBridgeIdle()
30
-
31
- /** Called when the bridge was in an idle state and executes a JS call or callback. */
32
- public fun onTransitionToBridgeBusy()
33
-
34
- /** Called when the bridge is destroyed */
35
- public fun onBridgeDestroyed()
36
- }
@@ -1,157 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- @file:Suppress(
9
- "DEPRECATION"
10
- ) // Suppressing deprecation of NotThreadSafeViewHierarchyUpdateDebugListener
11
-
12
- package com.facebook.react.modules.debug
13
-
14
- import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener
15
- import com.facebook.react.uimanager.debug.NotThreadSafeViewHierarchyUpdateDebugListener
16
-
17
- /**
18
- * Debug object that listens to bridge busy/idle events and UiManagerModule dispatches and uses it
19
- * to calculate whether JS was able to update the UI during a given frame. After being installed on
20
- * a [ReactBridge] and a [com.facebook.react.uimanager.UIManagerModule],
21
- * [getDidJSHitFrameAndCleanup] should be called once per frame via a
22
- * [android.view.Choreographer.FrameCallback].
23
- */
24
- internal class DidJSUpdateUiDuringFrameDetector :
25
- NotThreadSafeBridgeIdleDebugListener, NotThreadSafeViewHierarchyUpdateDebugListener {
26
- private val transitionToIdleEvents = ArrayList<Long>(20)
27
- private val transitionToBusyEvents = ArrayList<Long>(20)
28
- private val viewHierarchyUpdateEnqueuedEvents = ArrayList<Long>(20)
29
- private val viewHierarchyUpdateFinishedEvents = ArrayList<Long>(20)
30
- @Volatile private var wasIdleAtEndOfLastFrame = true
31
-
32
- @Synchronized
33
- override fun onTransitionToBridgeIdle() {
34
- transitionToIdleEvents.add(System.nanoTime())
35
- }
36
-
37
- @Synchronized
38
- override fun onTransitionToBridgeBusy() {
39
- transitionToBusyEvents.add(System.nanoTime())
40
- }
41
-
42
- @Synchronized
43
- override fun onBridgeDestroyed() {
44
- // do nothing
45
- }
46
-
47
- @Synchronized
48
- override fun onViewHierarchyUpdateEnqueued() {
49
- viewHierarchyUpdateEnqueuedEvents.add(System.nanoTime())
50
- }
51
-
52
- @Synchronized
53
- override fun onViewHierarchyUpdateFinished() {
54
- viewHierarchyUpdateFinishedEvents.add(System.nanoTime())
55
- }
56
-
57
- /**
58
- * Designed to be called from a [android.view.Choreographer.FrameCallback.doFrame] call.
59
- *
60
- * There are two 'success' cases that will cause [getDidJSHitFrameAndCleanup] to return true for a
61
- * given frame:
62
- * 1. UIManagerModule finished dispatching a batched UI update on the UI thread during the frame.
63
- * This means that during the next hierarchy traversal, new UI will be drawn if needed (good).
64
- * 1. The bridge ended the frame idle (meaning there were no JS nor native module calls still in
65
- * flight) AND there was no UiManagerModule update enqueued that didn't also finish. NB: if
66
- * there was one enqueued that actually finished, we'd have case 1), so effectively we just
67
- * look for whether one was enqueued.
68
- *
69
- * NB: This call can only be called once for a given frame time range because it cleans up events
70
- * it recorded for that frame.
71
- *
72
- * NB2: This makes the assumption that [onViewHierarchyUpdateEnqueued] is called from the
73
- * [com.facebook.react.uimanager.UIManagerModule.onBatchComplete], e.g. while the bridge is still
74
- * considered busy, which means there is no race condition where the bridge has gone idle but a
75
- * hierarchy update is waiting to be enqueued.
76
- *
77
- * @param frameStartTimeNanos the time in nanos that the last frame started
78
- * @param frameEndTimeNanos the time in nanos that the last frame ended
79
- */
80
- @Synchronized
81
- fun getDidJSHitFrameAndCleanup(frameStartTimeNanos: Long, frameEndTimeNanos: Long): Boolean {
82
- // Case 1: We dispatched a UI update
83
- val finishedUiUpdate =
84
- hasEventBetweenTimestamps(
85
- viewHierarchyUpdateFinishedEvents,
86
- frameStartTimeNanos,
87
- frameEndTimeNanos,
88
- )
89
- val didEndFrameIdle = didEndFrameIdle(frameStartTimeNanos, frameEndTimeNanos)
90
- val hitFrame =
91
- if (finishedUiUpdate) {
92
- true
93
- } else {
94
- // Case 2: Ended idle but no UI was enqueued during that frame
95
- (didEndFrameIdle &&
96
- !hasEventBetweenTimestamps(
97
- viewHierarchyUpdateEnqueuedEvents,
98
- frameStartTimeNanos,
99
- frameEndTimeNanos,
100
- ))
101
- }
102
- cleanUp(transitionToIdleEvents, frameEndTimeNanos)
103
- cleanUp(transitionToBusyEvents, frameEndTimeNanos)
104
- cleanUp(viewHierarchyUpdateEnqueuedEvents, frameEndTimeNanos)
105
- cleanUp(viewHierarchyUpdateFinishedEvents, frameEndTimeNanos)
106
- wasIdleAtEndOfLastFrame = didEndFrameIdle
107
- return hitFrame
108
- }
109
-
110
- private fun didEndFrameIdle(startTime: Long, endTime: Long): Boolean {
111
- val lastIdleTransition =
112
- getLastEventBetweenTimestamps(transitionToIdleEvents, startTime, endTime)
113
- val lastBusyTransition =
114
- getLastEventBetweenTimestamps(transitionToBusyEvents, startTime, endTime)
115
- return if (lastIdleTransition == -1L && lastBusyTransition == -1L) {
116
- wasIdleAtEndOfLastFrame
117
- } else lastIdleTransition > lastBusyTransition
118
- }
119
- }
120
-
121
- private fun hasEventBetweenTimestamps(
122
- eventArray: ArrayList<Long>,
123
- startTime: Long,
124
- endTime: Long,
125
- ): Boolean = eventArray.any { time -> time in startTime until endTime }
126
-
127
- private fun getLastEventBetweenTimestamps(
128
- eventArray: ArrayList<Long>,
129
- startTime: Long,
130
- endTime: Long,
131
- ): Long {
132
- var lastEvent: Long = -1
133
- for (time in eventArray) {
134
- if (time in startTime until endTime) {
135
- lastEvent = time
136
- } else if (time >= endTime) {
137
- break
138
- }
139
- }
140
- return lastEvent
141
- }
142
-
143
- private fun cleanUp(eventArray: ArrayList<Long>, endTime: Long) {
144
- val size = eventArray.size
145
- var indicesToRemove = 0
146
- for (i in 0 until size) {
147
- if (eventArray[i] < endTime) {
148
- indicesToRemove++
149
- }
150
- }
151
- if (indicesToRemove > 0) {
152
- for (i in 0 until size - indicesToRemove) {
153
- eventArray[i] = eventArray[i + indicesToRemove]
154
- }
155
- eventArray.dropLast(indicesToRemove)
156
- }
157
- }
@@ -1,30 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- package com.facebook.react.uimanager.debug
9
-
10
- import com.facebook.react.common.annotations.internal.LegacyArchitecture
11
- import com.facebook.react.common.annotations.internal.LegacyArchitectureLogLevel
12
-
13
- /**
14
- * A listener that is notified about view hierarchy update events. This listener should only be used
15
- * for debug purposes and should not affect application state.
16
- *
17
- * NB: while [onViewHierarchyUpdateFinished] will always be called from the UI thread, there are no
18
- * guarantees what thread onViewHierarchyUpdateEnqueued is called on.
19
- */
20
- @Deprecated(
21
- "NotThreadSafeViewHierarchyUpdateDebugListener will be deleted in the new architecture."
22
- )
23
- @LegacyArchitecture(logLevel = LegacyArchitectureLogLevel.ERROR)
24
- internal interface NotThreadSafeViewHierarchyUpdateDebugListener {
25
- /** Called when `UIManagerModule` enqueues a UI batch to be dispatched to the main thread. */
26
- fun onViewHierarchyUpdateEnqueued()
27
-
28
- /** Called from the main thread after a UI batch has been applied to all root views. */
29
- fun onViewHierarchyUpdateFinished()
30
- }