Граф коммитов

6269 Коммитов

Автор SHA1 Сообщение Дата
Ramanpreet Nara 6c3dd87ef1 Manual: Migrate from bridge.moduleForName to RCTModuleRegistry
Summary:
All NativeModules that use `[RCTBridge moduleForName:]` to access other NativeModules are now instead using the Venice-compatible RCTModuleRegistry to access other NativeModules.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25508910

fbshipit-source-id: 85fc390063af264f2f2843e5640fa7336a784ab4
2020-12-12 19:02:04 -08:00
Ramanpreet Nara 282b1a880f Manual: Migrate from bridge.moduleForClass to RCTModuleRegistry
Summary:
All NativeModules that use `[RCTBridge moduleForClass:]` to access other NativeModules are now instead using the Venice-compatible RCTModuleRegistry to access other NativeModules.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25508277

fbshipit-source-id: 1b415a5ad4055290940879e100ceaa84ae83feeb
2020-12-12 19:02:04 -08:00
Ramanpreet Nara c7e1355dec Manual: Migrate from bridge.webSocketModule to RCTModuleRegistry
Summary:
All NativeModules that access the _bridge from self to require the WebSocketModule NativeModule now instead get the WebSocketModule NativeModule from the _moduleRegistry.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25500433

fbshipit-source-id: 21aebc5684dd6a058de4e35b042c9fb255ffcb33
2020-12-12 19:02:03 -08:00
Ramanpreet Nara f50d9c41b2 Manual: Clean up bridge.networking -> RCTModuleRegistry codemod
Summary:
Spotted a few errors in Codemod that migrated bridge.networking calls to [_moduleRegistry moduleForName:"Networking"] calls. This diff fixes those mistakes.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25499699

fbshipit-source-id: 29f296fc1011cf65d30e083e0ef001e3185edbfb
2020-12-12 19:02:03 -08:00
Ramanpreet Nara ad6705f142 Codemod: Migrate from bridge.networking to RCTModuleRegistry
Summary:
All NativeModules that access the _bridge from self to require the Networking NativeModule now instead get the Networking NativeModule from the _moduleRegistry.

NOTE: xbgs .networking reveal any other usages. So, there won't be a manual migration diff associated with this codemod.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25499412

fbshipit-source-id: 7b0e33135c6c91ffc1e041ad3ab95f1346a8bc22
2020-12-12 19:02:03 -08:00
Ramanpreet Nara e041c616d1 Codemod: Migrate from bridge.imageStoreManager to RCTModuleRegistry
Summary:
All NativeModules that access the _bridge from self to require the ImageStoreManager now instead get the ImageStoreManager from the `_moduleRegistry`.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25498774

fbshipit-source-id: 1d97888ed2ef8d295aa35cf08cb9e9f3bc33ed05
2020-12-12 19:02:02 -08:00
Peter Argany e0ece12203 Fix duplicate Networking module bug
Summary:
While investigating a bridgeless networking issue, I noticed something very peculiar. **Two** networking turbo modules are built and used in bridgeless mode. Upon debugging, I realized that each of them have a different `TurboModuleHolder`. The reason is the following:
1. In JS, the module's name is [Networking](https://fburl.com/diffusion/f2xu4wie)
2. In ObjC, we call the module "RCTNetworking" (examples in this diff)
3. Both scenarios end up creating the correct Turbo Module: [RCTNetworking](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Network/RCTNetworking.mm?link_ref=search), but the `TurboModuleHolder` doesn't know that "RCTNetworking" and "Networking" are the same. Any other modules accessed this way will have the same issue.

An alternative solution would be to tell `TurboModuleHolder` to strip the `RCT` suffix, which would solve the problem globally. RSNara thoughts?

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D25477044

fbshipit-source-id: 02219de578ef4d19e579110e4242883a30cefcd6
2020-12-11 11:24:27 -08:00
Ramanpreet Nara 1f883192ec Manual: Migrate from bridge.eventDispatcher to RCTModuleRegistry
Summary:
This is an extension of D25449795. I searched for all usages of .eventDispatcher within NativeModules, and migrated them all to the Venice-compatible RCTModuleRegistry API.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25473844

fbshipit-source-id: 2b8deec236e019f3adfb59fadd745c249ff822f4
2020-12-11 10:42:28 -08:00
Ramanpreet Nara 74fd6fb1da Codemod: Migrate from bridge.eventDispatcher to RCTModuleRegistry
Summary:
All NativeModules that use the bridge to require the eventDispatcher are now instead using the RCTModuleRegistry I introduced in D25412847 (0ed81b28d3).

## What does this codemod do?
For all ObjC files that contain `synthesize bridge = _bridge`, migrate calls that access the React Native bridge from `self`, and use it to load the event dispatcher.

**Thoughts on Codemod Safety:** If we can access the bridge from self, then that means that if we synthesize the module registry, we can access the module registry from self. Therefore, this codemod is safe.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25449795

fbshipit-source-id: 2f7235d14659e73d673ae08763dc2cccdde55a19
2020-12-11 10:42:28 -08:00
Ramanpreet Nara de7cc12707 Migrate NativeModules from [self bridge] -> _bridge
Summary:
This should be a noop. It just makes writing codemods easier.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25442218

fbshipit-source-id: dba0c35a6f566e83ed5b7142075fff6929efeada
2020-12-10 20:23:17 -08:00
Kevin Gozali 3af21381df Codegen Android: allow generating Fabric Java component files during build time
Summary:
This commit:
* Generate Fabric component Java files along side Java NativeModule specs, when `USE_FABRIC=1` is set
* Adjust the component codegen to place output files in a subdir based on package name
* Adjust existing Buck targets to filter the right nativemodule vs component java files (this avoids duplicated symbols)
* Compiles the Java output during build time on RNTester/ReactAndroid (Gradle)

Not in this commit:
* Fabric C++ files
* Removing checked-in generated component files.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25416614

fbshipit-source-id: fd670ead2198c9b5a65812c692b7aed9f3d7cd58
2020-12-09 09:19:33 -08:00
Samuel Susla 2092dca003 Add missing @synthesize bridge to VerseThreadView and RCTFileReaderModule
Summary:
Changelog: [internal]

In D25386708 (408bcdeedb) `synthesize bridge` was removed. But two modules actually depend on this.

`RCTFileReaderModule` and `VerseThreadView` which both use it.

Reviewed By: RSNara

Differential Revision: D25423574

fbshipit-source-id: daf95d9b27841cf8d205d8ea2666d5aa69a6d720
2020-12-09 07:27:38 -08:00
Ramanpreet Nara 408bcdeedb Remove unneeded @synthesize bridge from NativeModules
Summary:
This is a codemod. All these NativeModules demand access to the bridge. However, they don't use it.

Changelog: [Internal]

Reviewed By: PeteTheHeat, RoelCastano

Differential Revision: D25386708

fbshipit-source-id: f05f4777d2527e96e53581e7ac58f6be47411dce
2020-12-08 20:27:44 -08:00
David Vacca f96478778c Ensure iOS Native components are initialized when using JS View configs
Summary:
As part of the initialization of Native View configs, the PaperUIManager.getViewManagerConfig() method calls the native side to lazy initialize iOS Native components. This is necessaary to make ensure that native classes are loaded and initialized before a view is created.
Note that this requirement is only necessary when Fabric is disabled.

As part of JS ViewConfigs, we removed the native call to lazy initialize iOS native components. This causes a crash during the creation of NativeViews when JS ViewConfigs are enabled and Fabric is disabled. The rootcase of the exception is that native classes are not properly initialized when the createView method is executed in iOS.

This diff forces the lazy initialization of iOS Native components when JS View configs are enabled and Fabric is disabled. This new mechanism is executed as part of the creation of views and it's ONLY going to be executed when the user navigates to a NON-FABRIC screen, JS ViewConfigs are enabled and the component is not initialized yet.

The extra cost should be minimal or zero.

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D25387014

fbshipit-source-id: fe3bc42f803a805192b419bfb4b7a6b5b1b71b60
2020-12-07 23:14:02 -08:00
Dmytro Voronkevych 0d4985900b Adding support for cancelOnBackground for UserFlow
Summary:
UserFlow API now takes configuration parameter, which is required. It contains of 2 arguments:
* triggerSource
* cancelOnBackround

Reviewed By: swillard13

Differential Revision: D25094721

fbshipit-source-id: 64a468c2168265ade9f8d4cea4beb911637544fa
2020-12-07 10:49:29 -08:00
David Vacca 959bc47c18 Add internal_analyticTag into RCTImageView JS view configs
Summary:
this diff fixes the next error:

```
'RCTImageView' has a view config that does not match native. 'validAttributes' is missing: internal_analyticTag
    in RCTImageView (at Image.ios.js:149)
    in ImageAnalyticsTagContext.Consumer (at Image.ios.js:146)
    in Image (at TintedIcon.js:55)
    in TintedIcon (at TetraIcon.js:98)
    in TetraIcon (at FDSCheckbox.js:67)
    in FDSCheckbox (at TetraListCell.js:820)
    in TetraAddOnSecondary (at TetraListCell.js:576)
    in TetraPressable (at TetraListCell.js:603)
    in TetraListCell (created by TetraListCell)
    in TetraListCell (at RNInternalSettingsUnit.js:35)
    in TetraList (at RNInternalSettingsUnit.js:32)
    in RNInternalSettingsUnit (at RNInternalSettingsDeveloperModeUnit.new.js:73)
    in RNInternalSettingsDeveloperModeUnit (at RNInternalSettingsSurface.js:79)
    in RNInternalSettingsSurface (at withDefaultErrorBoundary.js:30)
    in DefaultError(React.lazy(RNInternalSettingsSurfaceForFacebook)) (at renderApplication.js:47)
```

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D25313414

fbshipit-source-id: ab951d25ac6a80809a2977c80ff059f667cc5595
2020-12-04 10:54:33 -08:00
Kim Svatos 5d8fcde632 Back out "Avoid accessing `self.component` on background thread"
Summary: Changelog: [Internal] backout change dispatching main queue before using it

Reviewed By: shergin

Differential Revision: D25319046

fbshipit-source-id: 4f8952e577cfd9033fb2c2248b9b056a0d468b5d
2020-12-03 19:09:50 -08:00
Héctor Ramos 5eee2f2bc0 Fix Circle CI iOS Tests: Make FBReactNativeSpec dir as needed
Summary:
Quick fix for Circle CI: Ensure FBReactNativeSpec dir exists before touching files.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D25285573

fbshipit-source-id: 8dec496856c90accc687648d7068aadfea24d72b
2020-12-02 16:13:03 -08:00
Héctor Ramos c901c1fbce Integrate Native Module codegen into Xcode build pipeline (#30449)
Summary:
Move the codegen invocation out of Podfiles and into the FBReactNativeSpec Pod itself. With this change, developers do not need to modify their existing project's Podfiles, and yet the codegen will be integrated into their projects automatically by way of the FBReactNativeSpec Pod.

This is accomplished in part by injecting a script build phase into the Pods Xcode project that is generated by CocoaPods. The build phase will save the output of the codegen script to a log in the derived files directory. The codegen will be executed if the codegen log file is not present, or if the contents of the Libraries directory has changed.

The codegen will thus be invoked in these situations:

**RNTester:**
* When `packages/rn-tester/RNTesterPods.xcworkspace` is built, if the codegen output logfile is not present or if the input files have changed.

**OSS React Native apps:**
* When `ios/AwesomeProject.xcworkspace` is built, if the codegen output file is not present or if the input files have changed. Normally, this should not happen, as we do not expect folks to update the contents of `node_modules/react-native/Libraries`.

Pull Request resolved: https://github.com/facebook/react-native/pull/30449

Changelog: [Internal] - Moved codegen invocation out of Podfile and into FBReactNativeSpec Pod

Reviewed By: fkgozali

Differential Revision: D25138896

fbshipit-source-id: 4779f822459cea2c30fd544eee19a49e8d80153d
2020-12-02 14:27:50 -08:00
Emily Janzer d435d26d87 Check if result from native UIManager is null before accessing view config
Summary:
As titled - attempt to mitigate a JS error on iOS while we work on getting JS view configs. It seems like this happens when the bridge is invalid.

Changelog: [Fixed][iOS] Don't throw an error if the UIManager returns null when fetching a view config

Reviewed By: kacieb

Differential Revision: D25247203

fbshipit-source-id: e2003f99b818f9657c60ff95b266be74fe18a94b
2020-12-01 15:02:20 -08:00
Tim Yung aa03c836b4 RN: Migrate `View` to NativeComponentRegistry
Summary:
Migrates `View` to use `NativeComponentRegistry`, which enables configuring it to avoid reflection by using a static `ViewConfig`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25136054

fbshipit-source-id: f2abda1105bd2a8b396db6f1a640430b62bbcdaf
2020-11-28 21:49:58 -08:00
Shelly Willard bb1dcc182e Migrate jsi wrapper + pass markerId to get next instance key
Summary:
Migrating jsi wrapper userflow v2. Also pass markerId to the method that gets instance key

Changelog: [internal]

Differential Revision: D25184462

fbshipit-source-id: c316720b0b3d47b345156bb71d51d6f4c473ceef
2020-11-27 11:15:00 -08:00
Kevin Lin 9528ef27b9 Avoid accessing `self.component` on background thread
Summary: Changelog: [Internal] `self.component` is main thread affined so we need to dispatch to main queue before using it.

Reviewed By: shergin

Differential Revision: D25163182

fbshipit-source-id: a7da0324982354215e0ccb47615f7f121200f12a
2020-11-26 04:06:59 -08:00
Tim Yung f638aff434 RN: Add `NativeComponentRegistry.getWithFallback_DEPRECATED`
Summary:
Creates `NativeComponentRegistry.getWithFallback_DEPRECATED`. This is deprecated from inception because it exists only to support a pattern that should not be necessary.

For any given `NativeX` component, the JavaScript module that calls `NativeComponentRegistry.get('NativeX', …)` should only exist in the JavaScript bundle if the native binary actually supports that native component.

But in today's transitional state of the world, there are JavaScript modules that use `UIManager.getViewManagerConfig('NativeX')` as a means of feature detection.

The purpose of `NativeComponentRegistry.getWithFallback_DEPRECATED` is to bridge this transitional gap. Component should migrate toward initializing the `NativeComponentRegistry` with a runtime configuration provider that enumerates all supported native components. If the native component is not supported, it should return null.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D25109988

fbshipit-source-id: 76f7077904594ca63495d8338905c43712ea02e0
2020-11-20 18:53:14 -08:00
Tim Yung a865bd89d7 RN: Migrate `ImageView` to NativeComponentRegistry
Summary:
Migrates `ImageView` to use `NativeComponentRegistry`, which enables configuring it to avoid reflection by using a static `ViewConfig`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25104446

fbshipit-source-id: dd01bf01ead94ca6632b2653b45becf408953bcf
2020-11-20 18:53:14 -08:00
Tim Yung 9dfefa8da0 RN: Rename to `ScrollViewNativeComponent`
Summary:
There may be assumptions that `Native*.js` contains TurboModule. In order to avoid introducing unplanned breaking changes (especially right before the holidays), roll this back for now.

In doing so, I also realized that I forgot to migrate over `ScrollContentViewNativeComponent`. This does that, too.

Changelog:
[Internal]

Reviewed By: RSNara

Differential Revision: D25129324

fbshipit-source-id: 343c4b800969dab91f7cd9f2bf253788c94d38e6
2020-11-20 18:53:14 -08:00
Mike Vitousek 7f53bb95f7 Suppress errors and switch to new-generics in xplat
Summary:
The Flow team has been building a new implementation of the system that typechecks the body of generic functions and classes. This system is more sound than the previous approach and detects errors that were uncaught previously. This diff turns on the new generic system by setting generate_tests=false in the .flowconfig, and suppresses newly discovered errors.

This diff modifies and re-signs some generated modules, because syncing from www pulled in a ton of other changes that have runtime differences, and I'm not equipped to verify that the changes are safe to land.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D24801184

fbshipit-source-id: bb31fe4c5a4107d183649b436a548df5ff42e217
2020-11-20 00:50:30 -08:00
Tim Yung 00e623ddbb RN: Migrate `ScrollView` to NativeComponentRegistry
Summary:
Migrates `ScrollView` (and its related native components) to use `NativeComponentRegistry`. This will enable it to be configured using experiments to conditionally use the native `ViewConfig` or verify the static `ViewConfig`.

This also cleans up a bunch of the modules and types related to defining the native `ScrollView` component.

This also proposes adopting the same module naming protocol was has been adopted for TurboModules (i.e. `NativeScrollView` instead of `ScrollViewNativeComponent`).

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25098530

fbshipit-source-id: ff1394bfac023daf58e85d5f9068e4f8da3538be
2020-11-19 15:55:23 -08:00
Tim Yung d4e29ecdaa RN: Fix `ScrollView` Type Errors
Summary:
Fixes some of the type errors in `ScrollView` that were previously being suppressed by comments. This also slightly simplifies the implementation of `ScrollView`.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D25097225

fbshipit-source-id: a444db8179c91e264671d8f32431b93c4da8dfc4
2020-11-19 15:55:23 -08:00
Tim Yung 54a067e61e RN: Refactor `ScrollView` Style Splitting
Summary:
Rewrites `splitLayoutProps`, which is only used by `ScrollView`.

- Improve type safety by avoiding `DangerouslyImpreciseStyle`.
- Avoid allocating objects when it is not necessary.
- Avoid allocating a object enumeratig layout props by using a switch statement.

Changelog:
[Internal]

Reviewed By: JoshuaGross, kacieb

Differential Revision: D25097226

fbshipit-source-id: 2050c03b681024212c06a48b7eb05f28c14415f9
2020-11-19 15:55:23 -08:00
Tim Yung 7e7527e7db RN: Preserve Style Type in `flattenStyle`
Summary:
Refactors `flattenStyle` so that it preserves the style type of the argument. This lets us avoid using `DangerouslyImpreciseStyleProp` where we can.

Changelog:
[Internal]

Reviewed By: JoshuaGross, nadiia, kacieb

Differential Revision: D25097227

fbshipit-source-id: df6af6fefab25dbb62e3c81897c3cef98619a9c7
2020-11-19 15:55:23 -08:00
Nick Gerleman 6d2a527984 Avoid eating clicks/taps into ScrollView when using physical keyboard (#30374)
Summary:
This is an extension of https://github.com/facebook/react-native/issues/29798 which was reverted due to cases where the soft keyboard could not be dismissed.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Avoid eating clicks/taps into ScrollView when using physical keyboard

Pull Request resolved: https://github.com/facebook/react-native/pull/30374

Test Plan: Validated with iOS simulator that taps on default ScrollView will dismiss soft keyboard and be eaten if open, but taps are not eaten when emulating a connected physical keyboard.

Reviewed By: kacieb

Differential Revision: D24935077

Pulled By: lyahdav

fbshipit-source-id: 19d9cf64547e40a35f9363896e3abbdccb95b546
2020-11-19 13:12:41 -08:00
Tim Yung 6a547c6c57 RN: Create `NativeComponentRegistry`
Summary:
Creates `NativeComponentRegistry` which makes native component initialization more declarative and configurable through an optionally configurable provider.

The next diff converts `ScrollView` to use this new abstraction as a demonstration. The plan would be to use this to replace all current manual call sites of `registerGeneratedViewConfig`, and then the ones generated via the Babel plugin.

Migrating to this will not change any production behavior, but it will enable verification of `ViewConfig` in development.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084468

fbshipit-source-id: 9c758ddc279bf937a401a868a066907a94098f37
2020-11-19 10:55:50 -08:00
Tim Yung f6b8736b09 RN: Update ViewConfig for ScrollView
Summary:
Updates `ReactScrollViewManager` and the `ViewConfig` for `ScrollView` so that they are equivalent.

- `inverted` was missing.
- `contentOffset` was missing differ on Android. (However, there does not seem to be any perceivable behavior difference besides the native `ViewConfig` being different.)

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084470

fbshipit-source-id: 8bea3b7a692c1038819a4147b174583a4faa71e9
2020-11-19 02:52:00 -08:00
Tim Yung de92e7405d RN: Refactor `ViewConfig` Inflation
Summary:
Refactors the conversion of a `PartialViewConfig` into a `ViewConfig` to a separate function so that it can be reused.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084469

fbshipit-source-id: 8a7f53ff2c68860697c791c37a6abbfd3213a0f9
2020-11-19 02:52:00 -08:00
Luna Wei 003d72d80b Provide default device scale
Summary:
Changelog:
[Internal][Fixed] - Provide a default device scale

Reviewed By: kacieb

Differential Revision: D24975788

fbshipit-source-id: 5f2158d7b704713b6a759734943e52228c9cafbc
2020-11-18 21:27:17 -08:00
Tim Yung 5b527fefcb RN: Fix `registerGeneratedViewConfig` Types
Summary:
Fixes types in `registerGeneratedViewConfig` and also removes some unnecessary hacks for the `ReactNativeViewViewConfig` type.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25076608

fbshipit-source-id: 5cb2060e11db598b42fbb7f2f8aecfd7f4b262ef
2020-11-18 21:19:13 -08:00
Tim Yung e136aa3fc4 RN: Cleanup ViewConfig Types
Summary:
Cleans up the Flow types for React Native ViewConfig. After this diff, we will have two new canonical types:

- `ViewConfig` which is what we get from native and what is registered in the `ReactNativeViewConfigRegistry`.
- `PartialViewConfig` which is what we generate statically and augment at runtime before registering with the `ReactNativeViewConfigRegistry`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25075299

fbshipit-source-id: 4b53927b2db437b615447b711e83db355d0cfa55
2020-11-18 21:19:12 -08:00
Tim Yung 69b4611049 RN: Hoist Reflection from Verification
Summary:
Hoists the call to `getNativeComponentAttributes` out of the verification function so that it's easier to keep track of when this function is and is not called.

The purpose of this will become clearer in a future refactor.

Changelog:
[Internal]

Reviewed By: ejanzer

Differential Revision: D25072600

fbshipit-source-id: bc42461baae3476fa7ecb6186c4256dd23921ed5
2020-11-18 21:19:12 -08:00
Tim Yung 9611a7b43e RN: Move RN$Bridgeless Check to Registration
Summary:
Moves the `RN$Bridgeless` check as part of moving more logic out of the verification function.

Changelog:
[Internal]

Reviewed By: ejanzer

Differential Revision: D25072601

fbshipit-source-id: 929230c02a6eaa1b724f7fd2e1a691a7c20c4b11
2020-11-18 21:19:12 -08:00
Luke Walczak a7c1c5aff2 Add possibility to disable buttons in action sheet ios (#28979)
Summary:
_**Fixed**_ version of [the previous PR](https://github.com/facebook/react-native/pull/28792) after reverting [changes](c8d678abcf (commitcomment-39299254))

----

I've noticed that currently there is no option to disable button within the `ActionSheetIOS`. It can be really useful and decided to extend the API to support that functionality.

I added a new option called `disabledButtonsIndices` to `ActionSheetIOS` which is an array of button indices which should be disabled.

`ActionSheetIOS` documentation - PR https://github.com/facebook/react-native-website/pull/1898

## Changelog

[iOS] [Added] - Add disableButtonsIndices option to ActionSheetIOS component

Pull Request resolved: https://github.com/facebook/react-native/pull/28979

Test Plan:
1. Run the `RNTester`
2. Choose `ActionSheetIOS`
3. Check the fourth example `Show Action Sheet with disabled buttons`
4. `Option 1` and `Option 2` should be disabled

screenshot | gif
 --- | ---
<img width="493" alt="Screenshot 2020-04-30 at 15 16 22" src="https://user-images.githubusercontent.com/22746080/80739025-1ec52780-8b16-11ea-8b1c-30bb40ad8c99.png"> | <img src="https://user-images.githubusercontent.com/22746080/80739043-24227200-8b16-11ea-8bcb-af25eb57baac.gif" width="493" />

Reviewed By: sammy-SC

Differential Revision: D21727497

Pulled By: PeteTheHeat

fbshipit-source-id: 749b6c623eb8a44fe2bd96829ce89be5310e2368
2020-11-18 21:11:48 -08:00
Tim Yung 130618fd85 RN: Suppress RCTVirtualText Warning in Bridgeless
Summary:
The `DummyUIManager` module warns whenever `RCTVirtualText` is initialized. This stops that.

Changelog:
[Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25073194

fbshipit-source-id: 8b9052d1cbb9a4defa5efbd110e1a91cd8884c48
2020-11-18 20:59:24 -08:00
Samuel Susla a6b785553b Check error code returned from vImageBoxConvolve_ARGB8888
Summary:
Changelog: [internal]

If value returned from `vImageBoxConvolve_ARGB8888` is negative, an error occurred.
Converting a negative number to `unsigned long` produces a large positive number (larger than memory). Trying to allocate that much memory fails, malloc returns NULL, and abort triggered inside `RCTBlurredImageWithRadius`.

To fix this we need to check for return value from `vImageBoxConvolve_ARGB8888`.

Documentation: https://developer.apple.com/documentation/accelerate/1515945-vimageboxconvolve_argb8888?language=objc

Reviewed By: JoshuaGross

Differential Revision: D25055827

fbshipit-source-id: 2c46ae6eea5cfcc95c2b552c7cd2bc60125fd24a
2020-11-18 09:39:57 -08:00
Brian Vaughn 68a476103a Name a bunch of anonymous RN contexts
Summary:
Changelog:
[General] [Changed] - Added (DEV-only) `displayName` to some RN contexts to make them more easy to differentiate when debugging.

Reviewed By: lunaleaps

Differential Revision: D24993068

fbshipit-source-id: 4904259eda50444c2f74700a3540ff4fd02ac322
2020-11-16 13:12:09 -08:00
Koichi Nagaoka d85d5d2e19 Fix cannot working Modal's onDismiss. (#29882)
Summary:
Fixes: https://github.com/facebook/react-native/issues/29455

Modal's onDismiss is not called on iOS.
This issue occurred the commit bd2b7d6c03 and was fixed the commit 27a3248a3b.
However, the master and stable-0.63 branches do not have this modified commit applied to them.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Modal's onDismiss prop will now be called successfully.

Pull Request resolved: https://github.com/facebook/react-native/pull/29882

Test Plan:
Tested on iOS with this change:

1. Set function Modal's onDismiss prop.
1. Set Modal's visible props is true. (show Modal)
1. Set Modal's visible props is false. (close Modal)
1. The set function in onDismiss is called.

Reviewed By: shergin

Differential Revision: D24648412

Pulled By: hramos

fbshipit-source-id: acf28fef21420117c845d3aed97e47b5dd4e9390
2020-11-13 23:56:09 -08:00
Tim Yung 480dabd665 RN: Remove Android `setTimeout` Warning
Summary:
Many third-party libraries (especially data management and caching ones) make use of long timeouts.

There are currently no plans to change `setTimeout` on Android to support firing when apps are in the background. In the meantime, this warning is not actionable for developers who are using these frameworks. Their workarounds are to 1) deal with the noise in their logs, or 2) suppress the warning.

Changelog:
[General][Removed] - Removed warning on Android for `setTimeout` with delays greater than 1 minute.

Reviewed By: lunaleaps

Differential Revision: D24964958

fbshipit-source-id: 1b40c8ba95d554c29dec74477aa63ea3ef8e4768
2020-11-13 18:07:37 -08:00
Nadiia D 9be3356e02 replace defaultProps usage in functional components
Summary:
Changelog:
[General] [Removed] - Replace defaultProps usage in functional components

Reviewed By: kacieb

Differential Revision: D24907836

fbshipit-source-id: 05c7381b66c7738790eff5fea594791c3ecfa12e
2020-11-13 17:07:11 -08:00
Samuel Susla 3a0927ce43 Fix memory leak in ScrollViewStickyHeader
Summary:
Changelog: [internal]

`addListener` call needs a matching `removeListener` call. Otherwise a memory leak is introduced to the app.
This memory leak can retain a UIImage on iOS in Fabric and cause OOM.

Reviewed By: JoshuaGross

Differential Revision: D24860489

fbshipit-source-id: 2625e4bfec416d59e048d9b5ada3813019dd107c
2020-11-11 01:59:38 -08:00
Kacie Bawiec 46be292f67 Fix nested FlatList not firing onScrollDragEnd and onMomentum methods
Summary:
With nested FlatLists, three methods aren't firing: `onMomentumScrollBegin`, `onMomentumScrollEnd`, and `onScrollDragEnd`. This is because the nested child lists' methods are not being called.

This copies the solution for this from `onScrollBeginDrag` to the other three methods.

Changelog: [Fixed] Fix nested FlatList not firing onScrollDragEnd and onMomentum methods

Reviewed By: nadiia

Differential Revision: D24803418

fbshipit-source-id: 8685b1ab9f1bd5f67a88d93ac5de628d4bd69024
2020-11-10 09:08:07 -08:00
Paige Sun f27e305056 Fix prefetchImageWithMetadata redbox in AMA
Reviewed By: RSNara

Differential Revision: D24837264

fbshipit-source-id: b2aeef2c051fa15c06cf2eb6350c152b722196c2
2020-11-10 08:39:30 -08:00