react-native 0.72.0 → 0.72.2
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/LinkingIOS/React-RCTLinking.podspec +4 -1
- package/Libraries/Network/React-RCTNetwork.podspec +5 -1
- package/Libraries/Settings/React-RCTSettings.podspec +4 -1
- package/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +1 -1
- package/Libraries/Vibration/React-RCTVibration.podspec +3 -1
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/React-CoreModules.podspec +1 -1
- package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +3 -0
- package/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +2 -0
- package/React/Fabric/Mounting/RCTComponentViewFactory.mm +22 -3
- package/React-Core.podspec +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java +14 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/network/RequestBodyUtil.java +16 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/FontMetricsUtil.java +3 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +4 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +4 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +8 -2
- package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +8 -2
- package/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +15 -11
- package/ReactCommon/React-Fabric.podspec +3 -2
- package/ReactCommon/React-rncore.podspec +12 -0
- package/ReactCommon/ReactCommon.podspec +1 -1
- package/ReactCommon/cxxreact/CMakeLists.txt +2 -1
- package/ReactCommon/cxxreact/Instance.cpp +25 -19
- package/ReactCommon/cxxreact/React-cxxreact.podspec +2 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/hermes/inspector/CMakeLists.txt +8 -0
- package/ReactCommon/jsi/React-jsi.podspec +2 -1
- package/ReactCommon/react/config/ReactNativeConfig.cpp +0 -3
- package/ReactCommon/react/debug/React-debug.podspec +3 -2
- package/ReactCommon/react/nativemodule/core/platform/ios/React-NativeModulesApple.podspec +1 -1
- package/ReactCommon/react/nativemodule/samples/ReactCommon-Samples.podspec +1 -1
- package/ReactCommon/react/renderer/components/image/ImageShadowNode.h +1 -1
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +26 -7
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +4 -0
- package/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +4 -5
- package/ReactCommon/react/renderer/graphics/React-graphics.podspec +4 -2
- package/ReactCommon/react/renderer/imagemanager/ImageRequest.h +5 -8
- package/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageManager.cpp +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp +5 -2
- package/ReactCommon/react/renderer/imagemanager/platform/ios/React-ImageManager.podspec +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequest.cpp +6 -10
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImageManager.mm +2 -4
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTSyncImageManager.mm +2 -4
- package/ReactCommon/react/renderer/runtimescheduler/React-runtimescheduler.podspec +1 -1
- package/ReactCommon/react/utils/React-utils.podspec +4 -4
- package/ReactCommon/react/utils/SharedFunction.h +6 -4
- package/package.json +8 -8
- package/scripts/cocoapods/__tests__/codegen_utils-test.rb +2 -2
- package/scripts/cocoapods/codegen_utils.rb +1 -1
- package/scripts/react-native-xcode.sh +1 -1
- package/scripts/react_native_pods.rb +1 -1
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/README.md +79 -0
- package/template/package.json +3 -4
|
@@ -28,7 +28,10 @@ header_search_paths = [
|
|
|
28
28
|
if ENV["USE_FRAMEWORKS"]
|
|
29
29
|
header_search_paths = header_search_paths.concat([
|
|
30
30
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
|
31
|
-
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\""
|
|
31
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"",
|
|
32
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers/build/generated/ios\"",
|
|
33
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers/build/generated/ios\"",
|
|
34
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers\""
|
|
32
35
|
])
|
|
33
36
|
end
|
|
34
37
|
|
|
@@ -28,7 +28,11 @@ header_search_paths = [
|
|
|
28
28
|
if ENV["USE_FRAMEWORKS"]
|
|
29
29
|
header_search_paths = header_search_paths.concat([
|
|
30
30
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
|
31
|
-
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\""
|
|
31
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"",
|
|
32
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers/build/generated/ios\"",
|
|
33
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers/build/generated/ios\"",
|
|
34
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers\"",
|
|
35
|
+
|
|
32
36
|
])
|
|
33
37
|
end
|
|
34
38
|
|
|
@@ -28,7 +28,10 @@ header_search_paths = [
|
|
|
28
28
|
if ENV["USE_FRAMEWORKS"]
|
|
29
29
|
header_search_paths = header_search_paths.concat([
|
|
30
30
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
|
31
|
-
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\""
|
|
31
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"",
|
|
32
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers/build/generated/ios\"",
|
|
33
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers/build/generated/ios\"",
|
|
34
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers\"",
|
|
32
35
|
])
|
|
33
36
|
end
|
|
34
37
|
|
|
@@ -256,7 +256,7 @@ static void *TextFieldSelectionObservingContext = &TextFieldSelectionObservingCo
|
|
|
256
256
|
|
|
257
257
|
- (void)textViewDidChange:(__unused UITextView *)textView
|
|
258
258
|
{
|
|
259
|
-
if (_ignoreNextTextInputCall) {
|
|
259
|
+
if (_ignoreNextTextInputCall && [_lastStringStateWasUpdatedWith isEqual:_backedTextInputView.attributedText]) {
|
|
260
260
|
_ignoreNextTextInputCall = NO;
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
@@ -28,7 +28,9 @@ header_search_paths = [
|
|
|
28
28
|
if ENV["USE_FRAMEWORKS"]
|
|
29
29
|
header_search_paths = header_search_paths.concat([
|
|
30
30
|
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
|
31
|
-
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\""
|
|
31
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\"",
|
|
32
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers/build/generated/ios\"",
|
|
33
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers\""
|
|
32
34
|
])
|
|
33
35
|
end
|
|
34
36
|
|
package/React/Base/RCTVersion.m
CHANGED
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
|
|
19
19
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
20
20
|
folly_version = '2021.07.22.00'
|
|
21
|
-
socket_rocket_version = '0.6.
|
|
21
|
+
socket_rocket_version = '0.6.1'
|
|
22
22
|
|
|
23
23
|
header_search_paths = [
|
|
24
24
|
"\"$(PODS_TARGET_SRCROOT)/React/CoreModules\"",
|
|
@@ -109,6 +109,9 @@ using namespace facebook::react;
|
|
|
109
109
|
// This will only become issue if we decouple life cycle of a
|
|
110
110
|
// ShadowNode from ComponentView, which is not something we do now.
|
|
111
111
|
imageRequest.cancel();
|
|
112
|
+
imageRequest.cancel();
|
|
113
|
+
imageRequest.cancel();
|
|
114
|
+
imageRequest.cancel();
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
- (void)dealloc
|
|
26
26
|
{
|
|
27
|
+
[_coordinator removeViewFromRegistryWithTag:_tag];
|
|
27
28
|
[_paperView removeFromSuperview];
|
|
28
29
|
[_coordinator removeObserveForTag:_tag];
|
|
29
30
|
}
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
weakSelf.eventInterceptor(eventName, event);
|
|
40
41
|
}
|
|
41
42
|
}];
|
|
43
|
+
[_coordinator addViewToRegistry:_paperView withTag:_tag];
|
|
42
44
|
}
|
|
43
45
|
return _paperView;
|
|
44
46
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
#import <React/RCTAssert.h>
|
|
11
11
|
#import <React/RCTConversions.h>
|
|
12
|
+
#import <React/RCTLog.h>
|
|
12
13
|
|
|
13
14
|
#import <butter/map.h>
|
|
14
15
|
#import <butter/set.h>
|
|
@@ -105,16 +106,21 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
|
|
|
105
106
|
return YES;
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
// Paper name: we prepare this variables to warn the user
|
|
110
|
+
// when the component is registered in both Fabric and in the
|
|
111
|
+
// interop layer, so they can remove that
|
|
112
|
+
NSString *componentNameString = RCTNSStringFromString(name);
|
|
113
|
+
BOOL isRegisteredInInteropLayer = [RCTLegacyViewManagerInteropComponentView isSupported:componentNameString];
|
|
114
|
+
|
|
108
115
|
// Fallback 1: Call provider function for component view class.
|
|
109
116
|
Class<RCTComponentViewProtocol> klass = RCTComponentViewClassWithName(name.c_str());
|
|
110
117
|
if (klass) {
|
|
111
|
-
[self registerComponentViewClass:klass];
|
|
118
|
+
[self registerComponentViewClass:klass andWarnIfNeeded:isRegisteredInInteropLayer];
|
|
112
119
|
return YES;
|
|
113
120
|
}
|
|
114
121
|
|
|
115
122
|
// Fallback 2: Try to use Paper Interop.
|
|
116
|
-
|
|
117
|
-
if ([RCTLegacyViewManagerInteropComponentView isSupported:componentNameString]) {
|
|
123
|
+
if (isRegisteredInInteropLayer) {
|
|
118
124
|
RCTLogNewArchitectureValidation(
|
|
119
125
|
RCTNotAllowedInBridgeless,
|
|
120
126
|
self,
|
|
@@ -203,4 +209,17 @@ static Class<RCTComponentViewProtocol> RCTComponentViewClassWithName(const char
|
|
|
203
209
|
return _providerRegistry.createComponentDescriptorRegistry(parameters);
|
|
204
210
|
}
|
|
205
211
|
|
|
212
|
+
#pragma mark - Private
|
|
213
|
+
|
|
214
|
+
- (void)registerComponentViewClass:(Class<RCTComponentViewProtocol>)componentViewClass
|
|
215
|
+
andWarnIfNeeded:(BOOL)isRegisteredInInteropLayer
|
|
216
|
+
{
|
|
217
|
+
[self registerComponentViewClass:componentViewClass];
|
|
218
|
+
if (isRegisteredInInteropLayer) {
|
|
219
|
+
RCTLogWarn(
|
|
220
|
+
@"Component with class %@ has been registered in both the New Architecture Renderer and in the Interop Layer.\nPlease remove it from the Interop Layer",
|
|
221
|
+
componentViewClass);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
206
225
|
@end
|
package/React-Core.podspec
CHANGED
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
|
|
19
19
|
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
20
20
|
folly_version = '2021.07.22.00'
|
|
21
|
-
socket_rocket_version = '0.6.
|
|
21
|
+
socket_rocket_version = '0.6.1'
|
|
22
22
|
boost_compiler_flags = '-Wno-documentation'
|
|
23
23
|
|
|
24
24
|
use_hermes = ENV['USE_HERMES'] == '1'
|
package/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java
CHANGED
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
package com.facebook.react.animated;
|
|
9
9
|
|
|
10
|
+
import com.facebook.common.logging.FLog;
|
|
10
11
|
import com.facebook.react.bridge.ReadableArray;
|
|
11
12
|
import com.facebook.react.bridge.ReadableMap;
|
|
12
13
|
import com.facebook.react.bridge.ReadableType;
|
|
14
|
+
import com.facebook.react.common.ReactConstants;
|
|
15
|
+
import com.facebook.react.common.build.ReactBuildConfig;
|
|
13
16
|
|
|
14
17
|
/**
|
|
15
18
|
* Implementation of {@link AnimationDriver} which provides a support for simple time-based
|
|
@@ -70,7 +73,17 @@ class FrameBasedAnimationDriver extends AnimationDriver {
|
|
|
70
73
|
long timeFromStartMillis = (frameTimeNanos - mStartFrameTimeNanos) / 1000000;
|
|
71
74
|
int frameIndex = (int) Math.round(timeFromStartMillis / FRAME_TIME_MILLIS);
|
|
72
75
|
if (frameIndex < 0) {
|
|
73
|
-
|
|
76
|
+
String message =
|
|
77
|
+
"Calculated frame index should never be lower than 0. Called with frameTimeNanos "
|
|
78
|
+
+ frameTimeNanos
|
|
79
|
+
+ " and mStartFrameTimeNanos "
|
|
80
|
+
+ mStartFrameTimeNanos;
|
|
81
|
+
if (ReactBuildConfig.DEBUG) {
|
|
82
|
+
throw new IllegalStateException(message);
|
|
83
|
+
} else {
|
|
84
|
+
FLog.w(ReactConstants.TAG, message);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
74
87
|
} else if (mHasFinished) {
|
|
75
88
|
// nothing to do here
|
|
76
89
|
return;
|
|
@@ -29,7 +29,6 @@ import java.nio.channels.ReadableByteChannel;
|
|
|
29
29
|
import java.util.zip.GZIPOutputStream;
|
|
30
30
|
import okhttp3.MediaType;
|
|
31
31
|
import okhttp3.RequestBody;
|
|
32
|
-
import okhttp3.internal.Util;
|
|
33
32
|
import okio.BufferedSink;
|
|
34
33
|
import okio.ByteString;
|
|
35
34
|
import okio.Okio;
|
|
@@ -122,6 +121,21 @@ import okio.Source;
|
|
|
122
121
|
return RequestBody.create(mediaType, gzipByteArrayOutputStream.toByteArray());
|
|
123
122
|
}
|
|
124
123
|
|
|
124
|
+
/**
|
|
125
|
+
* Reference:
|
|
126
|
+
* https://github.com/square/okhttp/blob/8c8c3dbcfa91e28de2e13975ec414e07f153fde4/okhttp/src/commonMain/kotlin/okhttp3/internal/-UtilCommon.kt#L281-L288
|
|
127
|
+
* Checked exceptions will be ignored
|
|
128
|
+
*/
|
|
129
|
+
private static void closeQuietly(Source source) {
|
|
130
|
+
try {
|
|
131
|
+
source.close();
|
|
132
|
+
} catch (RuntimeException e) {
|
|
133
|
+
throw e;
|
|
134
|
+
} catch (Exception e) {
|
|
135
|
+
// noop.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
125
139
|
/** Creates a RequestBody from a mediaType and inputStream given. */
|
|
126
140
|
public static RequestBody create(final MediaType mediaType, final InputStream inputStream) {
|
|
127
141
|
return new RequestBody() {
|
|
@@ -146,7 +160,7 @@ import okio.Source;
|
|
|
146
160
|
source = Okio.source(inputStream);
|
|
147
161
|
sink.writeAll(source);
|
|
148
162
|
} finally {
|
|
149
|
-
|
|
163
|
+
closeQuietly(source);
|
|
150
164
|
}
|
|
151
165
|
}
|
|
152
166
|
};
|
|
@@ -42,12 +42,14 @@ public class FontMetricsUtil {
|
|
|
42
42
|
X_HEIGHT_MEASUREMENT_TEXT, 0, X_HEIGHT_MEASUREMENT_TEXT.length(), xHeightBounds);
|
|
43
43
|
double xHeight = xHeightBounds.height() / AMPLIFICATION_FACTOR / dm.density;
|
|
44
44
|
for (int i = 0; i < layout.getLineCount(); i++) {
|
|
45
|
+
boolean endsWithNewLine = text.length() > 0 && text.charAt(layout.getLineEnd(i) - 1) == '\n';
|
|
46
|
+
float lineWidth = endsWithNewLine ? layout.getLineMax(i) : layout.getLineWidth(i);
|
|
45
47
|
Rect bounds = new Rect();
|
|
46
48
|
layout.getLineBounds(i, bounds);
|
|
47
49
|
WritableMap line = Arguments.createMap();
|
|
48
50
|
line.putDouble("x", layout.getLineLeft(i) / dm.density);
|
|
49
51
|
line.putDouble("y", bounds.top / dm.density);
|
|
50
|
-
line.putDouble("width",
|
|
52
|
+
line.putDouble("width", lineWidth / dm.density);
|
|
51
53
|
line.putDouble("height", bounds.height() / dm.density);
|
|
52
54
|
line.putDouble("descender", layout.getLineDescent(i) / dm.density);
|
|
53
55
|
line.putDouble("ascender", -layout.getLineAscent(i) / dm.density);
|
|
@@ -135,7 +135,10 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
|
|
135
135
|
layoutWidth = width;
|
|
136
136
|
} else {
|
|
137
137
|
for (int lineIndex = 0; lineIndex < lineCount; lineIndex++) {
|
|
138
|
-
|
|
138
|
+
boolean endsWithNewLine =
|
|
139
|
+
text.length() > 0 && text.charAt(layout.getLineEnd(lineIndex) - 1) == '\n';
|
|
140
|
+
float lineWidth =
|
|
141
|
+
endsWithNewLine ? layout.getLineMax(lineIndex) : layout.getLineWidth(lineIndex);
|
|
139
142
|
if (lineWidth > layoutWidth) {
|
|
140
143
|
layoutWidth = lineWidth;
|
|
141
144
|
}
|
|
@@ -264,11 +264,14 @@ public class ReactTextView extends AppCompatTextView implements ReactCompoundVie
|
|
|
264
264
|
// the last offset in the layout will result in an endless loop. Work around
|
|
265
265
|
// this bug by avoiding getPrimaryHorizontal in that case.
|
|
266
266
|
if (start == text.length() - 1) {
|
|
267
|
+
boolean endsWithNewLine =
|
|
268
|
+
text.length() > 0 && text.charAt(layout.getLineEnd(line) - 1) == '\n';
|
|
269
|
+
float lineWidth = endsWithNewLine ? layout.getLineMax(line) : layout.getLineWidth(line);
|
|
267
270
|
placeholderHorizontalPosition =
|
|
268
271
|
isRtlParagraph
|
|
269
272
|
// Equivalent to `layout.getLineLeft(line)` but `getLineLeft` returns incorrect
|
|
270
273
|
// values when the paragraph is RTL and `setSingleLine(true)`.
|
|
271
|
-
? textViewWidth - (int)
|
|
274
|
+
? textViewWidth - (int) lineWidth
|
|
272
275
|
: (int) layout.getLineRight(line) - width;
|
|
273
276
|
} else {
|
|
274
277
|
// The direction of the paragraph may not be exactly the direction the string is heading
|
|
@@ -397,7 +397,10 @@ public class TextLayoutManager {
|
|
|
397
397
|
calculatedWidth = width;
|
|
398
398
|
} else {
|
|
399
399
|
for (int lineIndex = 0; lineIndex < calculatedLineCount; lineIndex++) {
|
|
400
|
-
|
|
400
|
+
boolean endsWithNewLine =
|
|
401
|
+
text.length() > 0 && text.charAt(layout.getLineEnd(lineIndex) - 1) == '\n';
|
|
402
|
+
float lineWidth =
|
|
403
|
+
endsWithNewLine ? layout.getLineMax(lineIndex) : layout.getLineWidth(lineIndex);
|
|
401
404
|
if (lineWidth > calculatedWidth) {
|
|
402
405
|
calculatedWidth = lineWidth;
|
|
403
406
|
}
|
|
@@ -452,11 +455,14 @@ public class TextLayoutManager {
|
|
|
452
455
|
// the last offset in the layout will result in an endless loop. Work around
|
|
453
456
|
// this bug by avoiding getPrimaryHorizontal in that case.
|
|
454
457
|
if (start == text.length() - 1) {
|
|
458
|
+
boolean endsWithNewLine =
|
|
459
|
+
text.length() > 0 && text.charAt(layout.getLineEnd(line) - 1) == '\n';
|
|
460
|
+
float lineWidth = endsWithNewLine ? layout.getLineMax(line) : layout.getLineWidth(line);
|
|
455
461
|
placeholderLeftPosition =
|
|
456
462
|
isRtlParagraph
|
|
457
463
|
// Equivalent to `layout.getLineLeft(line)` but `getLineLeft` returns incorrect
|
|
458
464
|
// values when the paragraph is RTL and `setSingleLine(true)`.
|
|
459
|
-
? calculatedWidth -
|
|
465
|
+
? calculatedWidth - lineWidth
|
|
460
466
|
: layout.getLineRight(line) - placeholderWidth;
|
|
461
467
|
} else {
|
|
462
468
|
// The direction of the paragraph may not be exactly the direction the string is heading
|
package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java
CHANGED
|
@@ -411,7 +411,10 @@ public class TextLayoutManagerMapBuffer {
|
|
|
411
411
|
calculatedWidth = width;
|
|
412
412
|
} else {
|
|
413
413
|
for (int lineIndex = 0; lineIndex < calculatedLineCount; lineIndex++) {
|
|
414
|
-
|
|
414
|
+
boolean endsWithNewLine =
|
|
415
|
+
text.length() > 0 && text.charAt(layout.getLineEnd(lineIndex) - 1) == '\n';
|
|
416
|
+
float lineWidth =
|
|
417
|
+
endsWithNewLine ? layout.getLineMax(lineIndex) : layout.getLineWidth(lineIndex);
|
|
415
418
|
if (lineWidth > calculatedWidth) {
|
|
416
419
|
calculatedWidth = lineWidth;
|
|
417
420
|
}
|
|
@@ -466,12 +469,15 @@ public class TextLayoutManagerMapBuffer {
|
|
|
466
469
|
// the last offset in the layout will result in an endless loop. Work around
|
|
467
470
|
// this bug by avoiding getPrimaryHorizontal in that case.
|
|
468
471
|
if (start == text.length() - 1) {
|
|
472
|
+
boolean endsWithNewLine =
|
|
473
|
+
text.length() > 0 && text.charAt(layout.getLineEnd(line) - 1) == '\n';
|
|
474
|
+
float lineWidth = endsWithNewLine ? layout.getLineMax(line) : layout.getLineWidth(line);
|
|
469
475
|
placeholderLeftPosition =
|
|
470
476
|
isRtlParagraph
|
|
471
477
|
// Equivalent to `layout.getLineLeft(line)` but `getLineLeft` returns
|
|
472
478
|
// incorrect
|
|
473
479
|
// values when the paragraph is RTL and `setSingleLine(true)`.
|
|
474
|
-
? calculatedWidth -
|
|
480
|
+
? calculatedWidth - lineWidth
|
|
475
481
|
: layout.getLineRight(line) - placeholderWidth;
|
|
476
482
|
} else {
|
|
477
483
|
// The direction of the paragraph may not be exactly the direction the string is
|
|
@@ -418,8 +418,11 @@ CatalystInstanceImpl::getNativeCallInvokerHolder() {
|
|
|
418
418
|
jni::alias_ref<JRuntimeExecutor::javaobject>
|
|
419
419
|
CatalystInstanceImpl::getRuntimeExecutor() {
|
|
420
420
|
if (!runtimeExecutor_) {
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
auto executor = instance_->getRuntimeExecutor();
|
|
422
|
+
if (executor) {
|
|
423
|
+
runtimeExecutor_ =
|
|
424
|
+
jni::make_global(JRuntimeExecutor::newObjectCxxArgs(executor));
|
|
425
|
+
}
|
|
423
426
|
}
|
|
424
427
|
return runtimeExecutor_;
|
|
425
428
|
}
|
|
@@ -428,15 +431,16 @@ jni::alias_ref<JRuntimeScheduler::javaobject>
|
|
|
428
431
|
CatalystInstanceImpl::getRuntimeScheduler() {
|
|
429
432
|
if (!runtimeScheduler_) {
|
|
430
433
|
auto runtimeExecutor = instance_->getRuntimeExecutor();
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
434
|
+
if (runtimeExecutor) {
|
|
435
|
+
auto runtimeScheduler =
|
|
436
|
+
std::make_shared<RuntimeScheduler>(runtimeExecutor);
|
|
437
|
+
runtimeScheduler_ = jni::make_global(
|
|
438
|
+
JRuntimeScheduler::newObjectCxxArgs(runtimeScheduler));
|
|
439
|
+
runtimeExecutor([scheduler =
|
|
440
|
+
std::move(runtimeScheduler)](jsi::Runtime &runtime) {
|
|
441
|
+
RuntimeSchedulerBinding::createAndInstallIfNeeded(runtime, scheduler);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
440
444
|
}
|
|
441
445
|
|
|
442
446
|
return runtimeScheduler_;
|
|
@@ -33,10 +33,11 @@ Pod::Spec.new do |s|
|
|
|
33
33
|
s.source = source
|
|
34
34
|
s.source_files = "dummyFile.cpp"
|
|
35
35
|
s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES",
|
|
36
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
36
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
37
|
+
"DEFINES_MODULE" => "YES" }
|
|
37
38
|
|
|
38
39
|
if ENV['USE_FRAMEWORKS']
|
|
39
|
-
s.header_mappings_dir = './'
|
|
40
|
+
s.header_mappings_dir = File.absolute_path('./')
|
|
40
41
|
s.module_name = 'React_Fabric'
|
|
41
42
|
end
|
|
42
43
|
|
|
@@ -26,6 +26,17 @@ react_native_dependency_path = ENV['REACT_NATIVE_PATH']
|
|
|
26
26
|
# Relative path to react native from current podspec
|
|
27
27
|
react_native_sources_path = '..'
|
|
28
28
|
|
|
29
|
+
header_search_paths = [
|
|
30
|
+
"\"$(PODS_TARGET_SRCROOT)\"",
|
|
31
|
+
"\"$(PODS_TARGET_SRCROOT)/ReactCommon\"",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
if ENV["USE_FRAMEWORKS"]
|
|
35
|
+
header_search_paths = header_search_paths.concat([
|
|
36
|
+
"\"$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"",
|
|
37
|
+
])
|
|
38
|
+
end
|
|
39
|
+
|
|
29
40
|
Pod::Spec.new do |s|
|
|
30
41
|
s.name = "React-rncore"
|
|
31
42
|
s.version = version
|
|
@@ -37,6 +48,7 @@ Pod::Spec.new do |s|
|
|
|
37
48
|
s.source = source
|
|
38
49
|
s.source_files = "dummyFile.cpp"
|
|
39
50
|
s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES",
|
|
51
|
+
"HEADER_SEARCH_PATHS" => header_search_paths.join(' '),
|
|
40
52
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
|
|
41
53
|
|
|
42
54
|
|
|
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
|
|
|
37
37
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
38
38
|
"GCC_WARN_PEDANTIC" => "YES" }
|
|
39
39
|
if ENV['USE_FRAMEWORKS']
|
|
40
|
-
s.header_mappings_dir =
|
|
40
|
+
s.header_mappings_dir = File.absolute_path("./")
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
# TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#include <cxxreact/JSIndexedRAMBundle.h>
|
|
22
22
|
#include <folly/MoveWrapper.h>
|
|
23
23
|
#include <folly/json.h>
|
|
24
|
+
#include <react/debug/react_native_assert.h>
|
|
24
25
|
|
|
25
26
|
#include <glog/logging.h>
|
|
26
27
|
|
|
@@ -212,26 +213,31 @@ std::shared_ptr<CallInvoker> Instance::getJSCallInvoker() {
|
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
RuntimeExecutor Instance::getRuntimeExecutor() {
|
|
215
|
-
|
|
216
|
+
// HACK: RuntimeExecutor is not compatible with non-JSIExecutor, we return
|
|
217
|
+
// a null callback, which the caller should handle.
|
|
218
|
+
if (!getJavaScriptContext()) {
|
|
219
|
+
return nullptr;
|
|
220
|
+
}
|
|
216
221
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
222
|
+
std::weak_ptr<NativeToJsBridge> weakNativeToJsBridge = nativeToJsBridge_;
|
|
223
|
+
return [weakNativeToJsBridge](
|
|
224
|
+
std::function<void(jsi::Runtime & runtime)> &&callback) {
|
|
225
|
+
if (auto strongNativeToJsBridge = weakNativeToJsBridge.lock()) {
|
|
226
|
+
strongNativeToJsBridge->runOnExecutorQueue(
|
|
227
|
+
[callback = std::move(callback)](JSExecutor *executor) {
|
|
228
|
+
// Assumes the underlying executor is a JSIExecutor
|
|
229
|
+
jsi::Runtime *runtime =
|
|
230
|
+
(jsi::Runtime *)executor->getJavaScriptContext();
|
|
231
|
+
try {
|
|
232
|
+
react_native_assert(runtime != nullptr);
|
|
233
|
+
callback(*runtime);
|
|
234
|
+
executor->flush();
|
|
235
|
+
} catch (jsi::JSError &originalError) {
|
|
236
|
+
handleJSError(*runtime, originalError, true);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
};
|
|
235
241
|
}
|
|
236
242
|
|
|
237
243
|
std::shared_ptr<CallInvoker> Instance::getDecoratedNativeCallInvoker(
|
|
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
|
|
|
33
33
|
s.source_files = "*.{cpp,h}"
|
|
34
34
|
s.exclude_files = "SampleCxxModule.*"
|
|
35
35
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
|
36
|
-
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers\"",
|
|
36
|
+
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers\" \"$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers\"",
|
|
37
37
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
|
|
38
38
|
s.header_dir = "cxxreact"
|
|
39
39
|
|
|
@@ -47,6 +47,7 @@ Pod::Spec.new do |s|
|
|
|
47
47
|
s.dependency "React-perflogger", version
|
|
48
48
|
s.dependency "React-jsi", version
|
|
49
49
|
s.dependency "React-logger", version
|
|
50
|
+
s.dependency "React-debug", version
|
|
50
51
|
|
|
51
52
|
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
|
|
52
53
|
s.dependency 'hermes-engine'
|
|
@@ -20,6 +20,14 @@ target_compile_options(
|
|
|
20
20
|
-fexceptions
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
+
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
|
24
|
+
target_compile_options(
|
|
25
|
+
hermes_inspector
|
|
26
|
+
PRIVATE
|
|
27
|
+
-DHERMES_ENABLE_DEBUGGER=1
|
|
28
|
+
)
|
|
29
|
+
endif()
|
|
30
|
+
|
|
23
31
|
target_include_directories(hermes_inspector PUBLIC ${REACT_COMMON_DIR})
|
|
24
32
|
target_link_libraries(hermes_inspector
|
|
25
33
|
jsinspector
|
|
@@ -36,7 +36,8 @@ Pod::Spec.new do |s|
|
|
|
36
36
|
|
|
37
37
|
s.header_dir = "jsi"
|
|
38
38
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
|
39
|
-
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\""
|
|
39
|
+
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"",
|
|
40
|
+
"DEFINES_MODULE" => "YES" }
|
|
40
41
|
|
|
41
42
|
s.dependency "boost", "1.76.0"
|
|
42
43
|
s.dependency "DoubleConversion"
|
|
@@ -24,9 +24,6 @@ bool EmptyReactNativeConfig::getBool(const std::string ¶m) const {
|
|
|
24
24
|
if (param == "react_fabric:enabled_layout_animations_ios") {
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
|
-
if (param == "react_fabric:enable_nstextstorage_caching") {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
27
|
return false;
|
|
31
28
|
}
|
|
32
29
|
|
|
@@ -27,10 +27,11 @@ Pod::Spec.new do |s|
|
|
|
27
27
|
s.source = source
|
|
28
28
|
s.source_files = "**/*.{cpp,h}"
|
|
29
29
|
s.header_dir = "react/debug"
|
|
30
|
-
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
30
|
+
s.pod_target_xcconfig = { "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
31
|
+
"DEFINES_MODULE" => "YES" }
|
|
31
32
|
|
|
32
33
|
if ENV['USE_FRAMEWORKS']
|
|
33
34
|
s.module_name = "React_debug"
|
|
34
|
-
s.header_mappings_dir = "../.."
|
|
35
|
+
s.header_mappings_dir = File.absolute_path("../..")
|
|
35
36
|
end
|
|
36
37
|
end
|
|
@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
|
|
|
37
37
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
38
38
|
"GCC_WARN_PEDANTIC" => "YES" }
|
|
39
39
|
if ENV['USE_FRAMEWORKS']
|
|
40
|
-
s.header_mappings_dir = './'
|
|
40
|
+
s.header_mappings_dir = File.absolute_path('./')
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
s.source_files = "ReactCommon/**/*.{mm,cpp,h}"
|