Summary:
This PR fixes https://github.com/facebook/react-native/issues/48657
- Memory usage for creating a blob lowered from _( nearest 2^N greater than the file size)+1KB_ previously To _(file size)+1KB_. This is achieved by avoiding internal calls to java.io.ByteArrayOutputStream.ensureCapacity by creating a buffer based on file size.
- Increases the max file size a Blob can be created from before hitting a OutOfMemoryException.
- Major performance increase by avoiding buffer copying
## Changelog:
[ANDROID] [CHANGED] - Speed and Memory usage improvements to Android Blob support
[ANDROID] [FIXED] - Creating of Blobs from large files now works. File size can now be upto available (free) heap size.
Pull Request resolved: https://github.com/facebook/react-native/pull/50121
Test Plan: Used the App here to test Android Blob creation. https://github.com/giantslogik/blob-large-file-fetch.
Reviewed By: cortinico
Differential Revision: D71464835
Pulled By: javache
fbshipit-source-id: 38de7d83bcaee265fc6e7183f6b1160027cd4cb2
Summary:
In the final XCFramework we no longer need to place resource bundles in a subfolder called Resources - they should be located directly in the framework folder.
This commit fixes this by removing copying to the Resources folder. I also removed a few unneeded tests since we know that we are in a valid folder at this point.
bypass-github-export-checks
## Changelog:
[INTERNAL] - Moved resource bundles up one level
Pull Request resolved: https://github.com/facebook/react-native/pull/50101
Test Plan: Run RNTester with RCT_USE_RN_DEP=1 and verify that it launches
Reviewed By: cortinico
Differential Revision: D71464608
Pulled By: cipolleschi
fbshipit-source-id: 6cfdda0c6785ffeb13c170f9fd2dd9f5b889d490
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49998
We have listeners for EventDispatcher, but we don't have any listener capabilities for synchronous hooks from events on the UI thread.
This proposal adds an affordance for generic event listeners that can be attached by the host platform mounting manager, e.g., to wire events to NativeAnimated event drivers.
## Changelog
[General][Added] - EventEmitter `addListener` and `removeListener` APIs
Reviewed By: javache
Differential Revision: D71050838
fbshipit-source-id: a7f298c71bd882a573781c2fe1fb5a1ae79f301c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50032
In the new architecture, Android dispatches all events with folly::dynamic payloads. Various other callsites in some host platforms similarly dispatch events with folly::dynamic payloads.
Events disptached with folly::dynamic payloads have alignment with the `EventPayload::extractValue` method, added for integration with other capabilities like native animations.
When combined with a general pupose synchronous listener on facebook::react::EventEmitter, this should allow easier integration with host platform native event animation drivers.
## Changelog
[Internal]
Reviewed By: javache
Differential Revision: D71198197
fbshipit-source-id: 5e49e3b0fb01079870fbc7fc7e74ca0db354cda5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49988
NativeAnimated currently depends on folly::dynamic event payloads for event-driven animations. While some events (e.g., ScrollEvent.h) have an `asDynamic` implementation, not all events do. In practice, NativeAnimated just needs to be able to extract an numeric value from a path to drive an animation.
Rather than converting events to dynamic, or otherwise special casing event handling, this change allows arbitrary payloads to implement `EventPayload::extractValue` to retrieve JS property path values directly from events, without intermediate conversions to dynamic.
## Changelog
[Internal]
Reviewed By: javache
Differential Revision: D71046682
fbshipit-source-id: 3544335ff9d50da87ced015de587b97204173b57
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49848
Adds a new method to reset the server host in PackageConnectionSettings to its default state rather than relying on providing a blank string
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D70584220
fbshipit-source-id: 2862eee5f71bfe318da7199f2288367433d6f887
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50100
While moving the generation of `ReactCodegen.podspec` from Cocoapods to Codegen, we wrongly copied some parts of the script and now it is generating folders with a `,` as a suffix.
This change fixes the problem and prevent the generation of such folders.
## Changelog:
[Internal] - Avoid generating `ios,` folders
Reviewed By: fabriziocucci
Differential Revision: D71395049
fbshipit-source-id: 1e6024af6e24834a682865792e64d056fb94e027
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50068
Note: this involved tightening up some signatures in Kotlin files
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made DevSupportManagerBase.java nullsafe
Reviewed By: mdvacca
Differential Revision: D71126381
fbshipit-source-id: 01c08e2fc61eff885911fa9c295d504fa7ea334c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50067
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126382
fbshipit-source-id: d90966e62372395e864425c82321dc1fc04c1413
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50066
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made BundleDownloader.java nullsafe
Reviewed By: alanleedev
Differential Revision: D71126383
fbshipit-source-id: 94e9e9dfc1db83d32046e370c895fa889dabf116
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50065
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126388
fbshipit-source-id: a9f08b4ce101202cebe13107cc9c6a660deaf58f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50064
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made DebugOverlayController.java nullsafe
Reviewed By: mdvacca
Differential Revision: D71126394
fbshipit-source-id: 77bba33f4f14566e133fa9e9649631bcffa3f0c9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50063
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126397
fbshipit-source-id: b1cdea896d6cd9d25f9075e0bf35b9e16bf6ef65
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50062
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made CxxInspectorPackagerConnection.java nullsafe
Reviewed By: mdvacca
Differential Revision: D71126386
fbshipit-source-id: 94b6fca6972e5f08c22df7bebe6f853b5ceb20a7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50061
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126390
fbshipit-source-id: 8ab63944b0e6ce3c78b14414e8a992c1321114f1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50060
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made DevServerHelper.java nullsafe
Reviewed By: rshest
Differential Revision: D71126391
fbshipit-source-id: 0d39b23d0d96f32f25ac1003d849428000777852
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50059
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126395
fbshipit-source-id: fb42b12dae542bde6e0e9e58baeaab054ed8c49e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50058
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made JSDebuggerWebsocketClient.java nullsafe
Reviewed By: mdvacca
Differential Revision: D71126385
fbshipit-source-id: 8707e8c6b8092c0c301dc81a363758b60f38086a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50057
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126392
fbshipit-source-id: 96464734a2edc7ec242cd3f3646222587d89eb2c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50056
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made MultipartStreamReader.java nullsafe
Reviewed By: mdvacca
Differential Revision: D71126393
fbshipit-source-id: 3b621be82cd874c608cb610ba35dff0be7cbd195
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50055
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126389
fbshipit-source-id: f41d3fbdfdfcde28a8bfc1d52efaca6a8b0fcb1a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50054
Gone trough all the FIXMEs added in the previous diff by the nullsafe tool, marked the class as nullsafe and ensured no remaining violations.
Changelog: [Android][Fixed] Made StackTraceHelper.java nullsafe
Reviewed By: javache
Differential Revision: D71126387
fbshipit-source-id: 3456dde049b50e48ad703fe8312cf57b8d849515
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50053
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D71126384
fbshipit-source-id: 6a2e348f75b0b589de080bf060c4669db82a69c6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50091
Changelog: [internal]
If a library uses mount hooks to perform mount operations, it's possible to get concurrent modifications of the list of pending surface IDs to report.
This fixes that potential error by making a copy of the list before dispatching the mount notifications.
Fixes https://github.com/facebook/react-native/issues/49783.
Reviewed By: javache
Differential Revision: D71387739
fbshipit-source-id: 96c723ef2d6bcc659c4452434b7a4d5af26117ef
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50090
Changelog: [internal]
I refactored `FabricUIManager` in D54547194 / https://github.com/facebook/react-native/pull/43337 and accidentally removed setting this flag to avoid scheduling redundant tasks in the UI thread to report mount. This fixes it.
Reviewed By: javache
Differential Revision: D71387374
fbshipit-source-id: cad8a3ead2434738325560902cbab817e5d5dde7
Summary:
Headers are currently copied into each arch in the final xcframework. This is not necessary and will cause a lot of duplication since these files are the same for all archs.
This commit fixes this by only copying headers when we build the final XCFramework:
- ReactNativeDependencies.podspec: Changed the prepare script to be more resilient to different header structs, since we have multiple ways of packaging our tarballs locally and on the servers
- build.js: Removed copying headers when building frameworks
- compose-framework.js: Added copying headers once to the root of the XCFramework.
- rndependencies.rb: updated docs with correct ENV vars
bypass-github-export-checks
## Changelog:
[INTERNAL] - Changes the header structure in our XCFramework to avoid duplication
Pull Request resolved: https://github.com/facebook/react-native/pull/50085
Test Plan: Run RNTester with RCT_USE_RN_DEPS=1 to use prebuilt RN Deps.
Reviewed By: javache
Differential Revision: D71385183
Pulled By: cipolleschi
fbshipit-source-id: 160d56dea7f61d1b8d0a45b80f6c0789647358e6
Summary:
We had some issues with the Swift package build step where we saw an error message when we included resources and couldn't find out why this was happening.
After systematically going through the generated swift package file and looking for a reason I found a mistake.
When we generate the Package.swift file we pass all compilerFlags from the configuration of the target to both cpp/c flags - which in the case of the folly target ends up being passed to the dependency scanner which isn't too happy about this c++ flag.
The solution was to split `compilerFlags` into `cCompilerFlags` and `cxxCompilerFlags`.
This commit fixes this by:
- split `compilerFlags` into `cCompilerFlags` and `cxxCompilerFlags`.
- Updated configuration with correct settings
- Updated Package.swift generation to use these new flags
- Fixed issue with the copy bundles step that didn't copy the directory in some cases.
## Changelog:
[INTERNAL] - Fixed processing resources in the generated swift package for the RN Dependencies/prebuild
## Test-plan
Test by prebuilding RNDependencies, include the XCFramework in a new app and try to load resource bundles:
```obj-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
std::string input = "3.1416 xyz ";
double_conversion::DoubleToStringConverter::EcmaScriptConverter();
LOG(INFO) << "Hello from GLOG";
fmt::print("Hello, world from FMT!\n");
BOOST_ASSERT(100 == 100);
double result;
fast_float::from_chars(input.data(), input.data() + input.size(), result);
LOG(INFO) << "Answer :" << result;
NSArray *frameworks = [NSBundle allFrameworks];
for (NSBundle *framework in frameworks) {
NSString *frameworkName = framework.bundleURL.lastPathComponent;
if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) {
[self loadBundle:framework bundleName:@"ReactNativeDependencies_glog"];
[self loadBundle:framework bundleName:@"ReactNativeDependencies_boost"];
[self loadBundle:framework bundleName:@"ReactNativeDependencies_folly"];
break;
}
}
return YES;
}
- (void) loadBundle:(NSBundle*)framework bundleName: (NSString*)bundleName {
NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]];
NSURL *bundleURL = [bundle URLForResource:bundleName withExtension:@"bundle"];
NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL];
NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"];
if (url == nil) {
LOG(ERROR) << "Could not find PrivacyInfo.xcprivacy in the " << [bundleName UTF8String] << " bundle";
} else {
LOG(INFO) << "Found PrivacyInfo.xcprivacy in " << [bundleName UTF8String] << ".";
}
}
```
Pull Request resolved: https://github.com/facebook/react-native/pull/50050
Reviewed By: javache
Differential Revision: D71316215
Pulled By: cipolleschi
fbshipit-source-id: 53093f962874101f5618997fdac3dd4550768da5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50092
`oldProps` can be null, so this is an unsafe dereference. We also typically compare with `_props`, which represents the previous state of the component.
Changelog: [General][Fixed] Fixed crash in RCTPullToRefreshViewComponentView#updateProps
Reviewed By: cipolleschi
Differential Revision: D71388015
fbshipit-source-id: deff9c581ee207c4481056a720c10dfd661f088d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50088
Changelog: [internal]
This fixes a crash when using the `fixMountingCoordinatorReportedPendingTransactionsOnAndroid` feature flag. The problem was that we were accessing the surface handler registry safely, but there were cases where invalid surface handler references were being kept in the registry.
Reviewed By: javache
Differential Revision: D71387111
fbshipit-source-id: 643fcdf10c4c5751d77e276efb37795b7af726bb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50077
Currently, `DevServerHelper` will fetch malformed URLs if the supplied `resourcePath` has a leading slash.
This diff adds a warning and automatically trims the leading slash when this happens.
Changelog:
[Android][Changed] - Leading slash supplied to `DevServerHelper.downloadBundleResourceFromUrlSync` will now be trimmed and emit a warning.
Reviewed By: robhogan
Differential Revision: D71333088
fbshipit-source-id: 636c9c6c6919d1e9d4a829ed5ae7253f829e549c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50071
Pull Request resolved: https://github.com/facebook/react-native/pull/50070
Changelog:
[General][Internal] Send code and close reasons when we close the connection to any websockets from the dev middleware
This should improve the debuggability of our code.
Reviewed By: robhogan
Differential Revision: D71314509
fbshipit-source-id: 1d6fc57a8601bcea78e95a87d423c7c46c51e799
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49950
Changelog: [GENERAL][CHANGED] - Changed `react-native-codegen` to support types under `CodegenTypes` namespace
## Summary
Currently, codegen relies on deep importing types under `react-native/Libraries/Types/CodegenTypes` to be properly type-checked. Updating codegen to support types under a single namespace will enable us to provide a single import from the package with access to all relevant types.
Reviewed By: huntie
Differential Revision: D70967809
fbshipit-source-id: 41241dcc51965f4243acd34e8b63475cb56ca67a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50030
In Flow importing Node from react is equivalent importing ReactNode in Typescript. During translation Node is not translated to ReactNode but React.Node is translated to React.ReactNode. The easiest solution is to migrate all "Node" types to "React.Node" so that the translation is correct. To make sure that everyone follow the lint rule is added that checks for Node imports from react.
Changelog:
[Internal] - Added lint rule preventing "Node" imports from react and migrated "Node" types to use React namespace in react-native
Reviewed By: javache, huntie
Differential Revision: D71189533
fbshipit-source-id: baea8feb46be3dc30b6e58bcefe140655ec0530a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50027
Changelog: [IOS][CHANGED] - Overwrite betterHitTest in RCTScrollViewComponentView instead of changing layout metrics of the container view
## Summary:
In https://github.com/facebook/react-native/pull/49855 I changed the container view of `RCTScrollViewComponentView` to be `RCTViewComponentView` instead of `UIView` so the touches would bass through its `betterHitTest` implementation (along with udating its layout metrics so the right path in the function is chosen). This resulted in some issues and the alternative approach of customizing the hit testing of the ScrollView itself might be a better approach.
This PR changes overwrites the `betterHitTest` method in a way that the `containerView` is entirely skipped during hit testing, instead forwarding the call to its children. This way, it won't prevent touches outside its frame from being delivered to children that extend out of the frame.
Reviewed By: cipolleschi
Differential Revision: D71187882
fbshipit-source-id: 9d0c79048f389b9bee37dea1e59226b54ddbe6f2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50028
Changelog: [IOS][CHANGED] - Replace a workaround for measuring multiline text with `maximumNumberOfLines` on iOS with a proper solution
## Summary:
In https://github.com/facebook/react-native/pull/49549 support for `numberOfLines` was added to iOS `TextInput`. Along that, a workaround for measuring multiline text with limited number of lines was added to avoid an edge case coming from `NSTextContainer` measuring empty lines even if they are over the line limit.
This PR handles that case properly by counting and measuring individual lines to properly handle the offending edge case.
Reviewed By: NickGerleman
Differential Revision: D71111841
fbshipit-source-id: 6adb4450a13fcc845604622ea76576658a7537aa