Summary:
This changes fix small perf problem in RCTImageManager (and layout!) saving (in my completly non-scientific tests) up to 2 ms.
Maybe that's not much, but it fires during layout (and ShadowNodeTree reconsiliation processes), so it has to be very performant.
Reviewed By: JoshuaGross
Differential Revision: D14072077
fbshipit-source-id: 0baa54584dc3ae6a5f43be13fd152b84801c8539
Summary:
`SharedFunction` implements a pattern of a shared callable object that contains the same executable inside. It's similar to `std::function` with one important difference: when the object is copied, the stored function (and captured values) are shared between instances (not copied).
`SharedFunction` can be stored inside `std::function` because it's callable.
It useful in some scenarios, such as:
* When captured by `std::function` arguments are not copyable;
* When we need to replace the content of the callable later on the go.
We will use it in the coming diffs.
Reviewed By: mdvacca
Differential Revision: D14072078
fbshipit-source-id: 9df4ad2d1b92394e2dfef5c283f35c7c0bd4b500
Summary: We want to use a Regex for potentially more complicated string warnings. This will allow ignoring dynamic rules that include ID fields for example.
Differential Revision: D14079118
fbshipit-source-id: aff01c6b6eedc77cd91638988700c093dcda0488
Summary: Java symbols are likely being stripped at compile-time, preventing Reflection from working properly in C++. Should fix T40449334.
Reviewed By: mdvacca
Differential Revision: D14070629
fbshipit-source-id: f180fa3294b66f660ab1568250c47432cbf0c774
Summary:
This PR fixes no existing issue. BouncyCastle library is used inside React-Native but the current version is not updated anymore and this version is subject to `CVE-2013-0169`
Current maven link : http://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk16/1.46 . The descrption says that this jar is for SDK 1.6 but no updated since 2011.
Proposed maven link : http://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on The description says that that jar is for SDK 1.5 to SDK 1.8 and latest release was done in January 2018.
Nop.
But there was a discussion about bouncy castle few years ago https://github.com/facebook/react-native/issues/2793
[GENERAL] [Changes] robolectric - Upgrade bouncycastle lib to fix CSV vulnerabilities
Pull Request resolved: https://github.com/facebook/react-native/pull/19074
Reviewed By: mmmulani
Differential Revision: D14068062
Pulled By: hramos
fbshipit-source-id: 24e63cab33c3e8b5a088b9a8843afdc23b43553d
Summary: This module has been deprecated for two years. There is `Vibration`, backed by the same native module, with cross platform support.
Reviewed By: rickhanlonii
Differential Revision: D14080979
fbshipit-source-id: 7bf60cfdca9517c6858b3c7f8a2b16eab0ce8e80
Summary: These modules have been deprecated for at least one release or more. By landing this diff now, they will be fully removed from 0.60 (to be released in ~April).
Reviewed By: rickhanlonii
Differential Revision: D14080869
fbshipit-source-id: cf39cc1782eec1dd09750d20b55c76f580320f4d
Summary:
There are couple of packages which are installed as dependency but are not directly used in the project. In this PR I have remove those packages from dependency from the package.json.
[General] [Removed] - Remove the unused packages from package.json
Pull Request resolved: https://github.com/facebook/react-native/pull/23428
Differential Revision: D14065342
Pulled By: cpojer
fbshipit-source-id: 48a423e51d47742dcf0c8a8b2ec43e6a0f2e94fd
Summary:
Lock the version will help us to test new dependency version like ndk or buck.
Pull Request resolved: https://github.com/facebook/react-native/pull/23424
Differential Revision: D14065171
Pulled By: cpojer
fbshipit-source-id: 954297ca7c69ff829a4522f34274ae8ab162b36b
Summary:
Sometimes, when we deal with ImageRequest and ImageResponseObserverCoordinator we subscribe for status (or access the coordinator) without owning an ImageRequest. In those cases, we have to retain the coordinator explicitly.
For those cases, ImageRequest now exposes `ImageResponseObserverCoordinator` as a `std::shared_ptr`.
Eg, concretely in the code, `completionBlock` and `progressBlock` copied a raw pointer to the observer inside which can lead to a crash when ImageRequest is being deallocated before we received an image data.
Reviewed By: JoshuaGross
Differential Revision: D14072079
fbshipit-source-id: e10120bc05bf685e288f7b3d69092714dcd91d43
Summary:
This diff refactors JNI methods used by the Binding.cpp class in order to use ReadableMap instead of ReadableNativeMap
This will be helpful to provide a different implementation of ReadableMap from C++
Reviewed By: shergin
Differential Revision: D14077762
fbshipit-source-id: 595b0c2d3a2d6070112257b65c1141a8af36f0e1
Summary:
This pull request implements some suggestions made in #23414, namely:
* Rename `ShadowNodeFragment::nullSharedProps()` (and family) to `ShadowNodeFragment::propsPlaceholder()`;
* Introduce similar functions for the rest of members (tag and rootTag);
Later pull requests to remove designated initializers from Fabric (for MSVC support) will use these
I'd like to do the rename of `rootTag` to `surfaceId` as well, but would make sense to do in a separate diff as that would result in a great deal of changes.
[General] [Changed] - Changed naming scheme of `ShadowNodeFragment` placeholders, and added placeholders for remaining members
Pull Request resolved: https://github.com/facebook/react-native/pull/23437
Reviewed By: mdvacca
Differential Revision: D14072007
Pulled By: shergin
fbshipit-source-id: d5bb10a82c16d45955f417a49b503f215c4bc521
Summary:
This pull request removes a constructor in `DebugStringConvertibleItem.h` that was causing this issue in MSVC:
```
DebugStringConvertibleItem.cpp(20): error C2600: 'facebook::react::DebugStringConvertibleItem::DebugStringConvertibleItem': cannot define a compiler-generated special member function (must be declared in the class first)
```
It was likely conflicting with the constructor that has default values for all of its arguments.
[General] [Fixed] - Fixed `DebugStringConvertibleItem` compilation on MSVC
Pull Request resolved: https://github.com/facebook/react-native/pull/23436
Reviewed By: shergin
Differential Revision: D14067760
Pulled By: mdvacca
fbshipit-source-id: 303cf9b3559932c3d06514a1f3a8739d0f6f9dc2
Summary:
https://our.intern.facebook.com/intern/sandcastle/job/18014398585083744
```
xplat/js/react-native-github/React/Views/ScrollView/RCTScrollViewManager.m:38:20: warning: 'UIScrollViewContentInsetAdjustmentBehavior' is only available on iOS 11.0 or newer [-Wunguarded-availability-new]
```
Reviewed By: mattrobmattrob
Differential Revision: D14076127
fbshipit-source-id: 4050131c4f5211757383069567a2cf5382979735
Summary: Apparently, I haven't modify all files in D14018903. Here is the last (I hope) chunk.
Reviewed By: JoshuaGross
Differential Revision: D14058288
fbshipit-source-id: b21950cdd1aa9aa55b0c72fac0f8b44e4a7d131c
Summary:
The current system would always end up falling back to `true` for release builds
Pull Request resolved: https://github.com/facebook/react-native/pull/18892
Differential Revision: D14069444
Pulled By: hramos
fbshipit-source-id: 16e32a366b3b2e252a98a967da827ba1ebaeff85
Summary:
Fixes#17989
Previously, `ImagePickerIOS.openCameraDialog` would not render a `Video` option when the camera screen opened. If you passed `ImagePickerIOS.openCameraDialog({ videoMode: true }, ...)` the app would crash with an error complaining about the proper mediaType(s) not being set (see issue: #17989 for full details).
This is a 2 line change that sets the mediaTypes properly, so now users can capture videos in addition to photos.
Pull Request resolved: https://github.com/facebook/react-native/pull/19170
Differential Revision: D14068078
Pulled By: hramos
fbshipit-source-id: d04a3d267ca83ea58e88c880a85ac34ddd4744c8
Summary:
This PR expands the code analysis script to allow for customizing the GitHub Review left by analysis-bot whenever it finds code-level issues.
Some, but not all, `eslint` errors are fixable by running `yarn lint --fix`. When the `eslint` converter finds warnings or errors, the bot will suggest running the command as part of the review.
The script could be adjusted to only suggest this when `eslint` returns a non-zero `fixableErrorCount` or `fixableWarningCount`, but I think this is a good first step to get people to unblock themselves when they see this type of review from the bot.
I've also excluded `bots/` and `scripts/` from eslint as these have several `eslint` errors that need to be addressed. These directories do not contain core RN code, so they can be excluded for now.
[GENERAL] [Changed] - analysis-bot will suggest fixing eslint warnings on code reviews
Pull Request resolved: https://github.com/facebook/react-native/pull/23413
Differential Revision: D14065757
Pulled By: cpojer
fbshipit-source-id: cc588643f7ddb3c4631d89c26b799f7a7244e616
Summary:
This PR is trying to improve Android Network Security configuration introduced in 84572c4051. I found that Android merges all manifest files into a single manifest file when building an app, so this PR provides AndroidManifest.xml with network security config in debug folder, that will be used only for debug builds. Also the network security configuration will be applied to only app that target API 28. Moved security config file to xml-v28, so that it'll only visible to API 28 and above.
See https://developer.android.com/studio/build/manifest-merge
[Android] [Changed] - Android Network Security configuration.
Pull Request resolved: https://github.com/facebook/react-native/pull/23429
Differential Revision: D14065124
Pulled By: cpojer
fbshipit-source-id: 0f5ac5addbe968ed7e5cb57f356e2572de2690a8
Summary:
node 8 image has yarn too. Also the official one has the latest yarn.
Pull Request resolved: https://github.com/facebook/react-native/pull/23425
Differential Revision: D14065105
Pulled By: cpojer
fbshipit-source-id: 4eb3347fc191d928091e984fe3e5887861ec8aa9
Summary:
Here are some leftovers from nullable annotations for native modules, discovered while developing native module in Kotlin. This will help improve Kotlin developer experience
[Android] [Changed] - Add Nonnull annotations to ReactPackage
Pull Request resolved: https://github.com/facebook/react-native/pull/23415
Differential Revision: D14064607
Pulled By: cpojer
fbshipit-source-id: af2ce1fc1911ee03c54b20a4fc3a6d1aba9267da
Summary:
The official node image bundled with yarn by default, and it has maintained by the official group so we can always get the latest version.
Pull Request resolved: https://github.com/facebook/react-native/pull/23423
Differential Revision: D14064773
Pulled By: cpojer
fbshipit-source-id: c24a2bc2d0dda7ae852b25c340ca0d149f4c196c
Summary:
Turn off translations in fbandroid to mitigate the parse time regression. Translate the remaining `xplat//` to `fbsource//xplat/` to do so
run_all_tests
Reviewed By: scottrice
Differential Revision: D14041085
fbshipit-source-id: 9d3bc493c6662c03c4028aaebfbec58d145e8c6b
Summary:
In the past, Alert and AlertIOS were separate modules and both were shipped on Android even though only Alert can be used there. We unified the two modules but it meant that the code for both was still shipped on both platforms.
This diff changes it so that platform specific code is gated in a `Platform.OS` block, which means that the unnecessary code per platform is being stripped out. I'm not looking to win a beauty contest with the code in this module - we have barely touched it in years and I don't think we will touch it anytime soon, so I just merged the sub-classes (which only had static methods anyway) directly into the main class. I'm aware I could make two separate files with platform extensions but that ends up being more code here and it seems straightforward enough to me.
Reviewed By: TheSavior
Differential Revision: D14057404
fbshipit-source-id: 1ae1d227a39d76de9779b3db62960cca46e9b75c
Summary: SizeMonitoringFrameLayout was used to set layout contraints on the root shadow node when the native view's size changes. Since then, we introduced ways for the root node to use proper layout contraints using the root view's measure specs, which provides more accurate constraints for the root node, so SizeMonitoringFrameLayout is no longer needed. This ends up making a lot of UIManagerModule's method signatures cleaner
Reviewed By: mdvacca
Differential Revision: D9565720
fbshipit-source-id: c569cd15991a09987cc01e89612dc9193ad99b45
Summary:
Fixes#22824#21945 , the bug comes from #21208 , it was to fix#11897. Now Let's constrain edge adjust only when view has corners.
[iOS] [Fixed] - Fix triangle views on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/23402
Differential Revision: D14059192
Pulled By: hramos
fbshipit-source-id: be613bf056d3cc484f281f7ea3d08f251971700a
Summary:
'Switch that starts on should switch' appears to be flaky, as it has failed on seemingly unrelated commits, only to succeed on the next CI run. `Switch` is scheduled to be removed from the core repository anyway, so I'm removing this test to ensure we get a clear signal for the rest of the repository.
[GENERAL] [Changed] - Tests: Removed flaky Switch e2e test.
Pull Request resolved: https://github.com/facebook/react-native/pull/23410
Differential Revision: D14057068
Pulled By: cpojer
fbshipit-source-id: dc7bc74c3d23ec3856107fec4ee9fa388adce2e5
Summary:
Ensure that the current openExample (stored in AsyncStorage) exists in the module list.
It's possible for the example to be missing if a test was removed & previously open in RNTester OR when actively developing RNTester tests & switching between branches
[General] [Fixed] - Potential crash in RNTester when removing/developing test cases
Pull Request resolved: https://github.com/facebook/react-native/pull/23406
Differential Revision: D14055695
Pulled By: cpojer
fbshipit-source-id: 6cf00e097e934f7a342e7d210b6319e1cba142ca
Summary:
I'm trying to fix DialogModule crashes we have in production: #6228
In this PR I'm fixing the following problem:
The fragment manager methods should be called only from the foreground. Now dismissExisting is protected by the mIsForeground variable as well as showNewAlert method.
[ANDROID] [Fixed] DialogModule - Race condition in dialog module fixed.
Pull Request resolved: https://github.com/facebook/react-native/pull/19332
Reviewed By: mdvacca
Differential Revision: D13804542
Pulled By: hramos
fbshipit-source-id: 9d59c8eaad49e2d3f141e255467627d411ae8797
Summary:
There's a bug in the OSS Switch component where the track color value is reset to the default value when the switch is toggled. It looks like the Java class resets the track color value in `setOn` (which fires in a press event): https://fburl.com/vmugfzja but these values aren't actually initialized from JS - in Switch.js we only pass through the current track color: https://fburl.com/vytekd0o.
The React component already has an API for defining both true/false track colors. However, we should also make sure not to reset these values for people using the old API of `tintColor`/`onTintColor`, so I'm changing it to only reset the value when both of those props are null.
Reviewed By: mdvacca
Differential Revision: D14035007
fbshipit-source-id: 12d968076bd47d54deedbfc15b12ff3cd77e2fd0
Summary:
Some MP E2E tests started failing when I introduced AnimatedMock (D13811035) with this error:
> message: Timeout exception: Message: element located by locator {"id":"mp_your_items_tab_button"} is not visible
The test relied on the button to animate in, which AnimatedMock disabled. The fix is to complete animations instantly in AnimatedMock. This diff implements that for spring and timing.
Reviewed By: cpojer
Differential Revision: D14036172
fbshipit-source-id: 18a422ce8ef6de05ff9224c94214524511a76949
Summary:
Itwas merged AlertIOS into Alert and removed type parameter from Alert.alert line 60 at Alert.js
[AlertIOS] [Change and Replace] - Merge AlertIOS into Alert.
Pull Request resolved: https://github.com/facebook/react-native/pull/23318
Reviewed By: mjesun
Differential Revision: D14031421
Pulled By: cpojer
fbshipit-source-id: 98db173adeb65aa90d309f8a583993bc0cddb6e1