react-native 0.83.0-rc.0 → 0.84.0-nightly-20251106-de5141a3d
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.
- package/Libraries/AppDelegate/RCTReactNativeFactory.h +3 -0
- package/Libraries/AppDelegate/RCTReactNativeFactory.mm +12 -0
- package/Libraries/AppDelegate/RCTRootViewFactory.h +10 -4
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +21 -5
- package/Libraries/Blob/RCTBlobManager.mm +4 -1
- package/Libraries/Blob/RCTFileReaderModule.mm +4 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Image/RCTBundleAssetImageLoader.mm +4 -1
- package/Libraries/Image/RCTGIFImageDecoder.mm +4 -1
- package/Libraries/Image/RCTImageEditingManager.mm +4 -1
- package/Libraries/Image/RCTImageLoader.mm +4 -1
- package/Libraries/Image/RCTImageStoreManager.mm +4 -1
- package/Libraries/Image/RCTImageViewManager.mm +4 -1
- package/Libraries/Image/RCTLocalAssetImageLoader.mm +4 -1
- package/Libraries/LinkingIOS/RCTLinkingManager.mm +4 -1
- package/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm +4 -1
- package/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm +4 -1
- package/Libraries/Network/RCTDataRequestHandler.mm +4 -1
- package/Libraries/Network/RCTFileRequestHandler.mm +4 -1
- package/Libraries/Network/RCTHTTPRequestHandler.mm +4 -1
- package/Libraries/Network/RCTNetworking.mm +4 -1
- package/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +4 -1
- package/Libraries/Settings/RCTSettingsManager.mm +4 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +2 -2
- package/Libraries/Text/BaseText/RCTBaseTextViewManager.mm +4 -1
- package/Libraries/Text/RawText/RCTRawTextViewManager.mm +4 -1
- package/Libraries/Text/Text/RCTTextViewManager.mm +4 -1
- package/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.mm +4 -1
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +3 -0
- package/Libraries/Text/TextInput/RCTBaseTextInputViewManager.mm +4 -1
- package/Libraries/Text/TextInput/RCTInputAccessoryViewManager.mm +4 -1
- package/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.mm +4 -1
- package/Libraries/Text/VirtualText/RCTVirtualTextViewManager.mm +4 -1
- package/Libraries/Vibration/RCTVibration.mm +4 -1
- package/React/Base/RCTBundleManager.h +59 -7
- package/React/Base/RCTBundleManager.m +98 -0
- package/React/Base/RCTBundleURLProvider.h +24 -0
- package/React/Base/RCTBundleURLProvider.mm +49 -4
- package/React/Base/RCTVersion.m +2 -2
- package/React/CoreModules/RCTAccessibilityManager.mm +4 -1
- package/React/CoreModules/RCTActionSheetManager.mm +4 -1
- package/React/CoreModules/RCTAlertManager.mm +4 -1
- package/React/CoreModules/RCTAppState.mm +4 -1
- package/React/CoreModules/RCTAppearance.mm +4 -1
- package/React/CoreModules/RCTClipboard.mm +4 -1
- package/React/CoreModules/RCTDevLoadingView.mm +4 -1
- package/React/CoreModules/RCTDevMenu.mm +4 -1
- package/React/CoreModules/RCTDevSettings.mm +4 -1
- package/React/CoreModules/RCTDevToolsRuntimeSettingsModule.mm +5 -1
- package/React/CoreModules/RCTDeviceInfo.mm +4 -1
- package/React/CoreModules/RCTEventDispatcher.mm +4 -1
- package/React/CoreModules/RCTExceptionsManager.mm +4 -1
- package/React/CoreModules/RCTI18nManager.mm +4 -1
- package/React/CoreModules/RCTKeyboardObserver.mm +4 -1
- package/React/CoreModules/RCTLogBox.mm +4 -1
- package/React/CoreModules/RCTPerfMonitor.mm +4 -1
- package/React/CoreModules/RCTPlatform.mm +7 -3
- package/React/CoreModules/RCTRedBox.mm +4 -1
- package/React/CoreModules/RCTSourceCode.mm +4 -1
- package/React/CoreModules/RCTStatusBarManager.mm +4 -1
- package/React/CoreModules/RCTTiming.mm +4 -1
- package/React/CoreModules/RCTWebSocketModule.mm +4 -1
- package/React/CoreModules/React-CoreModules.podspec +1 -0
- package/React/CxxBridge/RCTCxxBridge.mm +1 -2
- package/React/CxxModule/RCTCxxUtils.mm +1 -11
- package/React/FBReactNativeSpec/FBReactNativeSpecJSI.h +135 -143
- package/React/Fabric/Surface/RCTFabricSurface.mm +1 -1
- package/React/Modules/RCTUIManager.mm +4 -1
- package/React/Runtime/React-RCTRuntime.podspec +1 -0
- package/React/Views/RCTActivityIndicatorViewManager.m +4 -1
- package/React/Views/RCTDebuggingOverlayManager.m +4 -1
- package/React/Views/RCTModalHostViewManager.m +4 -1
- package/React/Views/RCTModalManager.m +4 -1
- package/React/Views/RCTSwitchManager.m +4 -1
- package/React/Views/RCTViewManager.m +4 -1
- package/React/Views/RefreshControl/RCTRefreshControlManager.m +4 -1
- package/React/Views/SafeAreaView/RCTSafeAreaViewManager.m +4 -1
- package/React/Views/ScrollView/RCTScrollContentViewManager.m +4 -1
- package/React/Views/ScrollView/RCTScrollViewManager.m +4 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.kt +7 -7
- package/ReactAndroid/src/main/java/com/facebook/react/ViewManagerOnDemandReactPackage.kt +53 -4
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt +99 -9
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayManager.kt +22 -1
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/perfmonitor/PerfMonitorOverlayView.kt +4 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +8 -14
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +11 -21
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +3 -5
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +3 -5
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +12 -23
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +3 -5
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.kt +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.kt +1 -2
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAxOrderHelper.kt +47 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.kt +3 -36
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/PointerEvent.kt +5 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +27 -3
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +11 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.kt +11 -1
- package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionWebSocket.cpp +29 -2
- package/ReactAndroid/src/main/jni/react/fabric/FabricUIManagerBinding.cpp +36 -26
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +15 -29
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +4 -7
- package/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp +1 -1
- package/ReactAndroid/src/main/jni/react/jni/JSLoader.h +2 -1
- package/ReactAndroid/src/main/res/devsupport/drawable/ic_perf_issue.xml +10 -0
- package/ReactCommon/cxxreact/JSBigString.h +14 -5
- package/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp +4 -5
- package/ReactCommon/cxxreact/React-cxxreact.podspec +1 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +3 -3
- package/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +1 -0
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +2 -3
- package/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +2 -2
- package/ReactCommon/jsinspector-modern/PerfMonitorV2.cpp +9 -1
- package/ReactCommon/jsinspector-modern/PerfMonitorV2.h +4 -1
- package/ReactCommon/jsinspector-modern/TracingAgent.cpp +1 -7
- package/ReactCommon/jsinspector-modern/tests/NetworkReporterTest.cpp +3 -55
- package/ReactCommon/jsinspector-modern/tests/TracingTest.h +82 -0
- package/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.cpp +99 -0
- package/ReactCommon/jsinspector-modern/tracing/PerformanceTracer.h +47 -1
- package/ReactCommon/jsinspector-modern/tracing/React-jsinspectortracing.podspec +4 -0
- package/ReactCommon/jsitooling/React-jsitooling.podspec +1 -0
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +5 -9
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +7 -12
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +85 -103
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +4 -6
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +5 -9
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDynamicProvider.h +10 -19
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +2 -3
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +4 -27
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +6 -11
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +3 -5
- package/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +4 -1
- package/ReactCommon/react/performance/cdpmetrics/CdpPerfIssuesReporter.cpp +4 -2
- package/ReactCommon/react/renderer/css/CSSSyntaxParser.h +7 -0
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +0 -20
- package/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +3 -3
- package/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp +2 -3
- package/ReactCommon/react/runtime/ReactInstance.cpp +4 -4
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +3 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +10 -6
- package/ReactCommon/react/utils/React-utils.podspec +3 -1
- package/ReactCommon/yoga/yoga/style/StyleLength.h +7 -0
- package/ReactCommon/yoga/yoga/style/StyleSizeLength.h +7 -0
- package/package.json +10 -9
- package/sdks/hermes-engine/version.properties +1 -1
- package/src/private/components/virtualview/VirtualView.js +16 -9
- package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
- package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
- package/src/private/featureflags/ReactNativeFeatureFlags.js +7 -12
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +48 -0
- package/types_generated/src/private/components/virtualview/VirtualView.d.ts +3 -1
- package/React/CxxModule/RCTCxxModule.h +0 -29
- package/React/CxxModule/RCTCxxModule.mm +0 -87
- package/sdks/.hermesversion +0 -1
|
@@ -68,9 +68,9 @@ public open class ReactDelegate {
|
|
|
68
68
|
launchOptions: Bundle?,
|
|
69
69
|
) {
|
|
70
70
|
this.activity = activity
|
|
71
|
-
mainComponentName = appKey
|
|
71
|
+
this.mainComponentName = appKey
|
|
72
72
|
this.launchOptions = launchOptions
|
|
73
|
-
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
73
|
+
this.doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
74
74
|
this.reactNativeHost = reactNativeHost
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -81,9 +81,9 @@ public open class ReactDelegate {
|
|
|
81
81
|
launchOptions: Bundle?,
|
|
82
82
|
) {
|
|
83
83
|
this.activity = activity
|
|
84
|
-
mainComponentName = appKey
|
|
84
|
+
this.mainComponentName = appKey
|
|
85
85
|
this.launchOptions = launchOptions
|
|
86
|
-
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
86
|
+
this.doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
87
87
|
this.reactHost = reactHost
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -95,11 +95,11 @@ public open class ReactDelegate {
|
|
|
95
95
|
launchOptions: Bundle?,
|
|
96
96
|
fabricEnabled: Boolean,
|
|
97
97
|
) {
|
|
98
|
-
isFabricEnabled = fabricEnabled
|
|
98
|
+
this.isFabricEnabled = fabricEnabled
|
|
99
99
|
this.activity = activity
|
|
100
|
-
mainComponentName = appKey
|
|
100
|
+
this.mainComponentName = appKey
|
|
101
101
|
this.launchOptions = launchOptions
|
|
102
|
-
doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
102
|
+
this.doubleTapReloadRecognizer = DoubleTapReloadRecognizer()
|
|
103
103
|
this.reactNativeHost = reactNativeHost
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -10,16 +10,65 @@ package com.facebook.react
|
|
|
10
10
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
11
11
|
import com.facebook.react.uimanager.ViewManager
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Interface for React Native packages that provide ViewManagers on-demand rather than eagerly.
|
|
15
|
+
*
|
|
16
|
+
* This interface enables lazy initialization of ViewManagers, improving startup performance by
|
|
17
|
+
* deferring the creation of ViewManager instances until they are actually needed by the JavaScript
|
|
18
|
+
* code. Instead of instantiating all ViewManagers during package initialization, implementing
|
|
19
|
+
* classes can defer creation until a specific ViewManager is requested by name.
|
|
20
|
+
*
|
|
21
|
+
* This pattern is particularly beneficial for applications with many ViewManagers, as it reduces
|
|
22
|
+
* memory footprint and initialization time by only creating the ViewManagers that are actively
|
|
23
|
+
* used.
|
|
24
|
+
*
|
|
25
|
+
* Implementing classes should maintain a registry or factory mechanism to create ViewManagers based
|
|
26
|
+
* on their names when requested.
|
|
27
|
+
*
|
|
28
|
+
* @see com.facebook.react.uimanager.ViewManager
|
|
29
|
+
* @see com.facebook.react.ReactPackage
|
|
30
|
+
*/
|
|
13
31
|
public interface ViewManagerOnDemandReactPackage {
|
|
14
32
|
/**
|
|
15
|
-
* Provides
|
|
16
|
-
*
|
|
33
|
+
* Provides the names of all ViewManagers available in this package.
|
|
34
|
+
*
|
|
35
|
+
* This method returns a collection of ViewManager names that can be accessed from JavaScript. The
|
|
36
|
+
* names returned should match the values returned by [ViewManager.getName] for each ViewManager
|
|
37
|
+
* that this package can create. The React Native framework uses these names to determine which
|
|
38
|
+
* ViewManagers are available and to request their creation on-demand.
|
|
39
|
+
*
|
|
40
|
+
* This method is called during the initialization phase to register available ViewManagers
|
|
41
|
+
* without actually instantiating them, enabling lazy loading.
|
|
42
|
+
*
|
|
43
|
+
* @param reactContext The React application context, which provides access to the Android
|
|
44
|
+
* application context and React Native lifecycle information
|
|
45
|
+
* @return A collection of ViewManager names. Returns an empty collection if no ViewManagers are
|
|
46
|
+
* available. The returned names should be unique within this package
|
|
17
47
|
*/
|
|
18
48
|
public fun getViewManagerNames(reactContext: ReactApplicationContext): Collection<String>
|
|
19
49
|
|
|
20
50
|
/**
|
|
21
|
-
* Creates and returns a ViewManager
|
|
22
|
-
*
|
|
51
|
+
* Creates and returns a ViewManager instance for the specified name.
|
|
52
|
+
*
|
|
53
|
+
* This method is called lazily when a ViewManager is actually needed by the JavaScript code,
|
|
54
|
+
* rather than during package initialization. The implementation should create and configure the
|
|
55
|
+
* appropriate ViewManager based on the provided name. The name parameter corresponds to one of
|
|
56
|
+
* the names returned by [getViewManagerNames].
|
|
57
|
+
*
|
|
58
|
+
* Implementations have flexibility in how they interpret the name and create ViewManagers. For
|
|
59
|
+
* example, they might use a factory pattern, reflection, or a simple name-to-class mapping.
|
|
60
|
+
*
|
|
61
|
+
* This method may be called on any thread, so implementations should ensure thread safety if
|
|
62
|
+
* necessary.
|
|
63
|
+
*
|
|
64
|
+
* @param reactContext The React application context, which provides access to the Android
|
|
65
|
+
* application context and React Native lifecycle information needed to initialize the
|
|
66
|
+
* ViewManager
|
|
67
|
+
* @param viewManagerName The name of the ViewManager to create, matching one of the names
|
|
68
|
+
* returned by [getViewManagerNames]
|
|
69
|
+
* @return A ViewManager instance for the specified name, or null if the name is not recognized or
|
|
70
|
+
* the ViewManager cannot be created. Returning null will result in a JavaScript error when the
|
|
71
|
+
* native component is used
|
|
23
72
|
*/
|
|
24
73
|
public fun createViewManager(
|
|
25
74
|
reactContext: ReactApplicationContext,
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.kt
CHANGED
|
@@ -9,11 +9,17 @@ package com.facebook.react.devsupport
|
|
|
9
9
|
|
|
10
10
|
import android.os.Handler
|
|
11
11
|
import android.os.Looper
|
|
12
|
+
import com.facebook.common.logging.FLog
|
|
12
13
|
import com.facebook.jni.HybridData
|
|
13
14
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
14
15
|
import com.facebook.proguard.annotations.DoNotStripAny
|
|
16
|
+
import com.facebook.react.common.annotations.VisibleForTesting
|
|
15
17
|
import com.facebook.soloader.SoLoader
|
|
16
18
|
import java.io.Closeable
|
|
19
|
+
import java.nio.ByteBuffer
|
|
20
|
+
import java.nio.charset.StandardCharsets
|
|
21
|
+
import java.util.ArrayDeque
|
|
22
|
+
import java.util.Queue
|
|
17
23
|
import java.util.concurrent.TimeUnit
|
|
18
24
|
import okhttp3.OkHttpClient
|
|
19
25
|
import okhttp3.Request
|
|
@@ -67,7 +73,7 @@ internal class CxxInspectorPackagerConnection(
|
|
|
67
73
|
*/
|
|
68
74
|
@DoNotStripAny
|
|
69
75
|
private interface IWebSocket : Closeable {
|
|
70
|
-
fun send(
|
|
76
|
+
fun send(chunk: ByteBuffer)
|
|
71
77
|
|
|
72
78
|
/**
|
|
73
79
|
* Close the WebSocket connection. NOTE: There is no close() method in the C++ interface.
|
|
@@ -76,6 +82,95 @@ internal class CxxInspectorPackagerConnection(
|
|
|
76
82
|
override fun close()
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
/**
|
|
86
|
+
* A simple WebSocket wrapper that prevents having more than 16MiB of messages queued
|
|
87
|
+
* simultaneously. This is done to stop OkHttp from closing the WebSocket connection.
|
|
88
|
+
*
|
|
89
|
+
* https://github.com/facebook/react-native/issues/39651.
|
|
90
|
+
* https://github.com/square/okhttp/blob/4e7dbec1ea6c9cf8d80422ac9d44b9b185c749a3/okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/ws/RealWebSocket.kt#L684.
|
|
91
|
+
*/
|
|
92
|
+
private class InspectorPackagerWebSocketImpl(
|
|
93
|
+
private val nativeWebSocket: WebSocket,
|
|
94
|
+
private val handler: Handler,
|
|
95
|
+
) : IWebSocket {
|
|
96
|
+
private val messageQueue: Queue<Pair<String, Int>> = ArrayDeque()
|
|
97
|
+
private val queueLock = Any()
|
|
98
|
+
private val drainRunnable =
|
|
99
|
+
object : Runnable {
|
|
100
|
+
override fun run() {
|
|
101
|
+
FLog.d(TAG, "Attempting to drain the message queue after ${drainDelayMs}ms")
|
|
102
|
+
tryDrainQueue()
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* We are providing a String to OkHttp's WebSocket, because there is no guarantee that all CDP
|
|
108
|
+
* clients will support binary data format.
|
|
109
|
+
*/
|
|
110
|
+
override fun send(chunk: ByteBuffer) {
|
|
111
|
+
synchronized(queueLock) {
|
|
112
|
+
val messageSize = chunk.capacity()
|
|
113
|
+
val message = StandardCharsets.UTF_8.decode(chunk).toString()
|
|
114
|
+
val currentQueueSize = nativeWebSocket.queueSize()
|
|
115
|
+
|
|
116
|
+
if (currentQueueSize + messageSize > MAX_QUEUE_SIZE) {
|
|
117
|
+
FLog.d(TAG, "Reached queue size limit. Queueing the message.")
|
|
118
|
+
messageQueue.offer(Pair(message, messageSize))
|
|
119
|
+
scheduleDrain()
|
|
120
|
+
} else {
|
|
121
|
+
if (messageQueue.isEmpty()) {
|
|
122
|
+
nativeWebSocket.send(message)
|
|
123
|
+
} else {
|
|
124
|
+
messageQueue.offer(Pair(message, messageSize))
|
|
125
|
+
tryDrainQueue()
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
override fun close() {
|
|
132
|
+
synchronized(queueLock) {
|
|
133
|
+
handler.removeCallbacks(drainRunnable)
|
|
134
|
+
messageQueue.clear()
|
|
135
|
+
nativeWebSocket.close(1000, "End of session")
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
private fun tryDrainQueue() {
|
|
140
|
+
synchronized(queueLock) {
|
|
141
|
+
while (messageQueue.isNotEmpty()) {
|
|
142
|
+
val (nextMessage, nextMessageSize) = messageQueue.peek() ?: break
|
|
143
|
+
val currentQueueSize = nativeWebSocket.queueSize()
|
|
144
|
+
|
|
145
|
+
if (currentQueueSize + nextMessageSize <= MAX_QUEUE_SIZE) {
|
|
146
|
+
messageQueue.poll()
|
|
147
|
+
if (!nativeWebSocket.send(nextMessage)) {
|
|
148
|
+
// The WebSocket is closing, closed, or cancelled.
|
|
149
|
+
handler.removeCallbacks(drainRunnable)
|
|
150
|
+
messageQueue.clear()
|
|
151
|
+
|
|
152
|
+
break
|
|
153
|
+
}
|
|
154
|
+
} else {
|
|
155
|
+
scheduleDrain()
|
|
156
|
+
break
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
private fun scheduleDrain() {
|
|
163
|
+
FLog.d(TAG, "Scheduled a task to drain messages queue.")
|
|
164
|
+
handler.removeCallbacks(drainRunnable)
|
|
165
|
+
handler.postDelayed(drainRunnable, drainDelayMs)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
companion object {
|
|
169
|
+
private val TAG: String = InspectorPackagerWebSocketImpl::class.java.simpleName
|
|
170
|
+
private const val drainDelayMs: Long = 100
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
79
174
|
/** Java implementation of the C++ InspectorPackagerConnectionDelegate interface. */
|
|
80
175
|
private class DelegateImpl {
|
|
81
176
|
private val httpClient =
|
|
@@ -130,15 +225,8 @@ internal class CxxInspectorPackagerConnection(
|
|
|
130
225
|
}
|
|
131
226
|
},
|
|
132
227
|
)
|
|
133
|
-
return object : IWebSocket {
|
|
134
|
-
override fun send(message: String) {
|
|
135
|
-
webSocket.send(message)
|
|
136
|
-
}
|
|
137
228
|
|
|
138
|
-
|
|
139
|
-
webSocket.close(1000, "End of session")
|
|
140
|
-
}
|
|
141
|
-
}
|
|
229
|
+
return InspectorPackagerWebSocketImpl(webSocket, handler)
|
|
142
230
|
}
|
|
143
231
|
|
|
144
232
|
@DoNotStrip
|
|
@@ -152,6 +240,8 @@ internal class CxxInspectorPackagerConnection(
|
|
|
152
240
|
SoLoader.loadLibrary("react_devsupportjni")
|
|
153
241
|
}
|
|
154
242
|
|
|
243
|
+
@VisibleForTesting internal const val MAX_QUEUE_SIZE = 16L * 1024 * 1024 // 16MiB
|
|
244
|
+
|
|
155
245
|
@JvmStatic
|
|
156
246
|
private external fun initHybrid(
|
|
157
247
|
url: String,
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/inspector/InspectorNetworkHelper.kt
CHANGED
|
@@ -66,7 +66,7 @@ internal object InspectorNetworkHelper {
|
|
|
66
66
|
response.body().use { responseBody ->
|
|
67
67
|
if (responseBody != null) {
|
|
68
68
|
val inputStream = responseBody.byteStream()
|
|
69
|
-
val chunkSize = 1024
|
|
69
|
+
val chunkSize = 8 * 1024 // 8Kb
|
|
70
70
|
val buffer = ByteArray(chunkSize)
|
|
71
71
|
var bytesRead: Int
|
|
72
72
|
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
package com.facebook.react.devsupport.perfmonitor
|
|
9
9
|
|
|
10
|
+
import android.os.Handler
|
|
11
|
+
import android.os.Looper
|
|
10
12
|
import com.facebook.react.bridge.UiThreadUtil
|
|
11
13
|
import com.facebook.react.devsupport.interfaces.TracingState
|
|
12
14
|
|
|
@@ -23,6 +25,7 @@ internal class PerfMonitorOverlayManager(
|
|
|
23
25
|
private var view: PerfMonitorOverlayView? = null
|
|
24
26
|
private var tracingState: TracingState = TracingState.ENABLEDINCDPMODE
|
|
25
27
|
private var perfIssueCount: Int = 0
|
|
28
|
+
private val handler = Handler(Looper.getMainLooper())
|
|
26
29
|
|
|
27
30
|
/** Enable the Perf Monitor overlay. */
|
|
28
31
|
fun enable() {
|
|
@@ -75,6 +78,7 @@ internal class PerfMonitorOverlayManager(
|
|
|
75
78
|
tracingState = state
|
|
76
79
|
if (state != TracingState.DISABLED) {
|
|
77
80
|
perfIssueCount = 0
|
|
81
|
+
handler.removeCallbacksAndMessages(null)
|
|
78
82
|
}
|
|
79
83
|
UiThreadUtil.runOnUiThread {
|
|
80
84
|
view?.updateRecordingState(state)
|
|
@@ -84,10 +88,23 @@ internal class PerfMonitorOverlayManager(
|
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
override fun onPerfIssueAdded(name: String) {
|
|
91
|
+
perfIssueCount++
|
|
92
|
+
|
|
87
93
|
UiThreadUtil.runOnUiThread {
|
|
88
|
-
view?.updatePerfIssueCount(
|
|
94
|
+
view?.updatePerfIssueCount(perfIssueCount)
|
|
89
95
|
view?.show()
|
|
90
96
|
}
|
|
97
|
+
|
|
98
|
+
handler.postDelayed(
|
|
99
|
+
{
|
|
100
|
+
perfIssueCount--
|
|
101
|
+
UiThreadUtil.runOnUiThread {
|
|
102
|
+
view?.updatePerfIssueCount(perfIssueCount)
|
|
103
|
+
view?.show()
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
PERF_ISSUE_EXPIRY_MS,
|
|
107
|
+
)
|
|
91
108
|
}
|
|
92
109
|
|
|
93
110
|
private fun handleRecordingButtonPress() {
|
|
@@ -105,4 +122,8 @@ internal class PerfMonitorOverlayManager(
|
|
|
105
122
|
TracingState.ENABLEDINCDPMODE -> Unit
|
|
106
123
|
}
|
|
107
124
|
}
|
|
125
|
+
|
|
126
|
+
companion object {
|
|
127
|
+
private const val PERF_ISSUE_EXPIRY_MS = 20_000L
|
|
128
|
+
}
|
|
108
129
|
}
|
|
@@ -120,12 +120,12 @@ internal class PerfMonitorOverlayView(
|
|
|
120
120
|
setTextColor(Color.WHITE)
|
|
121
121
|
typeface = TYPEFACE_BOLD
|
|
122
122
|
val alertDrawable =
|
|
123
|
-
context.getDrawable(
|
|
123
|
+
context.getDrawable(R.drawable.ic_perf_issue)?.apply {
|
|
124
124
|
setBounds(
|
|
125
125
|
0,
|
|
126
126
|
1,
|
|
127
|
-
dpToPx(
|
|
128
|
-
dpToPx(
|
|
127
|
+
dpToPx(ISSUE_ICON_SIZE).toInt(),
|
|
128
|
+
dpToPx(ISSUE_ICON_SIZE).toInt() + 1,
|
|
129
129
|
)
|
|
130
130
|
}
|
|
131
131
|
setCompoundDrawables(alertDrawable, null, null, null)
|
|
@@ -214,6 +214,7 @@ internal class PerfMonitorOverlayView(
|
|
|
214
214
|
private val COLOR_OVERLAY_BORDER = Color.parseColor("#6C6C6C")
|
|
215
215
|
private val TEXT_SIZE_PRIMARY = 12f
|
|
216
216
|
private val TEXT_SIZE_ACCESSORY = 10f
|
|
217
|
+
private val ISSUE_ICON_SIZE = 15f
|
|
217
218
|
private val TYPEFACE_BOLD = Typeface.create("sans-serif", Typeface.BOLD)
|
|
218
219
|
}
|
|
219
220
|
}
|
|
@@ -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<<
|
|
7
|
+
* @generated SignedSource<<9646ebeba75ec903be5ade7e2333f0c8>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -78,6 +78,12 @@ public object ReactNativeFeatureFlags {
|
|
|
78
78
|
@JvmStatic
|
|
79
79
|
public fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean = accessor.disableOldAndroidAttachmentMetricsWorkarounds()
|
|
80
80
|
|
|
81
|
+
/**
|
|
82
|
+
* Force disable subview clipping for ReactViewGroup on Android
|
|
83
|
+
*/
|
|
84
|
+
@JvmStatic
|
|
85
|
+
public fun disableSubviewClippingAndroid(): Boolean = accessor.disableSubviewClippingAndroid()
|
|
86
|
+
|
|
81
87
|
/**
|
|
82
88
|
* Turns off the global measurement cache used by TextLayoutManager on Android.
|
|
83
89
|
*/
|
|
@@ -379,7 +385,7 @@ public object ReactNativeFeatureFlags {
|
|
|
379
385
|
public fun overrideBySynchronousMountPropsAtMountingAndroid(): Boolean = accessor.overrideBySynchronousMountPropsAtMountingAndroid()
|
|
380
386
|
|
|
381
387
|
/**
|
|
382
|
-
* Enable reporting Performance Issues (`detail.
|
|
388
|
+
* Enable reporting Performance Issues (`detail.devtools.performanceIssue`). Displayed in the V2 Performance Monitor and the "Performance Issues" sub-panel in DevTools.
|
|
383
389
|
*/
|
|
384
390
|
@JvmStatic
|
|
385
391
|
public fun perfIssuesEnabled(): Boolean = accessor.perfIssuesEnabled()
|
|
@@ -420,12 +426,6 @@ public object ReactNativeFeatureFlags {
|
|
|
420
426
|
@JvmStatic
|
|
421
427
|
public fun skipActivityIdentityAssertionOnHostPause(): Boolean = accessor.skipActivityIdentityAssertionOnHostPause()
|
|
422
428
|
|
|
423
|
-
/**
|
|
424
|
-
* A flag to tell Fabric to sweep active touches from JSTouchDispatcher in Android when a child native gesture is started.
|
|
425
|
-
*/
|
|
426
|
-
@JvmStatic
|
|
427
|
-
public fun sweepActiveTouchOnChildNativeGesturesAndroid(): Boolean = accessor.sweepActiveTouchOnChildNativeGesturesAndroid()
|
|
428
|
-
|
|
429
429
|
/**
|
|
430
430
|
* Enables storing js caller stack when creating promise in native module. This is useful in case of Promise rejection and tracing the cause.
|
|
431
431
|
*/
|
|
@@ -468,12 +468,6 @@ public object ReactNativeFeatureFlags {
|
|
|
468
468
|
@JvmStatic
|
|
469
469
|
public fun useNativeViewConfigsInBridgelessMode(): Boolean = accessor.useNativeViewConfigsInBridgelessMode()
|
|
470
470
|
|
|
471
|
-
/**
|
|
472
|
-
* Uses an optimized mechanism for event batching on Android that does not need to wait for a Choreographer frame callback.
|
|
473
|
-
*/
|
|
474
|
-
@JvmStatic
|
|
475
|
-
public fun useOptimizedEventBatchingOnAndroid(): Boolean = accessor.useOptimizedEventBatchingOnAndroid()
|
|
476
|
-
|
|
477
471
|
/**
|
|
478
472
|
* Instead of using folly::dynamic as internal representation in RawProps and RawValue, use jsi::Value
|
|
479
473
|
*/
|
|
@@ -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<<
|
|
7
|
+
* @generated SignedSource<<9d6ccbe6d02608901fc18ad88baab176>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -28,6 +28,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
28
28
|
private var disableFabricCommitInCXXAnimatedCache: Boolean? = null
|
|
29
29
|
private var disableMountItemReorderingAndroidCache: Boolean? = null
|
|
30
30
|
private var disableOldAndroidAttachmentMetricsWorkaroundsCache: Boolean? = null
|
|
31
|
+
private var disableSubviewClippingAndroidCache: Boolean? = null
|
|
31
32
|
private var disableTextLayoutManagerCacheAndroidCache: Boolean? = null
|
|
32
33
|
private var enableAccessibilityOrderCache: Boolean? = null
|
|
33
34
|
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
|
|
@@ -85,7 +86,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
85
86
|
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
|
|
86
87
|
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
|
|
87
88
|
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
|
|
88
|
-
private var sweepActiveTouchOnChildNativeGesturesAndroidCache: Boolean? = null
|
|
89
89
|
private var traceTurboModulePromiseRejectionsOnAndroidCache: Boolean? = null
|
|
90
90
|
private var updateRuntimeShadowNodeReferencesOnCommitCache: Boolean? = null
|
|
91
91
|
private var useAlwaysAvailableJSErrorHandlingCache: Boolean? = null
|
|
@@ -93,7 +93,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
93
93
|
private var useNativeEqualsInNativeReadableArrayAndroidCache: Boolean? = null
|
|
94
94
|
private var useNativeTransformHelperAndroidCache: Boolean? = null
|
|
95
95
|
private var useNativeViewConfigsInBridgelessModeCache: Boolean? = null
|
|
96
|
-
private var useOptimizedEventBatchingOnAndroidCache: Boolean? = null
|
|
97
96
|
private var useRawPropsJsiValueCache: Boolean? = null
|
|
98
97
|
private var useShadowNodeStateOnCloneCache: Boolean? = null
|
|
99
98
|
private var useSharedAnimatedBackendCache: Boolean? = null
|
|
@@ -176,6 +175,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
176
175
|
return cached
|
|
177
176
|
}
|
|
178
177
|
|
|
178
|
+
override fun disableSubviewClippingAndroid(): Boolean {
|
|
179
|
+
var cached = disableSubviewClippingAndroidCache
|
|
180
|
+
if (cached == null) {
|
|
181
|
+
cached = ReactNativeFeatureFlagsCxxInterop.disableSubviewClippingAndroid()
|
|
182
|
+
disableSubviewClippingAndroidCache = cached
|
|
183
|
+
}
|
|
184
|
+
return cached
|
|
185
|
+
}
|
|
186
|
+
|
|
179
187
|
override fun disableTextLayoutManagerCacheAndroid(): Boolean {
|
|
180
188
|
var cached = disableTextLayoutManagerCacheAndroidCache
|
|
181
189
|
if (cached == null) {
|
|
@@ -689,15 +697,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
689
697
|
return cached
|
|
690
698
|
}
|
|
691
699
|
|
|
692
|
-
override fun sweepActiveTouchOnChildNativeGesturesAndroid(): Boolean {
|
|
693
|
-
var cached = sweepActiveTouchOnChildNativeGesturesAndroidCache
|
|
694
|
-
if (cached == null) {
|
|
695
|
-
cached = ReactNativeFeatureFlagsCxxInterop.sweepActiveTouchOnChildNativeGesturesAndroid()
|
|
696
|
-
sweepActiveTouchOnChildNativeGesturesAndroidCache = cached
|
|
697
|
-
}
|
|
698
|
-
return cached
|
|
699
|
-
}
|
|
700
|
-
|
|
701
700
|
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean {
|
|
702
701
|
var cached = traceTurboModulePromiseRejectionsOnAndroidCache
|
|
703
702
|
if (cached == null) {
|
|
@@ -761,15 +760,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
|
|
761
760
|
return cached
|
|
762
761
|
}
|
|
763
762
|
|
|
764
|
-
override fun useOptimizedEventBatchingOnAndroid(): Boolean {
|
|
765
|
-
var cached = useOptimizedEventBatchingOnAndroidCache
|
|
766
|
-
if (cached == null) {
|
|
767
|
-
cached = ReactNativeFeatureFlagsCxxInterop.useOptimizedEventBatchingOnAndroid()
|
|
768
|
-
useOptimizedEventBatchingOnAndroidCache = cached
|
|
769
|
-
}
|
|
770
|
-
return cached
|
|
771
|
-
}
|
|
772
|
-
|
|
773
763
|
override fun useRawPropsJsiValue(): Boolean {
|
|
774
764
|
var cached = useRawPropsJsiValueCache
|
|
775
765
|
if (cached == null) {
|
|
@@ -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<<
|
|
7
|
+
* @generated SignedSource<<fbc551ca005a7d8abcd2cf2e5d29a3a6>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -44,6 +44,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
|
|
44
44
|
|
|
45
45
|
@DoNotStrip @JvmStatic public external fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean
|
|
46
46
|
|
|
47
|
+
@DoNotStrip @JvmStatic public external fun disableSubviewClippingAndroid(): Boolean
|
|
48
|
+
|
|
47
49
|
@DoNotStrip @JvmStatic public external fun disableTextLayoutManagerCacheAndroid(): Boolean
|
|
48
50
|
|
|
49
51
|
@DoNotStrip @JvmStatic public external fun enableAccessibilityOrder(): Boolean
|
|
@@ -158,8 +160,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
|
|
158
160
|
|
|
159
161
|
@DoNotStrip @JvmStatic public external fun skipActivityIdentityAssertionOnHostPause(): Boolean
|
|
160
162
|
|
|
161
|
-
@DoNotStrip @JvmStatic public external fun sweepActiveTouchOnChildNativeGesturesAndroid(): Boolean
|
|
162
|
-
|
|
163
163
|
@DoNotStrip @JvmStatic public external fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean
|
|
164
164
|
|
|
165
165
|
@DoNotStrip @JvmStatic public external fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean
|
|
@@ -174,8 +174,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
|
|
174
174
|
|
|
175
175
|
@DoNotStrip @JvmStatic public external fun useNativeViewConfigsInBridgelessMode(): Boolean
|
|
176
176
|
|
|
177
|
-
@DoNotStrip @JvmStatic public external fun useOptimizedEventBatchingOnAndroid(): Boolean
|
|
178
|
-
|
|
179
177
|
@DoNotStrip @JvmStatic public external fun useRawPropsJsiValue(): Boolean
|
|
180
178
|
|
|
181
179
|
@DoNotStrip @JvmStatic public external fun useShadowNodeStateOnClone(): Boolean
|
|
@@ -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<<
|
|
7
|
+
* @generated SignedSource<<7b8a5ad9a3353ea32a39bd139e9174f7>>
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -39,6 +39,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
|
|
39
39
|
|
|
40
40
|
override fun disableOldAndroidAttachmentMetricsWorkarounds(): Boolean = true
|
|
41
41
|
|
|
42
|
+
override fun disableSubviewClippingAndroid(): Boolean = false
|
|
43
|
+
|
|
42
44
|
override fun disableTextLayoutManagerCacheAndroid(): Boolean = false
|
|
43
45
|
|
|
44
46
|
override fun enableAccessibilityOrder(): Boolean = false
|
|
@@ -153,8 +155,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
|
|
153
155
|
|
|
154
156
|
override fun skipActivityIdentityAssertionOnHostPause(): Boolean = false
|
|
155
157
|
|
|
156
|
-
override fun sweepActiveTouchOnChildNativeGesturesAndroid(): Boolean = true
|
|
157
|
-
|
|
158
158
|
override fun traceTurboModulePromiseRejectionsOnAndroid(): Boolean = false
|
|
159
159
|
|
|
160
160
|
override fun updateRuntimeShadowNodeReferencesOnCommit(): Boolean = false
|
|
@@ -169,8 +169,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
|
|
169
169
|
|
|
170
170
|
override fun useNativeViewConfigsInBridgelessMode(): Boolean = false
|
|
171
171
|
|
|
172
|
-
override fun useOptimizedEventBatchingOnAndroid(): Boolean = false
|
|
173
|
-
|
|
174
172
|
override fun useRawPropsJsiValue(): Boolean = true
|
|
175
173
|
|
|
176
174
|
override fun useShadowNodeStateOnClone(): Boolean = false
|