react-native 0.72.0-rc.2 → 0.72.0-rc.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/React/Base/RCTVersion.m +1 -1
- package/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +12 -1
- package/React/Fabric/RCTSurfacePresenter.mm +4 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/core/CoreFeatures.cpp +1 -0
- package/ReactCommon/react/renderer/core/CoreFeatures.h +4 -0
- package/ReactCommon/react/renderer/imagemanager/ImageRequest.h +7 -3
- package/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp +0 -11
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/ImageRequest.cpp +4 -14
- package/package.json +8 -8
- package/scripts/cocoapods/__tests__/flipper-test.rb +9 -1
- package/scripts/cocoapods/__tests__/utils-test.rb +0 -68
- package/scripts/cocoapods/flipper.rb +2 -2
- package/scripts/cocoapods/utils.rb +0 -7
- package/scripts/react_native_pods.rb +3 -6
- package/sdks/hermesc/linux64-bin/hermesc +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/package.json +4 -4
package/React/Base/RCTVersion.m
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#import <react/renderer/components/image/ImageComponentDescriptor.h>
|
|
15
15
|
#import <react/renderer/components/image/ImageEventEmitter.h>
|
|
16
16
|
#import <react/renderer/components/image/ImageProps.h>
|
|
17
|
+
#import <react/renderer/core/CoreFeatures.h>
|
|
17
18
|
#import <react/renderer/imagemanager/ImageRequest.h>
|
|
18
19
|
#import <react/renderer/imagemanager/RCTImagePrimitivesConversions.h>
|
|
19
20
|
|
|
@@ -97,8 +98,18 @@ using namespace facebook::react;
|
|
|
97
98
|
- (void)_setStateAndResubscribeImageResponseObserver:(ImageShadowNode::ConcreteState::Shared const &)state
|
|
98
99
|
{
|
|
99
100
|
if (_state) {
|
|
100
|
-
auto &
|
|
101
|
+
auto const &imageRequest = _state->getData().getImageRequest();
|
|
102
|
+
auto &observerCoordinator = imageRequest.getObserverCoordinator();
|
|
101
103
|
observerCoordinator.removeObserver(_imageResponseObserverProxy);
|
|
104
|
+
if (CoreFeatures::cancelImageDownloadsOnRecycle) {
|
|
105
|
+
// Cancelling image request because we are no longer observing it.
|
|
106
|
+
// This is not 100% correct place to do this because we may want to
|
|
107
|
+
// re-create RCTImageComponentView with the same image and if it
|
|
108
|
+
// was cancelled before downloaded, download is not resumed.
|
|
109
|
+
// This will only become issue if we decouple life cycle of a
|
|
110
|
+
// ShadowNode from ComponentView, which is not something we do now.
|
|
111
|
+
imageRequest.cancel();
|
|
112
|
+
}
|
|
102
113
|
}
|
|
103
114
|
|
|
104
115
|
_state = state;
|
|
@@ -285,6 +285,10 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
|
|
285
285
|
CoreFeatures::cacheNSTextStorage = true;
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
+
if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:cancel_image_downloads_on_recycle")) {
|
|
289
|
+
CoreFeatures::cancelImageDownloadsOnRecycle = true;
|
|
290
|
+
}
|
|
291
|
+
|
|
288
292
|
auto componentRegistryFactory =
|
|
289
293
|
[factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)](
|
|
290
294
|
EventDispatcher::Weak const &eventDispatcher, ContextContainer::Shared const &contextContainer) {
|
|
@@ -16,6 +16,7 @@ bool CoreFeatures::blockPaintForUseLayoutEffect = false;
|
|
|
16
16
|
bool CoreFeatures::useNativeState = false;
|
|
17
17
|
bool CoreFeatures::cacheNSTextStorage = false;
|
|
18
18
|
bool CoreFeatures::cacheLastTextMeasurement = false;
|
|
19
|
+
bool CoreFeatures::cancelImageDownloadsOnRecycle = false;
|
|
19
20
|
|
|
20
21
|
} // namespace react
|
|
21
22
|
} // namespace facebook
|
|
@@ -44,6 +44,10 @@ class CoreFeatures {
|
|
|
44
44
|
// This flag enables a caching mechanism to avoid subsequents measurements
|
|
45
45
|
// of the same Text with the same constrainst.
|
|
46
46
|
static bool cacheLastTextMeasurement;
|
|
47
|
+
|
|
48
|
+
// Fabric was not cancelling image downloads when <ImageView /> was removed
|
|
49
|
+
// from view hierarchy. This feature flag enables this feature.
|
|
50
|
+
static bool cancelImageDownloadsOnRecycle;
|
|
47
51
|
};
|
|
48
52
|
|
|
49
53
|
} // namespace react
|
|
@@ -35,20 +35,24 @@ class ImageRequest final {
|
|
|
35
35
|
/*
|
|
36
36
|
* The move constructor.
|
|
37
37
|
*/
|
|
38
|
-
ImageRequest(ImageRequest &&other) noexcept;
|
|
38
|
+
ImageRequest(ImageRequest &&other) noexcept = default;
|
|
39
39
|
|
|
40
40
|
/*
|
|
41
41
|
* `ImageRequest` does not support copying by design.
|
|
42
42
|
*/
|
|
43
43
|
ImageRequest(const ImageRequest &other) = delete;
|
|
44
44
|
|
|
45
|
-
~ImageRequest();
|
|
46
|
-
|
|
47
45
|
/**
|
|
48
46
|
* Set cancelation function.
|
|
49
47
|
*/
|
|
50
48
|
void setCancelationFunction(std::function<void(void)> cancelationFunction);
|
|
51
49
|
|
|
50
|
+
/*
|
|
51
|
+
* Calls cancel function if one is defined. Should be when downloading
|
|
52
|
+
* image isn't needed anymore. E.g. <ImageView /> was removed.
|
|
53
|
+
*/
|
|
54
|
+
void cancel() const;
|
|
55
|
+
|
|
52
56
|
/*
|
|
53
57
|
* Returns the Image Source associated with the request.
|
|
54
58
|
*/
|
|
@@ -18,17 +18,6 @@ ImageRequest::ImageRequest(
|
|
|
18
18
|
// Not implemented.
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
ImageRequest::ImageRequest(ImageRequest &&other) noexcept
|
|
22
|
-
: imageSource_(std::move(other.imageSource_)),
|
|
23
|
-
telemetry_(std::move(other.telemetry_)),
|
|
24
|
-
coordinator_(std::move(other.coordinator_)) {
|
|
25
|
-
// Not implemented.
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
ImageRequest::~ImageRequest() {
|
|
29
|
-
// Not implemented.
|
|
30
|
-
}
|
|
31
|
-
|
|
32
21
|
const ImageResponseObserverCoordinator &ImageRequest::getObserverCoordinator()
|
|
33
22
|
const {
|
|
34
23
|
// Not implemented
|
|
@@ -17,27 +17,17 @@ ImageRequest::ImageRequest(
|
|
|
17
17
|
coordinator_ = std::make_shared<ImageResponseObserverCoordinator>();
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
ImageRequest::
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
coordinator_(std::move(other.coordinator_)) {
|
|
24
|
-
other.coordinator_ = nullptr;
|
|
25
|
-
other.cancelRequest_ = nullptr;
|
|
26
|
-
other.telemetry_ = nullptr;
|
|
27
|
-
other.imageSource_ = {};
|
|
20
|
+
void ImageRequest::setCancelationFunction(
|
|
21
|
+
std::function<void(void)> cancelationFunction) {
|
|
22
|
+
cancelRequest_ = cancelationFunction;
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
ImageRequest
|
|
25
|
+
void ImageRequest::cancel() const {
|
|
31
26
|
if (cancelRequest_) {
|
|
32
27
|
cancelRequest_();
|
|
33
28
|
}
|
|
34
29
|
}
|
|
35
30
|
|
|
36
|
-
void ImageRequest::setCancelationFunction(
|
|
37
|
-
std::function<void(void)> cancelationFunction) {
|
|
38
|
-
cancelRequest_ = cancelationFunction;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
31
|
const ImageSource &ImageRequest::getImageSource() const {
|
|
42
32
|
return imageSource_;
|
|
43
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native",
|
|
3
|
-
"version": "0.72.0-rc.
|
|
3
|
+
"version": "0.72.0-rc.3",
|
|
4
4
|
"bin": "./cli.js",
|
|
5
5
|
"description": "A framework for building native apps using React",
|
|
6
6
|
"license": "MIT",
|
|
@@ -79,12 +79,12 @@
|
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
81
|
"@jest/create-cache-key-function": "^29.2.1",
|
|
82
|
-
"@react-native-community/cli": "11.2.
|
|
83
|
-
"@react-native-community/cli-platform-android": "11.2.
|
|
84
|
-
"@react-native-community/cli-platform-ios": "11.2.
|
|
82
|
+
"@react-native-community/cli": "11.2.3",
|
|
83
|
+
"@react-native-community/cli-platform-android": "11.2.3",
|
|
84
|
+
"@react-native-community/cli-platform-ios": "11.2.3",
|
|
85
85
|
"@react-native/assets-registry": "^0.72.0",
|
|
86
86
|
"@react-native/codegen": "^0.72.4",
|
|
87
|
-
"@react-native/gradle-plugin": "^0.72.
|
|
87
|
+
"@react-native/gradle-plugin": "^0.72.7",
|
|
88
88
|
"@react-native/js-polyfills": "^0.72.1",
|
|
89
89
|
"@react-native/normalize-colors": "^0.72.0",
|
|
90
90
|
"@react-native/virtualized-lists": "^0.72.4",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"jest-environment-node": "^29.2.1",
|
|
99
99
|
"jsc-android": "^250231.0.0",
|
|
100
100
|
"memoize-one": "^5.0.0",
|
|
101
|
-
"metro-runtime": "0.76.
|
|
102
|
-
"metro-source-map": "0.76.
|
|
101
|
+
"metro-runtime": "0.76.4",
|
|
102
|
+
"metro-source-map": "0.76.4",
|
|
103
103
|
"mkdirp": "^0.5.1",
|
|
104
104
|
"nullthrows": "^1.1.1",
|
|
105
105
|
"pretty-format": "^26.5.2",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"react-refresh": "^0.4.0",
|
|
109
109
|
"react-shallow-renderer": "^16.15.0",
|
|
110
110
|
"regenerator-runtime": "^0.13.2",
|
|
111
|
-
"scheduler": "
|
|
111
|
+
"scheduler": "0.24.0-canary-efb381bbf-20230505",
|
|
112
112
|
"stacktrace-parser": "^0.1.10",
|
|
113
113
|
"use-sync-external-store": "^1.0.0",
|
|
114
114
|
"whatwg-fetch": "^3.0.0",
|
|
@@ -82,7 +82,7 @@ class FlipperTests < Test::Unit::TestCase
|
|
|
82
82
|
assert_equal(config.build_settings['SWIFT_VERSION'], '4.1')
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
reactCore_target = installer.target_with_name("React-
|
|
85
|
+
reactCore_target = installer.target_with_name("React-RCTAppDelegate")
|
|
86
86
|
reactCore_target.build_configurations.each do |config|
|
|
87
87
|
if config.name == 'Debug' || config.name == 'CustomConfig' then
|
|
88
88
|
assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1'])
|
|
@@ -144,6 +144,14 @@ class FlipperTests < Test::Unit::TestCase
|
|
|
144
144
|
BuildConfigurationMock.new("Release", is_debug: false),
|
|
145
145
|
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
|
146
146
|
]
|
|
147
|
+
),
|
|
148
|
+
TargetMock.new(
|
|
149
|
+
"React-RCTAppDelegate",
|
|
150
|
+
[
|
|
151
|
+
BuildConfigurationMock.new("Debug", is_debug: true),
|
|
152
|
+
BuildConfigurationMock.new("Release", is_debug: false),
|
|
153
|
+
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
|
154
|
+
]
|
|
147
155
|
)
|
|
148
156
|
]
|
|
149
157
|
)
|
|
@@ -677,74 +677,6 @@ class UtilsTests < Test::Unit::TestCase
|
|
|
677
677
|
assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited)")
|
|
678
678
|
end
|
|
679
679
|
end
|
|
680
|
-
|
|
681
|
-
# ============================= #
|
|
682
|
-
# Test - Enable Hermes Profiler #
|
|
683
|
-
# ============================= #
|
|
684
|
-
|
|
685
|
-
def test_enableHermesProfiler_whenEnableHermesProfileIsTrue_setsFlagsInRelease
|
|
686
|
-
# Arrange
|
|
687
|
-
first_target = prepare_target("FirstTarget")
|
|
688
|
-
second_target = prepare_target("SecondTarget")
|
|
689
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
690
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
691
|
-
prepare_config("Debug"),
|
|
692
|
-
prepare_config("Release"),
|
|
693
|
-
],
|
|
694
|
-
:native_targets => [
|
|
695
|
-
first_target,
|
|
696
|
-
second_target
|
|
697
|
-
]
|
|
698
|
-
)
|
|
699
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
|
|
700
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
701
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
702
|
-
])
|
|
703
|
-
|
|
704
|
-
# Act
|
|
705
|
-
ReactNativePodsUtils.enable_hermes_profiler(installer, enable_hermes_profiler: true)
|
|
706
|
-
|
|
707
|
-
# Assert
|
|
708
|
-
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
|
|
709
|
-
target_installation_result.native_target.build_configurations.each do |config|
|
|
710
|
-
if config.name != "Release"
|
|
711
|
-
assert_nil(config.build_settings["OTHER_CFLAGS"])
|
|
712
|
-
else
|
|
713
|
-
assert_equal(config.build_settings["OTHER_CFLAGS"], "$(inherited) -DRCT_REMOTE_PROFILE=1")
|
|
714
|
-
end
|
|
715
|
-
end
|
|
716
|
-
end
|
|
717
|
-
end
|
|
718
|
-
|
|
719
|
-
def test_enableHermesProfiler_whenEnableHermesProfileIsFalse_doesNothing
|
|
720
|
-
# Arrange
|
|
721
|
-
first_target = prepare_target("FirstTarget")
|
|
722
|
-
second_target = prepare_target("SecondTarget")
|
|
723
|
-
third_target = prepare_target("ThirdTarget", "com.apple.product-type.bundle")
|
|
724
|
-
user_project_mock = UserProjectMock.new("a/path", [
|
|
725
|
-
prepare_config("Debug"),
|
|
726
|
-
prepare_config("Release"),
|
|
727
|
-
],
|
|
728
|
-
:native_targets => [
|
|
729
|
-
first_target,
|
|
730
|
-
second_target
|
|
731
|
-
]
|
|
732
|
-
)
|
|
733
|
-
pods_projects_mock = PodsProjectMock.new([third_target], {"hermes-engine" => {}})
|
|
734
|
-
installer = InstallerMock.new(pods_projects_mock, [
|
|
735
|
-
AggregatedProjectMock.new(user_project_mock)
|
|
736
|
-
])
|
|
737
|
-
|
|
738
|
-
# Act
|
|
739
|
-
ReactNativePodsUtils.enable_hermes_profiler(installer)
|
|
740
|
-
|
|
741
|
-
# Assert
|
|
742
|
-
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
|
|
743
|
-
target_installation_result.native_target.build_configurations.each do |config|
|
|
744
|
-
assert_nil(config.build_settings["OTHER_CFLAGS"])
|
|
745
|
-
end
|
|
746
|
-
end
|
|
747
|
-
end
|
|
748
680
|
end
|
|
749
681
|
|
|
750
682
|
# ===== #
|
|
@@ -77,8 +77,8 @@ def flipper_post_install(installer)
|
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
# Enable flipper for React-
|
|
81
|
-
if target.name == 'React-
|
|
80
|
+
# Enable flipper for React-RCTAppDelegate Debug configuration
|
|
81
|
+
if target.name == 'React-RCTAppDelegate'
|
|
82
82
|
target.build_configurations.each do |config|
|
|
83
83
|
if config.debug?
|
|
84
84
|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'FB_SONARKIT_ENABLED=1']
|
|
@@ -220,13 +220,6 @@ class ReactNativePodsUtils
|
|
|
220
220
|
end
|
|
221
221
|
end
|
|
222
222
|
|
|
223
|
-
def self.enable_hermes_profiler(installer, enable_hermes_profiler: false)
|
|
224
|
-
return if !enable_hermes_profiler
|
|
225
|
-
|
|
226
|
-
Pod::UI.puts "[Hermes Profiler] Enable Hermes Sample profiler"
|
|
227
|
-
self.add_compiler_flag_to_pods(installer, "-DRCT_REMOTE_PROFILE=1", configuration: "Release")
|
|
228
|
-
end
|
|
229
|
-
|
|
230
223
|
# ========= #
|
|
231
224
|
# Utilities #
|
|
232
225
|
# ========= #
|
|
@@ -222,11 +222,10 @@ end
|
|
|
222
222
|
# - mac_catalyst_enabled: whether we are running the Pod on a Mac Catalyst project or not.
|
|
223
223
|
# - enable_hermes_profiler: whether the hermes profiler should be turned on in Release mode
|
|
224
224
|
def react_native_post_install(
|
|
225
|
-
installer,
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
installer,
|
|
226
|
+
react_native_path = "../node_modules/react-native",
|
|
227
|
+
mac_catalyst_enabled: false
|
|
228
228
|
)
|
|
229
|
-
enable_hermes_profiler = enable_hermes_profiler || ENV["ENABLE_HERMES_PROFILER"] == "1"
|
|
230
229
|
ReactNativePodsUtils.turn_off_resource_bundle_react_core(installer)
|
|
231
230
|
|
|
232
231
|
ReactNativePodsUtils.apply_mac_catalyst_patches(installer) if mac_catalyst_enabled
|
|
@@ -242,13 +241,11 @@ def react_native_post_install(
|
|
|
242
241
|
ReactNativePodsUtils.update_search_paths(installer)
|
|
243
242
|
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
|
|
244
243
|
ReactNativePodsUtils.apply_flags_for_fabric(installer, fabric_enabled: fabric_enabled)
|
|
245
|
-
ReactNativePodsUtils.enable_hermes_profiler(installer, enable_hermes_profiler: enable_hermes_profiler)
|
|
246
244
|
|
|
247
245
|
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
|
|
248
246
|
is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
|
|
249
247
|
NewArchitectureHelper.modify_flags_for_new_architecture(installer, is_new_arch_enabled)
|
|
250
248
|
|
|
251
|
-
|
|
252
249
|
Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green
|
|
253
250
|
end
|
|
254
251
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/template/package.json
CHANGED
|
@@ -11,22 +11,22 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"react": "18.2.0",
|
|
14
|
-
"react-native": "0.72.0-rc.
|
|
14
|
+
"react-native": "0.72.0-rc.3"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@babel/core": "^7.20.0",
|
|
18
18
|
"@babel/preset-env": "^7.20.0",
|
|
19
19
|
"@babel/runtime": "^7.12.5",
|
|
20
20
|
"@react-native/eslint-config": "^0.72.1",
|
|
21
|
-
"@react-native/metro-config": "^0.72.
|
|
21
|
+
"@react-native/metro-config": "^0.72.5",
|
|
22
22
|
"@tsconfig/react-native": "^3.0.0",
|
|
23
|
-
"@types/metro-config": "^0.76.
|
|
23
|
+
"@types/metro-config": "^0.76.3",
|
|
24
24
|
"@types/react": "^18.0.24",
|
|
25
25
|
"@types/react-test-renderer": "^18.0.0",
|
|
26
26
|
"babel-jest": "^29.2.1",
|
|
27
27
|
"eslint": "^8.19.0",
|
|
28
28
|
"jest": "^29.2.1",
|
|
29
|
-
"metro-react-native-babel-preset": "0.76.
|
|
29
|
+
"metro-react-native-babel-preset": "0.76.4",
|
|
30
30
|
"prettier": "^2.4.1",
|
|
31
31
|
"react-test-renderer": "18.2.0",
|
|
32
32
|
"typescript": "4.8.4"
|