react-native 0.75.1 → 0.75.3
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/Core/ReactNativeVersion.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +17 -15
- package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +0 -3
- package/React/Base/RCTVersion.m +1 -1
- package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +0 -3
- package/ReactAndroid/api/ReactAndroid.api +3 -3
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicNative.kt +51 -0
- package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.java +2 -4
- package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.java +2 -5
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java +9 -4
- package/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.kt +7 -5
- package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionWebSocketDelegate.cpp +11 -2
- package/ReactAndroid/src/main/jni/react/devsupport/JCxxInspectorPackagerConnectionWebSocketDelegate.h +1 -3
- package/ReactAndroid/src/main/jni/react/jni/JDynamicNative.cpp +46 -0
- package/ReactAndroid/src/main/jni/react/jni/JDynamicNative.h +56 -0
- package/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +2 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +8 -1
- package/ReactCommon/react/nativemodule/samples/platform/android/SampleLegacyModule.java +40 -0
- package/package.json +12 -11
- package/scripts/bundle.js +2 -0
- package/scripts/cocoapods/autolinking.rb +2 -1
- package/scripts/cocoapods/utils.rb +1 -1
- package/scripts/codegen/generate-artifacts-executor.js +3 -2
- package/sdks/hermes-engine/utils/build-ios-framework.sh +2 -2
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/ReactAndroid/src/main/jni/react/devsupport/JOptional.cpp +0 -29
- package/ReactAndroid/src/main/jni/react/devsupport/JOptional.h +0 -27
|
@@ -182,21 +182,23 @@ type MaximumOneOf<T, K extends keyof T = keyof T> = K extends keyof T
|
|
|
182
182
|
|
|
183
183
|
export interface TransformsStyle {
|
|
184
184
|
transform?:
|
|
185
|
-
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
| Readonly<
|
|
186
|
+
MaximumOneOf<
|
|
187
|
+
PerspectiveTransform &
|
|
188
|
+
RotateTransform &
|
|
189
|
+
RotateXTransform &
|
|
190
|
+
RotateYTransform &
|
|
191
|
+
RotateZTransform &
|
|
192
|
+
ScaleTransform &
|
|
193
|
+
ScaleXTransform &
|
|
194
|
+
ScaleYTransform &
|
|
195
|
+
TranslateXTransform &
|
|
196
|
+
TranslateYTransform &
|
|
197
|
+
SkewXTransform &
|
|
198
|
+
SkewYTransform &
|
|
199
|
+
MatrixTransform
|
|
200
|
+
>[]
|
|
201
|
+
>
|
|
200
202
|
| string
|
|
201
203
|
| undefined;
|
|
202
204
|
transformOrigin?: Array<string | number> | string | undefined;
|
|
@@ -651,8 +651,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
|
|
|
651
651
|
- (NSString *)returnKeyTypeToString:(UIReturnKeyType)returnKeyType
|
|
652
652
|
{
|
|
653
653
|
switch (returnKeyType) {
|
|
654
|
-
case UIReturnKeyDefault:
|
|
655
|
-
return @"Default";
|
|
656
654
|
case UIReturnKeyGo:
|
|
657
655
|
return @"Go";
|
|
658
656
|
case UIReturnKeyNext:
|
|
@@ -680,7 +678,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
|
|
|
680
678
|
{
|
|
681
679
|
returnKeyTypesSet = [NSSet setWithObjects:@(UIReturnKeyDone),
|
|
682
680
|
@(UIReturnKeyGo),
|
|
683
|
-
@(UIReturnKeyDefault),
|
|
684
681
|
@(UIReturnKeyNext),
|
|
685
682
|
@(UIReturnKeySearch),
|
|
686
683
|
@(UIReturnKeySend),
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -471,8 +471,6 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
471
471
|
- (NSString *)returnKeyTypeToString:(UIReturnKeyType)returnKeyType
|
|
472
472
|
{
|
|
473
473
|
switch (returnKeyType) {
|
|
474
|
-
case UIReturnKeyDefault:
|
|
475
|
-
return @"Default";
|
|
476
474
|
case UIReturnKeyGo:
|
|
477
475
|
return @"Go";
|
|
478
476
|
case UIReturnKeyNext:
|
|
@@ -500,7 +498,6 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
|
|
500
498
|
{
|
|
501
499
|
returnKeyTypesSet = [NSSet setWithObjects:@(UIReturnKeyDone),
|
|
502
500
|
@(UIReturnKeyGo),
|
|
503
|
-
@(UIReturnKeyDefault),
|
|
504
501
|
@(UIReturnKeyNext),
|
|
505
502
|
@(UIReturnKeySearch),
|
|
506
503
|
@(UIReturnKeySend),
|
|
@@ -6449,7 +6449,7 @@ public class com/facebook/react/views/image/ReactImageView : com/facebook/drawee
|
|
|
6449
6449
|
public fun updateCallerContext (Ljava/lang/Object;)V
|
|
6450
6450
|
}
|
|
6451
6451
|
|
|
6452
|
-
public
|
|
6452
|
+
public class com/facebook/react/views/imagehelper/ImageSource {
|
|
6453
6453
|
public static final field Companion Lcom/facebook/react/views/imagehelper/ImageSource$Companion;
|
|
6454
6454
|
public fun <init> (Landroid/content/Context;Ljava/lang/String;)V
|
|
6455
6455
|
public fun <init> (Landroid/content/Context;Ljava/lang/String;D)V
|
|
@@ -6459,9 +6459,9 @@ public final class com/facebook/react/views/imagehelper/ImageSource {
|
|
|
6459
6459
|
public final fun getSize ()D
|
|
6460
6460
|
public final fun getSource ()Ljava/lang/String;
|
|
6461
6461
|
public static final fun getTransparentBitmapImageSource (Landroid/content/Context;)Lcom/facebook/react/views/imagehelper/ImageSource;
|
|
6462
|
-
public
|
|
6462
|
+
public fun getUri ()Landroid/net/Uri;
|
|
6463
6463
|
public fun hashCode ()I
|
|
6464
|
-
public
|
|
6464
|
+
public fun isResource ()Z
|
|
6465
6465
|
}
|
|
6466
6466
|
|
|
6467
6467
|
public final class com/facebook/react/views/imagehelper/ImageSource$Companion {
|
|
@@ -891,7 +891,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
891
891
|
sendEvent(
|
|
892
892
|
"keyboardDidHide",
|
|
893
893
|
createKeyboardEventPayload(
|
|
894
|
-
PixelUtil.toDIPFromPixel(
|
|
894
|
+
PixelUtil.toDIPFromPixel(mVisibleViewArea.height()),
|
|
895
895
|
0,
|
|
896
896
|
PixelUtil.toDIPFromPixel(mVisibleViewArea.width()),
|
|
897
897
|
0));
|
|
@@ -940,7 +940,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
940
940
|
sendEvent(
|
|
941
941
|
"keyboardDidHide",
|
|
942
942
|
createKeyboardEventPayload(
|
|
943
|
-
PixelUtil.toDIPFromPixel(
|
|
943
|
+
PixelUtil.toDIPFromPixel(mVisibleViewArea.height()),
|
|
944
944
|
0,
|
|
945
945
|
PixelUtil.toDIPFromPixel(mVisibleViewArea.width()),
|
|
946
946
|
0));
|
|
@@ -0,0 +1,51 @@
|
|
|
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.jni.HybridData
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStripAny
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* An implementation of [Dynamic] that has a C++ implementation.
|
|
16
|
+
*
|
|
17
|
+
* This is used to support Legacy Native Modules that have not been migrated to the new architecture
|
|
18
|
+
* and are using [Dynamic] as a parameter type.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStripAny
|
|
21
|
+
private class DynamicNative(
|
|
22
|
+
@Suppress("NoHungarianNotation") @field:DoNotStrip private val mHybridData: HybridData?
|
|
23
|
+
) : Dynamic {
|
|
24
|
+
|
|
25
|
+
override val type: ReadableType
|
|
26
|
+
get() = getTypeNative()
|
|
27
|
+
|
|
28
|
+
override val isNull: Boolean
|
|
29
|
+
get() = isNullNative()
|
|
30
|
+
|
|
31
|
+
private external fun getTypeNative(): ReadableType
|
|
32
|
+
|
|
33
|
+
private external fun isNullNative(): Boolean
|
|
34
|
+
|
|
35
|
+
external override fun asBoolean(): Boolean
|
|
36
|
+
|
|
37
|
+
// The native representation is holding the value as Double. We do the Int conversion here.
|
|
38
|
+
override fun asInt(): Int = asDouble().toInt()
|
|
39
|
+
|
|
40
|
+
external override fun asDouble(): Double
|
|
41
|
+
|
|
42
|
+
external override fun asString(): String
|
|
43
|
+
|
|
44
|
+
external override fun asArray(): ReadableArray
|
|
45
|
+
|
|
46
|
+
external override fun asMap(): ReadableMap
|
|
47
|
+
|
|
48
|
+
override fun recycle() {
|
|
49
|
+
// Noop - nothing to recycle since there is no pooling
|
|
50
|
+
}
|
|
51
|
+
}
|
package/ReactAndroid/src/main/java/com/facebook/react/devsupport/CxxInspectorPackagerConnection.java
CHANGED
|
@@ -13,7 +13,6 @@ import androidx.annotation.Nullable;
|
|
|
13
13
|
import com.facebook.jni.HybridData;
|
|
14
14
|
import com.facebook.proguard.annotations.DoNotStrip;
|
|
15
15
|
import java.io.Closeable;
|
|
16
|
-
import java.util.OptionalInt;
|
|
17
16
|
import java.util.concurrent.TimeUnit;
|
|
18
17
|
import okhttp3.OkHttpClient;
|
|
19
18
|
import okhttp3.Request;
|
|
@@ -47,7 +46,7 @@ import okhttp3.WebSocketListener;
|
|
|
47
46
|
private static class WebSocketDelegate implements Closeable {
|
|
48
47
|
private final HybridData mHybridData;
|
|
49
48
|
|
|
50
|
-
public native void didFailWithError(
|
|
49
|
+
public native void didFailWithError(@Nullable Integer posixCode, String error);
|
|
51
50
|
|
|
52
51
|
public native void didReceiveMessage(String message);
|
|
53
52
|
|
|
@@ -103,8 +102,7 @@ import okhttp3.WebSocketListener;
|
|
|
103
102
|
@Override
|
|
104
103
|
public void onFailure(WebSocket _unused, Throwable t, @Nullable Response response) {
|
|
105
104
|
@Nullable String message = t.getMessage();
|
|
106
|
-
delegate.didFailWithError(
|
|
107
|
-
OptionalInt.empty(), message != null ? message : "<Unknown error>");
|
|
105
|
+
delegate.didFailWithError(null, message != null ? message : "<Unknown error>");
|
|
108
106
|
// "No further calls to this listener will be made." -OkHttp docs for
|
|
109
107
|
// WebSocketListener.onFailure
|
|
110
108
|
delegate.close();
|
|
@@ -161,14 +161,11 @@ class TurboModuleInteropUtils {
|
|
|
161
161
|
|| paramClass == Callback.class
|
|
162
162
|
|| paramClass == Promise.class
|
|
163
163
|
|| paramClass == ReadableMap.class
|
|
164
|
-
|| paramClass == ReadableArray.class
|
|
164
|
+
|| paramClass == ReadableArray.class
|
|
165
|
+
|| paramClass == Dynamic.class) {
|
|
165
166
|
return convertClassToJniType(paramClass);
|
|
166
167
|
}
|
|
167
168
|
|
|
168
|
-
if (paramClass == Dynamic.class) {
|
|
169
|
-
// TODO(T145105887): Output warnings that TurboModules doesn't yet support Dynamic arguments
|
|
170
|
-
}
|
|
171
|
-
|
|
172
169
|
throw new ParsingException(
|
|
173
170
|
moduleName,
|
|
174
171
|
methodName,
|
package/ReactAndroid/src/main/java/com/facebook/react/uimanager/drawable/CSSBackgroundDrawable.java
CHANGED
|
@@ -605,6 +605,7 @@ public class CSSBackgroundDrawable extends Drawable {
|
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
// Clip border ONLY if its color is non transparent
|
|
608
|
+
float pathAdjustment = 0f;
|
|
608
609
|
if (Color.alpha(colorLeft) != 0
|
|
609
610
|
&& Color.alpha(colorTop) != 0
|
|
610
611
|
&& Color.alpha(colorRight) != 0
|
|
@@ -615,6 +616,10 @@ public class CSSBackgroundDrawable extends Drawable {
|
|
|
615
616
|
mInnerClipTempRectForBorderRadius.bottom -= borderWidth.bottom;
|
|
616
617
|
mInnerClipTempRectForBorderRadius.left += borderWidth.left;
|
|
617
618
|
mInnerClipTempRectForBorderRadius.right -= borderWidth.right;
|
|
619
|
+
|
|
620
|
+
// only close gap between border and main path if we draw the border, otherwise
|
|
621
|
+
// we wind up pixelating small pixel-radius curves
|
|
622
|
+
pathAdjustment = mGapBetweenPaths;
|
|
618
623
|
}
|
|
619
624
|
|
|
620
625
|
mTempRectForCenterDrawPath.top += borderWidth.top * 0.5f;
|
|
@@ -661,10 +666,10 @@ public class CSSBackgroundDrawable extends Drawable {
|
|
|
661
666
|
// (mInnerClipTempRectForBorderRadius), ensuring the border can be
|
|
662
667
|
// drawn on top without the gap.
|
|
663
668
|
mBackgroundColorRenderPath.addRoundRect(
|
|
664
|
-
mInnerClipTempRectForBorderRadius.left -
|
|
665
|
-
mInnerClipTempRectForBorderRadius.top -
|
|
666
|
-
mInnerClipTempRectForBorderRadius.right +
|
|
667
|
-
mInnerClipTempRectForBorderRadius.bottom +
|
|
669
|
+
mInnerClipTempRectForBorderRadius.left - pathAdjustment,
|
|
670
|
+
mInnerClipTempRectForBorderRadius.top - pathAdjustment,
|
|
671
|
+
mInnerClipTempRectForBorderRadius.right + pathAdjustment,
|
|
672
|
+
mInnerClipTempRectForBorderRadius.bottom + pathAdjustment,
|
|
668
673
|
new float[] {
|
|
669
674
|
innerTopLeftRadiusX,
|
|
670
675
|
innerTopLeftRadiusY,
|
|
@@ -12,7 +12,7 @@ import android.net.Uri
|
|
|
12
12
|
import java.util.Objects
|
|
13
13
|
|
|
14
14
|
/** Class describing an image source (network URI or resource) and size. */
|
|
15
|
-
public class ImageSource
|
|
15
|
+
public open class ImageSource
|
|
16
16
|
@JvmOverloads
|
|
17
17
|
constructor(
|
|
18
18
|
context: Context,
|
|
@@ -23,12 +23,14 @@ constructor(
|
|
|
23
23
|
) {
|
|
24
24
|
|
|
25
25
|
/** Get the URI for this image - can be either a parsed network URI or a resource URI. */
|
|
26
|
-
public val uri: Uri = computeUri(context)
|
|
26
|
+
public open val uri: Uri = computeUri(context)
|
|
27
27
|
/** Get the area of this image. */
|
|
28
28
|
public val size: Double = width * height
|
|
29
29
|
/** Get whether this image source represents an Android resource or a network URI. */
|
|
30
|
-
public
|
|
31
|
-
|
|
30
|
+
public open val isResource: Boolean
|
|
31
|
+
get() = _isResource
|
|
32
|
+
|
|
33
|
+
private var _isResource: Boolean = false
|
|
32
34
|
|
|
33
35
|
override fun equals(other: Any?): Boolean {
|
|
34
36
|
if (this === other) {
|
|
@@ -58,7 +60,7 @@ constructor(
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
private fun computeLocalUri(context: Context): Uri {
|
|
61
|
-
|
|
63
|
+
_isResource = true
|
|
62
64
|
return ResourceDrawableIdHelper.instance.getResourceDrawableUri(context, source)
|
|
63
65
|
}
|
|
64
66
|
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
#include "JCxxInspectorPackagerConnectionWebSocketDelegate.h"
|
|
9
9
|
|
|
10
|
+
#include <optional>
|
|
11
|
+
|
|
10
12
|
using namespace facebook::jni;
|
|
11
13
|
|
|
12
14
|
namespace facebook::react::jsinspector_modern {
|
|
@@ -17,10 +19,17 @@ JCxxInspectorPackagerConnectionWebSocketDelegate::
|
|
|
17
19
|
: cxxDelegate_(cxxDelegate) {}
|
|
18
20
|
|
|
19
21
|
void JCxxInspectorPackagerConnectionWebSocketDelegate::didFailWithError(
|
|
20
|
-
alias_ref<
|
|
22
|
+
alias_ref<jni::JInteger> posixCode,
|
|
21
23
|
const std::string& error) {
|
|
24
|
+
std::optional<int> posixCodeVal;
|
|
25
|
+
|
|
26
|
+
// Handle @Nullable JInteger param
|
|
27
|
+
if (posixCode.get() != nullptr) {
|
|
28
|
+
posixCodeVal = posixCode->intValue();
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
if (auto delegate = cxxDelegate_.lock()) {
|
|
23
|
-
delegate->didFailWithError(
|
|
32
|
+
delegate->didFailWithError(posixCodeVal, error);
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
|
-
#include "JOptional.h"
|
|
11
|
-
|
|
12
10
|
#include <fbjni/fbjni.h>
|
|
13
11
|
#include <jsinspector-modern/InspectorPackagerConnection.h>
|
|
14
12
|
|
|
@@ -29,7 +27,7 @@ class JCxxInspectorPackagerConnectionWebSocketDelegate
|
|
|
29
27
|
"Lcom/facebook/react/devsupport/CxxInspectorPackagerConnection$WebSocketDelegate;";
|
|
30
28
|
|
|
31
29
|
void didFailWithError(
|
|
32
|
-
jni::alias_ref<
|
|
30
|
+
jni::alias_ref<jni::JInteger> posixCode,
|
|
33
31
|
const std::string& error);
|
|
34
32
|
|
|
35
33
|
void didReceiveMessage(const std::string& message);
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
#include "JDynamicNative.h"
|
|
9
|
+
#include "ReadableNativeArray.h"
|
|
10
|
+
#include "ReadableNativeMap.h"
|
|
11
|
+
|
|
12
|
+
using namespace facebook::jni;
|
|
13
|
+
|
|
14
|
+
namespace facebook::react {
|
|
15
|
+
|
|
16
|
+
jboolean JDynamicNative::isNullNative() {
|
|
17
|
+
return payload_.isNull();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
jni::local_ref<ReadableType> JDynamicNative::getTypeNative() {
|
|
21
|
+
return ReadableType::getType(payload_.type());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
jni::local_ref<jstring> JDynamicNative::asString() {
|
|
25
|
+
return jni::make_jstring(payload_.asString());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
jboolean JDynamicNative::asBoolean() {
|
|
29
|
+
return payload_.asBool();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
jdouble JDynamicNative::asDouble() {
|
|
33
|
+
return payload_.asDouble();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
jni::local_ref<ReadableArray> JDynamicNative::asArray() {
|
|
37
|
+
return jni::adopt_local(reinterpret_cast<ReadableArray::javaobject>(
|
|
38
|
+
ReadableNativeArray::newObjectCxxArgs(payload_).release()));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
jni::local_ref<ReadableMap> JDynamicNative::asMap() {
|
|
42
|
+
return jni::adopt_local(reinterpret_cast<ReadableMap::javaobject>(
|
|
43
|
+
ReadableNativeMap::createWithContents(std::move(payload_)).release()));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "NativeCommon.h"
|
|
11
|
+
#include "ReadableNativeArray.h"
|
|
12
|
+
#include "ReadableNativeMap.h"
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <folly/dynamic.h>
|
|
16
|
+
#include <folly/json.h>
|
|
17
|
+
|
|
18
|
+
namespace facebook::react {
|
|
19
|
+
|
|
20
|
+
struct JDynamic : public jni::JavaClass<JDynamic> {
|
|
21
|
+
constexpr static auto kJavaDescriptor = "Lcom/facebook/react/bridge/Dynamic;";
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
class JDynamicNative : public jni::HybridClass<JDynamicNative, JDynamic> {
|
|
25
|
+
public:
|
|
26
|
+
constexpr static auto kJavaDescriptor =
|
|
27
|
+
"Lcom/facebook/react/bridge/DynamicNative;";
|
|
28
|
+
|
|
29
|
+
JDynamicNative(folly::dynamic payload) : payload_(std::move(payload)) {}
|
|
30
|
+
|
|
31
|
+
static void registerNatives() {
|
|
32
|
+
javaClassStatic()->registerNatives(
|
|
33
|
+
{makeNativeMethod("isNullNative", JDynamicNative::isNullNative),
|
|
34
|
+
makeNativeMethod("getTypeNative", JDynamicNative::getTypeNative),
|
|
35
|
+
makeNativeMethod("asDouble", JDynamicNative::asDouble),
|
|
36
|
+
makeNativeMethod("asBoolean", JDynamicNative::asBoolean),
|
|
37
|
+
makeNativeMethod("asString", JDynamicNative::asString),
|
|
38
|
+
makeNativeMethod("asArray", JDynamicNative::asArray),
|
|
39
|
+
makeNativeMethod("asMap", JDynamicNative::asMap)});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
friend HybridBase;
|
|
44
|
+
|
|
45
|
+
jni::local_ref<ReadableType> getTypeNative();
|
|
46
|
+
jni::local_ref<jstring> asString();
|
|
47
|
+
jboolean asBoolean();
|
|
48
|
+
jdouble asDouble();
|
|
49
|
+
jboolean isNullNative();
|
|
50
|
+
jni::local_ref<ReadableArray> asArray();
|
|
51
|
+
jni::local_ref<ReadableMap> asMap();
|
|
52
|
+
|
|
53
|
+
folly::dynamic payload_;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace facebook::react
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
#include "CatalystInstanceImpl.h"
|
|
16
16
|
#include "CxxModuleWrapperBase.h"
|
|
17
17
|
#include "JCallback.h"
|
|
18
|
+
#include "JDynamicNative.h"
|
|
18
19
|
#include "JInspector.h"
|
|
19
20
|
#include "JReactMarker.h"
|
|
20
21
|
#include "JavaScriptExecutorHolder.h"
|
|
@@ -89,6 +90,7 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|
|
89
90
|
NativeMap::registerNatives();
|
|
90
91
|
ReadableNativeMap::registerNatives();
|
|
91
92
|
WritableNativeMap::registerNatives();
|
|
93
|
+
JDynamicNative::registerNatives();
|
|
92
94
|
JReactMarker::registerNatives();
|
|
93
95
|
JInspector::registerNatives();
|
|
94
96
|
ReactInstanceManagerInspectorTarget::registerNatives();
|
package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include <jsi/JSIDynamic.h>
|
|
20
20
|
#include <react/bridging/Bridging.h>
|
|
21
21
|
#include <react/debug/react_native_assert.h>
|
|
22
|
+
#include <react/jni/JDynamicNative.h>
|
|
22
23
|
#include <react/jni/NativeMap.h>
|
|
23
24
|
#include <react/jni/ReadableNativeMap.h>
|
|
24
25
|
#include <react/jni/WritableNativeMap.h>
|
|
@@ -373,7 +374,9 @@ JNIArgs convertJSIArgsToJNIArgs(
|
|
|
373
374
|
continue;
|
|
374
375
|
}
|
|
375
376
|
|
|
376
|
-
|
|
377
|
+
// Dynamic encapsulates the Null type so we don't want to return null here.
|
|
378
|
+
if ((arg->isNull() && type != "Lcom/facebook/react/bridge/Dynamic;") ||
|
|
379
|
+
arg->isUndefined()) {
|
|
377
380
|
jarg->l = nullptr;
|
|
378
381
|
} else if (type == "Ljava/lang/Double;") {
|
|
379
382
|
if (!arg->isNumber()) {
|
|
@@ -436,6 +439,10 @@ JNIArgs convertJSIArgsToJNIArgs(
|
|
|
436
439
|
auto jParams =
|
|
437
440
|
ReadableNativeMap::createWithContents(std::move(dynamicFromValue));
|
|
438
441
|
jarg->l = makeGlobalIfNecessary(jParams.release());
|
|
442
|
+
} else if (type == "Lcom/facebook/react/bridge/Dynamic;") {
|
|
443
|
+
auto dynamicFromValue = jsi::dynamicFromValue(rt, *arg);
|
|
444
|
+
auto jParams = JDynamicNative::newObjectCxxArgs(dynamicFromValue);
|
|
445
|
+
jarg->l = makeGlobalIfNecessary(jParams.release());
|
|
439
446
|
} else {
|
|
440
447
|
throw JavaTurboModuleInvalidArgumentTypeException(
|
|
441
448
|
type, argIndex, methodName);
|
|
@@ -13,12 +13,14 @@ import android.widget.Toast;
|
|
|
13
13
|
import com.facebook.proguard.annotations.DoNotStrip;
|
|
14
14
|
import com.facebook.react.bridge.Arguments;
|
|
15
15
|
import com.facebook.react.bridge.Callback;
|
|
16
|
+
import com.facebook.react.bridge.Dynamic;
|
|
16
17
|
import com.facebook.react.bridge.Promise;
|
|
17
18
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
19
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
20
|
import com.facebook.react.bridge.ReactMethod;
|
|
20
21
|
import com.facebook.react.bridge.ReadableArray;
|
|
21
22
|
import com.facebook.react.bridge.ReadableMap;
|
|
23
|
+
import com.facebook.react.bridge.ReadableType;
|
|
22
24
|
import com.facebook.react.bridge.WritableArray;
|
|
23
25
|
import com.facebook.react.bridge.WritableMap;
|
|
24
26
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
@@ -155,6 +157,44 @@ public class SampleLegacyModule extends ReactContextBaseJavaModule {
|
|
|
155
157
|
return map;
|
|
156
158
|
}
|
|
157
159
|
|
|
160
|
+
@SuppressWarnings("unused")
|
|
161
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
162
|
+
public WritableMap getDynamic(Dynamic dynamic) {
|
|
163
|
+
WritableNativeMap resultMap = new WritableNativeMap();
|
|
164
|
+
ReadableType type = dynamic.getType();
|
|
165
|
+
if (type == ReadableType.Null) {
|
|
166
|
+
log("getDynamic as Null", dynamic, dynamic);
|
|
167
|
+
resultMap.putString("type", "Null");
|
|
168
|
+
resultMap.putNull("value");
|
|
169
|
+
} else if (type == ReadableType.Boolean) {
|
|
170
|
+
boolean result = dynamic.asBoolean();
|
|
171
|
+
log("getDynamic as Boolean", dynamic, result);
|
|
172
|
+
resultMap.putString("type", "Boolean");
|
|
173
|
+
resultMap.putBoolean("value", result);
|
|
174
|
+
} else if (type == ReadableType.Number) {
|
|
175
|
+
int result = dynamic.asInt();
|
|
176
|
+
log("getDynamic as Number", dynamic, result);
|
|
177
|
+
resultMap.putString("type", "Number");
|
|
178
|
+
resultMap.putInt("value", result);
|
|
179
|
+
} else if (type == ReadableType.String) {
|
|
180
|
+
String result = dynamic.asString();
|
|
181
|
+
log("getDynamic as String", dynamic, result);
|
|
182
|
+
resultMap.putString("type", "String");
|
|
183
|
+
resultMap.putString("value", result);
|
|
184
|
+
} else if (type == ReadableType.Array) {
|
|
185
|
+
ReadableArray result = dynamic.asArray();
|
|
186
|
+
log("getDynamic as Array", dynamic, result);
|
|
187
|
+
resultMap.putString("type", "Array");
|
|
188
|
+
resultMap.putArray("value", result);
|
|
189
|
+
} else if (type == ReadableType.Map) {
|
|
190
|
+
ReadableMap result = dynamic.asMap();
|
|
191
|
+
log("getDynamic as Map", dynamic, result);
|
|
192
|
+
resultMap.putString("type", "Map");
|
|
193
|
+
resultMap.putMap("value", result);
|
|
194
|
+
}
|
|
195
|
+
return resultMap;
|
|
196
|
+
}
|
|
197
|
+
|
|
158
198
|
@DoNotStrip
|
|
159
199
|
@SuppressWarnings("unused")
|
|
160
200
|
@ReactMethod(isBlockingSynchronousMethod = true)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native",
|
|
3
|
-
"version": "0.75.
|
|
3
|
+
"version": "0.75.3",
|
|
4
4
|
"description": "A framework for building native apps using React",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -109,21 +109,22 @@
|
|
|
109
109
|
},
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@jest/create-cache-key-function": "^29.6.3",
|
|
112
|
-
"@react-native-community/cli": "14.
|
|
113
|
-
"@react-native-community/cli-platform-android": "14.
|
|
114
|
-
"@react-native-community/cli-platform-ios": "14.
|
|
115
|
-
"@react-native/assets-registry": "0.75.
|
|
116
|
-
"@react-native/codegen": "0.75.
|
|
117
|
-
"@react-native/community-cli-plugin": "0.75.
|
|
118
|
-
"@react-native/gradle-plugin": "0.75.
|
|
119
|
-
"@react-native/js-polyfills": "0.75.
|
|
120
|
-
"@react-native/normalize-colors": "0.75.
|
|
121
|
-
"@react-native/virtualized-lists": "0.75.
|
|
112
|
+
"@react-native-community/cli": "14.1.0",
|
|
113
|
+
"@react-native-community/cli-platform-android": "14.1.0",
|
|
114
|
+
"@react-native-community/cli-platform-ios": "14.1.0",
|
|
115
|
+
"@react-native/assets-registry": "0.75.3",
|
|
116
|
+
"@react-native/codegen": "0.75.3",
|
|
117
|
+
"@react-native/community-cli-plugin": "0.75.3",
|
|
118
|
+
"@react-native/gradle-plugin": "0.75.3",
|
|
119
|
+
"@react-native/js-polyfills": "0.75.3",
|
|
120
|
+
"@react-native/normalize-colors": "0.75.3",
|
|
121
|
+
"@react-native/virtualized-lists": "0.75.3",
|
|
122
122
|
"abort-controller": "^3.0.0",
|
|
123
123
|
"anser": "^1.4.9",
|
|
124
124
|
"ansi-regex": "^5.0.0",
|
|
125
125
|
"base64-js": "^1.5.1",
|
|
126
126
|
"chalk": "^4.0.0",
|
|
127
|
+
"commander": "^9.4.1",
|
|
127
128
|
"event-target-shim": "^5.0.1",
|
|
128
129
|
"flow-enums-runtime": "^0.0.6",
|
|
129
130
|
"glob": "^7.1.1",
|
package/scripts/bundle.js
CHANGED
|
@@ -31,6 +31,8 @@ program
|
|
|
31
31
|
'npx react-native config',
|
|
32
32
|
)
|
|
33
33
|
.option('--load-config <string>', 'JSON project config')
|
|
34
|
+
.option('--verbose', 'Additional logs', () => true, false)
|
|
35
|
+
.allowUnknownOption()
|
|
34
36
|
.action(async function handleAction() {
|
|
35
37
|
let config = null;
|
|
36
38
|
let options = program.opts();
|
|
@@ -73,6 +73,7 @@ def list_native_modules!(config_command)
|
|
|
73
73
|
found_pods.push({
|
|
74
74
|
"configurations": configurations,
|
|
75
75
|
"name": name,
|
|
76
|
+
"root": package["root"],
|
|
76
77
|
"path": relative_path.to_path,
|
|
77
78
|
"podspec_path": podspec_path,
|
|
78
79
|
"script_phases": script_phases
|
|
@@ -168,7 +169,7 @@ def link_native_modules!(config)
|
|
|
168
169
|
|
|
169
170
|
# Support passing in a path relative to the root of the package
|
|
170
171
|
if phase["path"]
|
|
171
|
-
phase["script"] = File.read(File.expand_path(phase["path"], package[:
|
|
172
|
+
phase["script"] = File.read(File.expand_path(phase["path"], package[:root]))
|
|
172
173
|
phase.delete("path")
|
|
173
174
|
end
|
|
174
175
|
|
|
@@ -225,7 +225,7 @@ function extractSupportedApplePlatforms(dependency, dependencyPath) {
|
|
|
225
225
|
return supportedPlatformsMap;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
function findExternalLibraries(pkgJson) {
|
|
228
|
+
function findExternalLibraries(pkgJson, projectRoot) {
|
|
229
229
|
const dependencies = {
|
|
230
230
|
...pkgJson.dependencies,
|
|
231
231
|
...pkgJson.devDependencies,
|
|
@@ -240,6 +240,7 @@ function findExternalLibraries(pkgJson) {
|
|
|
240
240
|
try {
|
|
241
241
|
const configFilePath = require.resolve(
|
|
242
242
|
path.join(dependency, 'package.json'),
|
|
243
|
+
{paths: [projectRoot]},
|
|
243
244
|
);
|
|
244
245
|
const configFile = JSON.parse(fs.readFileSync(configFilePath));
|
|
245
246
|
const codegenConfigFileDir = path.dirname(configFilePath);
|
|
@@ -533,7 +534,7 @@ function findCodegenEnabledLibraries(pkgJson, projectRoot) {
|
|
|
533
534
|
} else {
|
|
534
535
|
return [
|
|
535
536
|
...projectLibraries,
|
|
536
|
-
...findExternalLibraries(pkgJson),
|
|
537
|
+
...findExternalLibraries(pkgJson, projectRoot),
|
|
537
538
|
...findLibrariesFromReactNativeConfig(projectRoot),
|
|
538
539
|
];
|
|
539
540
|
}
|
|
@@ -12,9 +12,9 @@ set -e
|
|
|
12
12
|
# Given a specific target, retrieve the right architecture for it
|
|
13
13
|
# $1 the target you want to build. Allowed values: iphoneos, iphonesimulator, catalyst, xros, xrsimulator
|
|
14
14
|
function get_architecture {
|
|
15
|
-
if [[ $1 == "iphoneos" || $1 == "xros"
|
|
15
|
+
if [[ $1 == "iphoneos" || $1 == "xros" ]]; then
|
|
16
16
|
echo "arm64"
|
|
17
|
-
elif [[ $1 == "iphonesimulator" ]]; then
|
|
17
|
+
elif [[ $1 == "iphonesimulator" || $1 == "xrsimulator" ]]; then
|
|
18
18
|
echo "x86_64;arm64"
|
|
19
19
|
elif [[ $1 == "catalyst" ]]; then
|
|
20
20
|
echo "x86_64;arm64"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,29 +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
|
-
#include "JOptional.h"
|
|
9
|
-
|
|
10
|
-
namespace facebook::react {
|
|
11
|
-
|
|
12
|
-
int JOptionalInt::getAsInt() const {
|
|
13
|
-
static auto method = javaClassStatic()->getMethod<jint()>("getAsInt");
|
|
14
|
-
return method(self());
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
bool JOptionalInt::isPresent() const {
|
|
18
|
-
static auto method = javaClassStatic()->getMethod<jboolean()>("isPresent");
|
|
19
|
-
return method(self());
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
JOptionalInt::operator std::optional<int>() const {
|
|
23
|
-
if (!isPresent()) {
|
|
24
|
-
return {};
|
|
25
|
-
}
|
|
26
|
-
return getAsInt();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
} // namespace facebook::react
|
|
@@ -1,27 +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
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <fbjni/fbjni.h>
|
|
11
|
-
|
|
12
|
-
#include <optional>
|
|
13
|
-
|
|
14
|
-
// TODO(moti): Consider moving this into fbjni
|
|
15
|
-
|
|
16
|
-
namespace facebook::react {
|
|
17
|
-
|
|
18
|
-
class JOptionalInt : public facebook::jni::JavaClass<JOptionalInt> {
|
|
19
|
-
public:
|
|
20
|
-
static auto constexpr kJavaDescriptor = "Ljava/util/OptionalInt;";
|
|
21
|
-
|
|
22
|
-
int getAsInt() const;
|
|
23
|
-
bool isPresent() const;
|
|
24
|
-
operator std::optional<int>() const;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
} // namespace facebook::react
|