Skip to content

Commit 467af1e

Browse files
javachemeta-codesync[bot]
authored andcommitted
Move TransformHelper from jni-common to jni (#56454)
Summary: Pull Request resolved: #56454 Moves `TransformHelper.cpp/h` from the `jni-common` BUCK target to `jni`. This lets `jni-common` drop deps on `cxxreact:bridge`, `cxxreact:module`, and `react/renderer/components/view:view`, replacing them with lighter `cxxreact:tracesection` and `jsi:jsi`. The `view` dep moves to `jni` where `TransformHelper` now lives. Adds `ReactNativeJNISoLoader.staticInit()` to `TransformHelper.kt` to ensure the native library is loaded before JNI calls, and registers `TransformHelper` natives in `OnLoad.cpp` instead of `OnLoad-common.cpp`. Changelog: [Internal] Reviewed By: hnguyen0428 Differential Revision: D101003509 fbshipit-source-id: e7906d6fd87fa3b4e91a9c33426c6e392b4b4755
1 parent 07c00f4 commit 467af1e

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ package com.facebook.react.uimanager
99

1010
import com.facebook.common.logging.FLog
1111
import com.facebook.react.bridge.NativeArray
12+
import com.facebook.react.bridge.ReactNativeJNISoLoader
1213
import com.facebook.react.bridge.ReadableArray
1314
import com.facebook.react.bridge.ReadableMap
1415
import com.facebook.react.bridge.ReadableType
1516
import com.facebook.react.common.ReactConstants
1617

1718
public object TransformHelper {
19+
init {
20+
ReactNativeJNISoLoader.staticInit()
21+
}
1822

1923
private val helperMatrix: ThreadLocal<DoubleArray> =
2024
object : ThreadLocal<DoubleArray>() {

packages/react-native/ReactAndroid/src/main/jni/react/jni/OnLoad-common.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include "JReactMarker.h"
1212
#include "NativeArray.h"
1313
#include "NativeMap.h"
14-
#include "TransformHelper.h"
1514
#include "WritableNativeArray.h"
1615
#include "WritableNativeMap.h"
1716

@@ -28,7 +27,6 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
2827
ReadableNativeMap::registerNatives();
2928
WritableNativeArray::registerNatives();
3029
WritableNativeMap::registerNatives();
31-
TransformHelper::registerNatives();
3230
});
3331
}
3432

packages/react-native/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <fbjni/fbjni.h>
1212

1313
#include "InspectorNetworkRequestListener.h"
14-
#include "JavaScriptExecutorHolder.h"
14+
#include "TransformHelper.h"
1515

1616
#ifndef WITH_GLOGINIT
1717
#define WITH_GLOGINIT 1
@@ -34,6 +34,7 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
3434
FLAGS_minloglevel = 0;
3535
#endif
3636
InspectorNetworkRequestListener::registerNatives();
37+
TransformHelper::registerNatives();
3738
});
3839
}
3940

0 commit comments

Comments
 (0)