react-native 0.71.0-rc.0 → 0.71.0-rc.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/Text/BaseText/RCTBaseTextViewManager.m +1 -0
- package/Libraries/Text/RCTTextAttributes.h +2 -0
- package/Libraries/Text/RCTTextAttributes.m +9 -1
- package/Libraries/Text/Text/RCTDynamicTypeRamp.h +37 -0
- package/Libraries/Text/Text/RCTDynamicTypeRamp.m +82 -0
- package/Libraries/Text/Text.d.ts +17 -0
- package/Libraries/Text/TextNativeComponent.js +1 -0
- package/Libraries/Text/TextProps.js +17 -0
- package/Libraries/WebPerformance/NativePerformanceObserver.cpp +42 -0
- package/Libraries/WebPerformance/NativePerformanceObserver.h +64 -0
- package/Libraries/WebPerformance/NativePerformanceObserver.js +41 -0
- package/Libraries/WebPerformance/PerformanceObserver.js +223 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/CoreModulesPlugins.h +1 -0
- package/React/CoreModules/CoreModulesPlugins.mm +1 -0
- package/ReactAndroid/build.gradle +7 -5
- package/ReactAndroid/cmake-utils/ReactNative-application.cmake +1 -1
- package/ReactAndroid/cmake-utils/default-app-setup/OnLoad.cpp +12 -3
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle +13 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +3 -1
- package/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultTurboModuleManagerDelegate.cpp +15 -6
- package/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultTurboModuleManagerDelegate.h +6 -1
- package/ReactCommon/ReactCommon.podspec +9 -2
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +6 -0
- package/ReactCommon/react/renderer/attributedstring/TextAttributes.h +1 -0
- package/ReactCommon/react/renderer/attributedstring/conversions.h +78 -0
- package/ReactCommon/react/renderer/attributedstring/primitives.h +21 -0
- package/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +6 -0
- package/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +3 -0
- package/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +78 -9
- package/ReactCommon/yoga/yoga/Yoga.cpp +19 -10
- package/index.js +16 -11
- package/package.json +7 -6
- package/scripts/cocoapods/codegen_utils.rb +12 -11
- package/scripts/cocoapods/jsengine.rb +28 -3
- package/scripts/cocoapods/new_architecture.rb +1 -0
- package/scripts/cocoapods/utils.rb +0 -12
- package/scripts/codegen/generate-specs-cli-executor.js +4 -4
- package/scripts/hermes/hermes-utils.js +3 -7
- package/scripts/react_native_pods.rb +5 -3
- package/sdks/hermes-engine/hermes-engine.podspec +8 -3
- package/sdks/hermes-engine/utils/build-hermesc-xcode.sh +1 -1
- package/sdks/hermes-engine/utils/copy-hermes-xcode.sh +12 -4
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/App.tsx +1 -1
- package/template/Gemfile +1 -1
- package/template/android/app/build.gradle +2 -2
- package/template/android/build.gradle +3 -3
- package/template/ios/HelloWorld/AppDelegate.h +1 -1
- package/template/package.json +4 -2
- package/types/index.d.ts +0 -1
- package/Libraries/Image/ImagePickerIOS.d.ts +0 -48
- package/Libraries/Image/ImagePickerIOS.js +0 -103
- package/Libraries/Image/NativeImagePickerIOS.js +0 -39
- package/Libraries/Performance/PerformanceObserver.js +0 -124
- package/ReactCommon/React-bridging.podspec +0 -43
|
@@ -106,7 +106,7 @@ if(EXISTS ${PROJECT_BUILD_DIR}/generated/rncli/src/main/jni/Android-rncli.cmake)
|
|
|
106
106
|
include(${PROJECT_BUILD_DIR}/generated/rncli/src/main/jni/Android-rncli.cmake)
|
|
107
107
|
target_link_libraries(${CMAKE_PROJECT_NAME} ${AUTOLINKED_LIBRARIES})
|
|
108
108
|
foreach(autolinked_library ${AUTOLINKED_LIBRARIES})
|
|
109
|
-
target_link_libraries(autolinked_library common_flags)
|
|
109
|
+
target_link_libraries(${autolinked_library} common_flags)
|
|
110
110
|
endforeach()
|
|
111
111
|
endif()
|
|
112
112
|
|
|
@@ -48,7 +48,14 @@ void registerComponents(
|
|
|
48
48
|
rncli_registerProviders(registry);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
std::shared_ptr<TurboModule>
|
|
51
|
+
std::shared_ptr<TurboModule> cxxModuleProvider(
|
|
52
|
+
const std::string &name,
|
|
53
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
54
|
+
// Not implemented yet: provide pure-C++ NativeModules here.
|
|
55
|
+
return nullptr;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
std::shared_ptr<TurboModule> javaModuleProvider(
|
|
52
59
|
const std::string &name,
|
|
53
60
|
const JavaTurboModule::InitParams ¶ms) {
|
|
54
61
|
// Here you can provide your own module provider for TurboModules coming from
|
|
@@ -70,8 +77,10 @@ std::shared_ptr<TurboModule> provideModules(
|
|
|
70
77
|
|
|
71
78
|
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
|
|
72
79
|
return facebook::jni::initialize(vm, [] {
|
|
73
|
-
facebook::react::DefaultTurboModuleManagerDelegate::
|
|
74
|
-
|
|
80
|
+
facebook::react::DefaultTurboModuleManagerDelegate::cxxModuleProvider =
|
|
81
|
+
&facebook::react::cxxModuleProvider;
|
|
82
|
+
facebook::react::DefaultTurboModuleManagerDelegate::javaModuleProvider =
|
|
83
|
+
&facebook::react::javaModuleProvider;
|
|
75
84
|
facebook::react::DefaultComponentsRegistry::
|
|
76
85
|
registerComponentDescriptorsFromEntryPoint =
|
|
77
86
|
&facebook::react::registerComponents;
|
|
@@ -234,4 +234,17 @@ afterEvaluate {
|
|
|
234
234
|
prepareHeadersForPrefab.dependsOn(buildHermes)
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
+
/* Publishing Configuration */
|
|
237
238
|
apply from: "../publish.gradle"
|
|
239
|
+
|
|
240
|
+
// We need to override the artifact ID as this project is called `hermes-engine` but
|
|
241
|
+
// the maven coordinates are on `hermes-android`.
|
|
242
|
+
// Please note that the original coordinates, `hermes-engine`, have been voided
|
|
243
|
+
// as they caused https://github.com/facebook/react-native/issues/35210
|
|
244
|
+
publishing {
|
|
245
|
+
publications {
|
|
246
|
+
getByName("release") {
|
|
247
|
+
artifactId 'hermes-android'
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -120,7 +120,9 @@ public class ReactModalHostView extends ViewGroup
|
|
|
120
120
|
|
|
121
121
|
@Override
|
|
122
122
|
public int getChildCount() {
|
|
123
|
-
|
|
123
|
+
// This method may be called by the parent constructor
|
|
124
|
+
// before mHostView is initialized.
|
|
125
|
+
return mHostView == null ? 0 : mHostView.getChildCount();
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
@Override
|
package/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultTurboModuleManagerDelegate.cpp
CHANGED
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
namespace facebook {
|
|
13
13
|
namespace react {
|
|
14
14
|
|
|
15
|
+
std::function<std::shared_ptr<TurboModule>(
|
|
16
|
+
const std::string &,
|
|
17
|
+
const std::shared_ptr<CallInvoker> &)>
|
|
18
|
+
DefaultTurboModuleManagerDelegate::cxxModuleProvider{nullptr};
|
|
19
|
+
|
|
15
20
|
std::function<std::shared_ptr<TurboModule>(
|
|
16
21
|
const std::string &,
|
|
17
22
|
const JavaTurboModule::InitParams &)>
|
|
18
|
-
DefaultTurboModuleManagerDelegate::
|
|
23
|
+
DefaultTurboModuleManagerDelegate::javaModuleProvider{nullptr};
|
|
19
24
|
|
|
20
25
|
jni::local_ref<DefaultTurboModuleManagerDelegate::jhybriddata>
|
|
21
26
|
DefaultTurboModuleManagerDelegate::initHybrid(jni::alias_ref<jhybridobject>) {
|
|
@@ -32,17 +37,21 @@ void DefaultTurboModuleManagerDelegate::registerNatives() {
|
|
|
32
37
|
std::shared_ptr<TurboModule> DefaultTurboModuleManagerDelegate::getTurboModule(
|
|
33
38
|
const std::string &name,
|
|
34
39
|
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
35
|
-
|
|
40
|
+
auto moduleProvider = DefaultTurboModuleManagerDelegate::cxxModuleProvider;
|
|
41
|
+
if (moduleProvider) {
|
|
42
|
+
return moduleProvider(name, jsInvoker);
|
|
43
|
+
}
|
|
36
44
|
return nullptr;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
std::shared_ptr<TurboModule> DefaultTurboModuleManagerDelegate::getTurboModule(
|
|
40
48
|
const std::string &name,
|
|
41
49
|
const JavaTurboModule::InitParams ¶ms) {
|
|
42
|
-
auto
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
auto moduleProvider = DefaultTurboModuleManagerDelegate::javaModuleProvider;
|
|
51
|
+
if (moduleProvider) {
|
|
52
|
+
if (auto resolvedModule = moduleProvider(name, params)) {
|
|
53
|
+
return resolvedModule;
|
|
54
|
+
}
|
|
46
55
|
}
|
|
47
56
|
return rncore_ModuleProvider(name, params);
|
|
48
57
|
}
|
|
@@ -27,10 +27,15 @@ class DefaultTurboModuleManagerDelegate : public jni::HybridClass<
|
|
|
27
27
|
|
|
28
28
|
static void registerNatives();
|
|
29
29
|
|
|
30
|
+
static std::function<std::shared_ptr<TurboModule>(
|
|
31
|
+
const std::string &,
|
|
32
|
+
const std::shared_ptr<CallInvoker> &)>
|
|
33
|
+
cxxModuleProvider;
|
|
34
|
+
|
|
30
35
|
static std::function<std::shared_ptr<TurboModule>(
|
|
31
36
|
const std::string &,
|
|
32
37
|
const JavaTurboModule::InitParams &)>
|
|
33
|
-
|
|
38
|
+
javaModuleProvider;
|
|
34
39
|
|
|
35
40
|
std::shared_ptr<TurboModule> getTurboModule(
|
|
36
41
|
const std::string &name,
|
|
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
|
|
|
32
32
|
s.source = source
|
|
33
33
|
s.header_dir = "ReactCommon" # Use global header_dir for all subspecs for use_frameworks! compatibility
|
|
34
34
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
|
|
35
|
-
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\"
|
|
35
|
+
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\"",
|
|
36
36
|
"USE_HEADERMAP" => "YES",
|
|
37
37
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
|
|
38
38
|
"GCC_WARN_PEDANTIC" => "YES" }
|
|
@@ -40,7 +40,6 @@ Pod::Spec.new do |s|
|
|
|
40
40
|
# TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
|
|
41
41
|
# Note: Update this only when ready to minimize breaking changes.
|
|
42
42
|
s.subspec "turbomodule" do |ss|
|
|
43
|
-
ss.dependency "React-bridging", version
|
|
44
43
|
ss.dependency "React-callinvoker", version
|
|
45
44
|
ss.dependency "React-perflogger", version
|
|
46
45
|
ss.dependency "React-Core", version
|
|
@@ -51,6 +50,14 @@ Pod::Spec.new do |s|
|
|
|
51
50
|
ss.dependency "DoubleConversion"
|
|
52
51
|
ss.dependency "glog"
|
|
53
52
|
|
|
53
|
+
ss.subspec "bridging" do |sss|
|
|
54
|
+
sss.dependency "React-jsi", version
|
|
55
|
+
sss.source_files = "react/bridging/**/*.{cpp,h}"
|
|
56
|
+
sss.exclude_files = "react/bridging/tests"
|
|
57
|
+
sss.header_dir = "react/bridging"
|
|
58
|
+
sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
|
|
59
|
+
end
|
|
60
|
+
|
|
54
61
|
ss.subspec "core" do |sss|
|
|
55
62
|
sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}",
|
|
56
63
|
"react/nativemodule/core/platform/ios/**/*.{mm,cpp,h}"
|
|
@@ -46,6 +46,9 @@ void TextAttributes::apply(TextAttributes textAttributes) {
|
|
|
46
46
|
allowFontScaling = textAttributes.allowFontScaling.has_value()
|
|
47
47
|
? textAttributes.allowFontScaling
|
|
48
48
|
: allowFontScaling;
|
|
49
|
+
dynamicTypeRamp = textAttributes.dynamicTypeRamp.has_value()
|
|
50
|
+
? textAttributes.dynamicTypeRamp
|
|
51
|
+
: dynamicTypeRamp;
|
|
49
52
|
letterSpacing = !std::isnan(textAttributes.letterSpacing)
|
|
50
53
|
? textAttributes.letterSpacing
|
|
51
54
|
: letterSpacing;
|
|
@@ -111,6 +114,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
|
|
|
111
114
|
fontStyle,
|
|
112
115
|
fontVariant,
|
|
113
116
|
allowFontScaling,
|
|
117
|
+
dynamicTypeRamp,
|
|
114
118
|
alignment,
|
|
115
119
|
baseWritingDirection,
|
|
116
120
|
lineBreakStrategy,
|
|
@@ -131,6 +135,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
|
|
|
131
135
|
rhs.fontStyle,
|
|
132
136
|
rhs.fontVariant,
|
|
133
137
|
rhs.allowFontScaling,
|
|
138
|
+
rhs.dynamicTypeRamp,
|
|
134
139
|
rhs.alignment,
|
|
135
140
|
rhs.baseWritingDirection,
|
|
136
141
|
rhs.lineBreakStrategy,
|
|
@@ -186,6 +191,7 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const {
|
|
|
186
191
|
debugStringConvertibleItem("fontStyle", fontStyle),
|
|
187
192
|
debugStringConvertibleItem("fontVariant", fontVariant),
|
|
188
193
|
debugStringConvertibleItem("allowFontScaling", allowFontScaling),
|
|
194
|
+
debugStringConvertibleItem("dynamicTypeRamp", dynamicTypeRamp),
|
|
189
195
|
debugStringConvertibleItem("letterSpacing", letterSpacing),
|
|
190
196
|
|
|
191
197
|
// Paragraph Styles
|
|
@@ -50,6 +50,7 @@ class TextAttributes : public DebugStringConvertible {
|
|
|
50
50
|
std::optional<FontStyle> fontStyle{};
|
|
51
51
|
std::optional<FontVariant> fontVariant{};
|
|
52
52
|
std::optional<bool> allowFontScaling{};
|
|
53
|
+
std::optional<DynamicTypeRamp> dynamicTypeRamp{};
|
|
53
54
|
Float letterSpacing{std::numeric_limits<Float>::quiet_NaN()};
|
|
54
55
|
std::optional<TextTransform> textTransform{};
|
|
55
56
|
|
|
@@ -34,6 +34,84 @@
|
|
|
34
34
|
namespace facebook {
|
|
35
35
|
namespace react {
|
|
36
36
|
|
|
37
|
+
inline std::string toString(const DynamicTypeRamp &dynamicTypeRamp) {
|
|
38
|
+
switch (dynamicTypeRamp) {
|
|
39
|
+
case DynamicTypeRamp::Caption2:
|
|
40
|
+
return "caption2";
|
|
41
|
+
case DynamicTypeRamp::Caption1:
|
|
42
|
+
return "caption1";
|
|
43
|
+
case DynamicTypeRamp::Footnote:
|
|
44
|
+
return "footnote";
|
|
45
|
+
case DynamicTypeRamp::Subheadline:
|
|
46
|
+
return "subheadline";
|
|
47
|
+
case DynamicTypeRamp::Callout:
|
|
48
|
+
return "callout";
|
|
49
|
+
case DynamicTypeRamp::Body:
|
|
50
|
+
return "body";
|
|
51
|
+
case DynamicTypeRamp::Headline:
|
|
52
|
+
return "headline";
|
|
53
|
+
case DynamicTypeRamp::Title3:
|
|
54
|
+
return "title3";
|
|
55
|
+
case DynamicTypeRamp::Title2:
|
|
56
|
+
return "title2";
|
|
57
|
+
case DynamicTypeRamp::Title1:
|
|
58
|
+
return "title1";
|
|
59
|
+
case DynamicTypeRamp::LargeTitle:
|
|
60
|
+
return "largeTitle";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
LOG(ERROR) << "Unsupported DynamicTypeRamp value";
|
|
64
|
+
react_native_assert(false);
|
|
65
|
+
|
|
66
|
+
// Sane default in case of parsing errors
|
|
67
|
+
return "body";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
inline void fromRawValue(
|
|
71
|
+
const PropsParserContext &context,
|
|
72
|
+
const RawValue &value,
|
|
73
|
+
DynamicTypeRamp &result) {
|
|
74
|
+
react_native_assert(value.hasType<std::string>());
|
|
75
|
+
if (value.hasType<std::string>()) {
|
|
76
|
+
auto string = (std::string)value;
|
|
77
|
+
if (string == "caption2") {
|
|
78
|
+
result = DynamicTypeRamp::Caption2;
|
|
79
|
+
} else if (string == "caption1") {
|
|
80
|
+
result = DynamicTypeRamp::Caption1;
|
|
81
|
+
} else if (string == "footnote") {
|
|
82
|
+
result = DynamicTypeRamp::Footnote;
|
|
83
|
+
} else if (string == "subheadline") {
|
|
84
|
+
result = DynamicTypeRamp::Subheadline;
|
|
85
|
+
} else if (string == "callout") {
|
|
86
|
+
result = DynamicTypeRamp::Callout;
|
|
87
|
+
} else if (string == "body") {
|
|
88
|
+
result = DynamicTypeRamp::Body;
|
|
89
|
+
} else if (string == "headline") {
|
|
90
|
+
result = DynamicTypeRamp::Headline;
|
|
91
|
+
} else if (string == "title3") {
|
|
92
|
+
result = DynamicTypeRamp::Title3;
|
|
93
|
+
} else if (string == "title2") {
|
|
94
|
+
result = DynamicTypeRamp::Title2;
|
|
95
|
+
} else if (string == "title1") {
|
|
96
|
+
result = DynamicTypeRamp::Title1;
|
|
97
|
+
} else if (string == "largeTitle") {
|
|
98
|
+
result = DynamicTypeRamp::LargeTitle;
|
|
99
|
+
} else {
|
|
100
|
+
// sane default
|
|
101
|
+
LOG(ERROR) << "Unsupported DynamicTypeRamp value: " << string;
|
|
102
|
+
react_native_assert(false);
|
|
103
|
+
result = DynamicTypeRamp::Body;
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
LOG(ERROR) << "Unsupported DynamicTypeRamp type";
|
|
109
|
+
react_native_assert(false);
|
|
110
|
+
|
|
111
|
+
// Sane default in case of parsing errors
|
|
112
|
+
result = DynamicTypeRamp::Body;
|
|
113
|
+
}
|
|
114
|
+
|
|
37
115
|
inline std::string toString(const EllipsizeMode &ellipsisMode) {
|
|
38
116
|
switch (ellipsisMode) {
|
|
39
117
|
case EllipsizeMode::Clip:
|
|
@@ -46,6 +46,20 @@ enum class FontVariant : int {
|
|
|
46
46
|
ProportionalNums = 1 << 5
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
enum class DynamicTypeRamp {
|
|
50
|
+
Caption2,
|
|
51
|
+
Caption1,
|
|
52
|
+
Footnote,
|
|
53
|
+
Subheadline,
|
|
54
|
+
Callout,
|
|
55
|
+
Body,
|
|
56
|
+
Headline,
|
|
57
|
+
Title3,
|
|
58
|
+
Title2,
|
|
59
|
+
Title1,
|
|
60
|
+
LargeTitle
|
|
61
|
+
};
|
|
62
|
+
|
|
49
63
|
enum class EllipsizeMode {
|
|
50
64
|
Clip, // Do not add ellipsize, simply clip.
|
|
51
65
|
Head, // Truncate at head of line: "...wxyz".
|
|
@@ -190,6 +204,13 @@ struct hash<facebook::react::FontWeight> {
|
|
|
190
204
|
}
|
|
191
205
|
};
|
|
192
206
|
|
|
207
|
+
template <>
|
|
208
|
+
struct hash<facebook::react::DynamicTypeRamp> {
|
|
209
|
+
size_t operator()(const facebook::react::DynamicTypeRamp &v) const {
|
|
210
|
+
return hash<int>()(static_cast<int>(v));
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
193
214
|
template <>
|
|
194
215
|
struct hash<facebook::react::EllipsizeMode> {
|
|
195
216
|
size_t operator()(const facebook::react::EllipsizeMode &v) const {
|
|
@@ -73,6 +73,12 @@ static TextAttributes convertRawProp(
|
|
|
73
73
|
"allowFontScaling",
|
|
74
74
|
sourceTextAttributes.allowFontScaling,
|
|
75
75
|
defaultTextAttributes.allowFontScaling);
|
|
76
|
+
textAttributes.dynamicTypeRamp = convertRawProp(
|
|
77
|
+
context,
|
|
78
|
+
rawProps,
|
|
79
|
+
"dynamicTypeRamp",
|
|
80
|
+
sourceTextAttributes.dynamicTypeRamp,
|
|
81
|
+
defaultTextAttributes.dynamicTypeRamp);
|
|
76
82
|
textAttributes.letterSpacing = convertRawProp(
|
|
77
83
|
context,
|
|
78
84
|
rawProps,
|
|
@@ -94,6 +94,7 @@ inline bool areTextAttributesEquivalentLayoutWise(
|
|
|
94
94
|
lhs.fontStyle,
|
|
95
95
|
lhs.fontVariant,
|
|
96
96
|
lhs.allowFontScaling,
|
|
97
|
+
lhs.dynamicTypeRamp,
|
|
97
98
|
lhs.alignment) ==
|
|
98
99
|
std::tie(
|
|
99
100
|
rhs.fontFamily,
|
|
@@ -101,6 +102,7 @@ inline bool areTextAttributesEquivalentLayoutWise(
|
|
|
101
102
|
rhs.fontStyle,
|
|
102
103
|
rhs.fontVariant,
|
|
103
104
|
rhs.allowFontScaling,
|
|
105
|
+
rhs.dynamicTypeRamp,
|
|
104
106
|
rhs.alignment) &&
|
|
105
107
|
floatEquality(lhs.fontSize, rhs.fontSize) &&
|
|
106
108
|
floatEquality(lhs.fontSizeMultiplier, rhs.fontSizeMultiplier) &&
|
|
@@ -121,6 +123,7 @@ inline size_t textAttributesHashLayoutWise(
|
|
|
121
123
|
textAttributes.fontStyle,
|
|
122
124
|
textAttributes.fontVariant,
|
|
123
125
|
textAttributes.allowFontScaling,
|
|
126
|
+
textAttributes.dynamicTypeRamp,
|
|
124
127
|
textAttributes.letterSpacing,
|
|
125
128
|
textAttributes.lineHeight,
|
|
126
129
|
textAttributes.alignment);
|
|
@@ -55,6 +55,83 @@ inline static UIFontWeight RCTUIFontWeightFromInteger(NSInteger fontWeight)
|
|
|
55
55
|
return weights[(fontWeight + 50) / 100 - 1];
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
inline static UIFontTextStyle RCTUIFontTextStyleForDynamicTypeRamp(const DynamicTypeRamp &dynamicTypeRamp)
|
|
59
|
+
{
|
|
60
|
+
switch (dynamicTypeRamp) {
|
|
61
|
+
case DynamicTypeRamp::Caption2:
|
|
62
|
+
return UIFontTextStyleCaption2;
|
|
63
|
+
case DynamicTypeRamp::Caption1:
|
|
64
|
+
return UIFontTextStyleCaption1;
|
|
65
|
+
case DynamicTypeRamp::Footnote:
|
|
66
|
+
return UIFontTextStyleFootnote;
|
|
67
|
+
case DynamicTypeRamp::Subheadline:
|
|
68
|
+
return UIFontTextStyleSubheadline;
|
|
69
|
+
case DynamicTypeRamp::Callout:
|
|
70
|
+
return UIFontTextStyleCallout;
|
|
71
|
+
case DynamicTypeRamp::Body:
|
|
72
|
+
return UIFontTextStyleBody;
|
|
73
|
+
case DynamicTypeRamp::Headline:
|
|
74
|
+
return UIFontTextStyleHeadline;
|
|
75
|
+
case DynamicTypeRamp::Title3:
|
|
76
|
+
return UIFontTextStyleTitle3;
|
|
77
|
+
case DynamicTypeRamp::Title2:
|
|
78
|
+
return UIFontTextStyleTitle2;
|
|
79
|
+
case DynamicTypeRamp::Title1:
|
|
80
|
+
return UIFontTextStyleTitle1;
|
|
81
|
+
case DynamicTypeRamp::LargeTitle:
|
|
82
|
+
return UIFontTextStyleLargeTitle;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
inline static CGFloat RCTBaseSizeForDynamicTypeRamp(const DynamicTypeRamp &dynamicTypeRamp)
|
|
87
|
+
{
|
|
88
|
+
// Values taken from
|
|
89
|
+
// https://developer.apple.com/design/human-interface-guidelines/foundations/typography/#specifications
|
|
90
|
+
switch (dynamicTypeRamp) {
|
|
91
|
+
case DynamicTypeRamp::Caption2:
|
|
92
|
+
return 11.0;
|
|
93
|
+
case DynamicTypeRamp::Caption1:
|
|
94
|
+
return 12.0;
|
|
95
|
+
case facebook::react::DynamicTypeRamp::Footnote:
|
|
96
|
+
return 13.0;
|
|
97
|
+
case facebook::react::DynamicTypeRamp::Subheadline:
|
|
98
|
+
return 15.0;
|
|
99
|
+
case facebook::react::DynamicTypeRamp::Callout:
|
|
100
|
+
return 16.0;
|
|
101
|
+
case facebook::react::DynamicTypeRamp::Body:
|
|
102
|
+
return 17.0;
|
|
103
|
+
case facebook::react::DynamicTypeRamp::Headline:
|
|
104
|
+
return 17.0;
|
|
105
|
+
case facebook::react::DynamicTypeRamp::Title3:
|
|
106
|
+
return 20.0;
|
|
107
|
+
case facebook::react::DynamicTypeRamp::Title2:
|
|
108
|
+
return 22.0;
|
|
109
|
+
case facebook::react::DynamicTypeRamp::Title1:
|
|
110
|
+
return 28.0;
|
|
111
|
+
case facebook::react::DynamicTypeRamp::LargeTitle:
|
|
112
|
+
return 34.0;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const TextAttributes &textAttributes)
|
|
117
|
+
{
|
|
118
|
+
if (textAttributes.allowFontScaling.value_or(true)) {
|
|
119
|
+
if (textAttributes.dynamicTypeRamp.has_value()) {
|
|
120
|
+
DynamicTypeRamp dynamicTypeRamp = textAttributes.dynamicTypeRamp.value();
|
|
121
|
+
UIFontMetrics *fontMetrics =
|
|
122
|
+
[UIFontMetrics metricsForTextStyle:RCTUIFontTextStyleForDynamicTypeRamp(dynamicTypeRamp)];
|
|
123
|
+
// Using a specific font size reduces rounding errors from -scaledValueForValue:
|
|
124
|
+
CGFloat requestedSize =
|
|
125
|
+
isnan(textAttributes.fontSize) ? RCTBaseSizeForDynamicTypeRamp(dynamicTypeRamp) : textAttributes.fontSize;
|
|
126
|
+
return [fontMetrics scaledValueForValue:requestedSize] / requestedSize;
|
|
127
|
+
} else {
|
|
128
|
+
return textAttributes.fontSizeMultiplier;
|
|
129
|
+
}
|
|
130
|
+
} else {
|
|
131
|
+
return 1.0;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
58
135
|
inline static UIFont *RCTEffectiveFontFromTextAttributes(const TextAttributes &textAttributes)
|
|
59
136
|
{
|
|
60
137
|
NSString *fontFamily = [NSString stringWithCString:textAttributes.fontFamily.c_str() encoding:NSUTF8StringEncoding];
|
|
@@ -71,19 +148,11 @@ inline static UIFont *RCTEffectiveFontFromTextAttributes(const TextAttributes &t
|
|
|
71
148
|
fontProperties.weight = textAttributes.fontWeight.has_value()
|
|
72
149
|
? RCTUIFontWeightFromInteger((NSInteger)textAttributes.fontWeight.value())
|
|
73
150
|
: NAN;
|
|
74
|
-
fontProperties.sizeMultiplier =
|
|
75
|
-
textAttributes.allowFontScaling.value_or(true) ? textAttributes.fontSizeMultiplier : 1;
|
|
151
|
+
fontProperties.sizeMultiplier = RCTEffectiveFontSizeMultiplierFromTextAttributes(textAttributes);
|
|
76
152
|
|
|
77
153
|
return RCTFontWithFontProperties(fontProperties);
|
|
78
154
|
}
|
|
79
155
|
|
|
80
|
-
inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const TextAttributes &textAttributes)
|
|
81
|
-
{
|
|
82
|
-
return textAttributes.allowFontScaling.value_or(true) && !isnan(textAttributes.fontSizeMultiplier)
|
|
83
|
-
? textAttributes.fontSizeMultiplier
|
|
84
|
-
: 1.0;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
156
|
inline static UIColor *RCTEffectiveForegroundColorFromTextAttributes(const TextAttributes &textAttributes)
|
|
88
157
|
{
|
|
89
158
|
UIColor *effectiveForegroundColor = RCTUIColorFromSharedColor(textAttributes.foregroundColor) ?: [UIColor blackColor];
|
|
@@ -2079,7 +2079,7 @@ static float YGDistributeFreeSpaceSecondPass(
|
|
|
2079
2079
|
const float availableInnerCrossDim,
|
|
2080
2080
|
const float availableInnerWidth,
|
|
2081
2081
|
const float availableInnerHeight,
|
|
2082
|
-
const bool
|
|
2082
|
+
const bool mainAxisOverflows,
|
|
2083
2083
|
const YGMeasureMode measureModeCrossDim,
|
|
2084
2084
|
const bool performLayout,
|
|
2085
2085
|
const YGConfigRef config,
|
|
@@ -2175,7 +2175,7 @@ static float YGDistributeFreeSpaceSecondPass(
|
|
|
2175
2175
|
!YGNodeIsStyleDimDefined(
|
|
2176
2176
|
currentRelativeChild, crossAxis, availableInnerCrossDim) &&
|
|
2177
2177
|
measureModeCrossDim == YGMeasureModeExactly &&
|
|
2178
|
-
!(isNodeFlexWrap &&
|
|
2178
|
+
!(isNodeFlexWrap && mainAxisOverflows) &&
|
|
2179
2179
|
YGNodeAlignItem(node, currentRelativeChild) == YGAlignStretch &&
|
|
2180
2180
|
currentRelativeChild->marginLeadingValue(crossAxis).unit !=
|
|
2181
2181
|
YGUnitAuto &&
|
|
@@ -2383,7 +2383,7 @@ static void YGResolveFlexibleLength(
|
|
|
2383
2383
|
const float availableInnerCrossDim,
|
|
2384
2384
|
const float availableInnerWidth,
|
|
2385
2385
|
const float availableInnerHeight,
|
|
2386
|
-
const bool
|
|
2386
|
+
const bool mainAxisOverflows,
|
|
2387
2387
|
const YGMeasureMode measureModeCrossDim,
|
|
2388
2388
|
const bool performLayout,
|
|
2389
2389
|
const YGConfigRef config,
|
|
@@ -2411,7 +2411,7 @@ static void YGResolveFlexibleLength(
|
|
|
2411
2411
|
availableInnerCrossDim,
|
|
2412
2412
|
availableInnerWidth,
|
|
2413
2413
|
availableInnerHeight,
|
|
2414
|
-
|
|
2414
|
+
mainAxisOverflows,
|
|
2415
2415
|
measureModeCrossDim,
|
|
2416
2416
|
performLayout,
|
|
2417
2417
|
config,
|
|
@@ -2884,7 +2884,9 @@ static void YGNodelayoutImpl(
|
|
|
2884
2884
|
|
|
2885
2885
|
// STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM
|
|
2886
2886
|
|
|
2887
|
-
|
|
2887
|
+
// Computed basis + margins + gap
|
|
2888
|
+
float totalMainDim = 0;
|
|
2889
|
+
totalMainDim += YGNodeComputeFlexBasisForChildren(
|
|
2888
2890
|
node,
|
|
2889
2891
|
availableInnerWidth,
|
|
2890
2892
|
availableInnerHeight,
|
|
@@ -2899,10 +2901,17 @@ static void YGNodelayoutImpl(
|
|
|
2899
2901
|
depth,
|
|
2900
2902
|
generationCount);
|
|
2901
2903
|
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2904
|
+
if (childCount > 1) {
|
|
2905
|
+
totalMainDim +=
|
|
2906
|
+
node->getGapForAxis(mainAxis, availableInnerCrossDim).unwrap() *
|
|
2907
|
+
(childCount - 1);
|
|
2908
|
+
}
|
|
2909
|
+
|
|
2910
|
+
const bool mainAxisOverflows =
|
|
2911
|
+
(measureModeMainDim != YGMeasureModeUndefined) &&
|
|
2912
|
+
totalMainDim > availableInnerMainDim;
|
|
2913
|
+
|
|
2914
|
+
if (isNodeFlexWrap && mainAxisOverflows &&
|
|
2906
2915
|
measureModeMainDim == YGMeasureModeAtMost) {
|
|
2907
2916
|
measureModeMainDim = YGMeasureModeExactly;
|
|
2908
2917
|
}
|
|
@@ -3025,7 +3034,7 @@ static void YGNodelayoutImpl(
|
|
|
3025
3034
|
availableInnerCrossDim,
|
|
3026
3035
|
availableInnerWidth,
|
|
3027
3036
|
availableInnerHeight,
|
|
3028
|
-
|
|
3037
|
+
mainAxisOverflows,
|
|
3029
3038
|
measureModeCrossDim,
|
|
3030
3039
|
performLayout,
|
|
3031
3040
|
config,
|
package/index.js
CHANGED
|
@@ -59,7 +59,6 @@ import typeof Dimensions from './Libraries/Utilities/Dimensions';
|
|
|
59
59
|
import typeof Easing from './Libraries/Animated/Easing';
|
|
60
60
|
import typeof ReactNative from './Libraries/Renderer/shims/ReactNative';
|
|
61
61
|
import typeof I18nManager from './Libraries/ReactNative/I18nManager';
|
|
62
|
-
import typeof ImagePickerIOS from './Libraries/Image/ImagePickerIOS';
|
|
63
62
|
import typeof InteractionManager from './Libraries/Interaction/InteractionManager';
|
|
64
63
|
import typeof Keyboard from './Libraries/Components/Keyboard/Keyboard';
|
|
65
64
|
import typeof LayoutAnimation from './Libraries/LayoutAnimation/LayoutAnimation';
|
|
@@ -281,16 +280,6 @@ module.exports = {
|
|
|
281
280
|
get I18nManager(): I18nManager {
|
|
282
281
|
return require('./Libraries/ReactNative/I18nManager');
|
|
283
282
|
},
|
|
284
|
-
get ImagePickerIOS(): ImagePickerIOS {
|
|
285
|
-
warnOnce(
|
|
286
|
-
'imagePickerIOS-moved',
|
|
287
|
-
'ImagePickerIOS has been extracted from react-native core and will be removed in a future release. ' +
|
|
288
|
-
"Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " +
|
|
289
|
-
"If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
|
|
290
|
-
'See https://github.com/rnc-archive/react-native-image-picker-ios',
|
|
291
|
-
);
|
|
292
|
-
return require('./Libraries/Image/ImagePickerIOS');
|
|
293
|
-
},
|
|
294
283
|
get InteractionManager(): InteractionManager {
|
|
295
284
|
return require('./Libraries/Interaction/InteractionManager');
|
|
296
285
|
},
|
|
@@ -765,4 +754,20 @@ if (__DEV__) {
|
|
|
765
754
|
);
|
|
766
755
|
},
|
|
767
756
|
});
|
|
757
|
+
/* $FlowFixMe[prop-missing] This is intentional: Flow will error when
|
|
758
|
+
* attempting to access ImagePickerIOS. */
|
|
759
|
+
/* $FlowFixMe[invalid-export] This is intentional: Flow will error when
|
|
760
|
+
* attempting to access ImagePickerIOS. */
|
|
761
|
+
Object.defineProperty(module.exports, 'ImagePickerIOS', {
|
|
762
|
+
configurable: true,
|
|
763
|
+
get() {
|
|
764
|
+
invariant(
|
|
765
|
+
false,
|
|
766
|
+
'ImagePickerIOS has been removed from React Native. ' +
|
|
767
|
+
"Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " +
|
|
768
|
+
"If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
|
|
769
|
+
'See https://github.com/rnc-archive/react-native-image-picker-ios',
|
|
770
|
+
);
|
|
771
|
+
},
|
|
772
|
+
});
|
|
768
773
|
}
|