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

19344 Коммитов

Автор SHA1 Сообщение Дата
Saumya Mukul 7e8a18840f Prevent modal dismissal with swipe gestures
Summary:
iOS 13 introduced interactive dismissal for modals https://medium.com/hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e.

This breaks react modals. We're disabling this feature for react modals

Changelog: [iOS][Fixed]  Prevent interactive dismissal for non-fullscreen modals

Reviewed By: shergin

Differential Revision: D19836548

fbshipit-source-id: 2b8c80b863569af48ff1c2cf74658393b1b583fd
2020-02-11 13:09:22 -08:00
Lukas Weber 0d4b0e9417 Fixes RCTReconnectingWebSocket connecting in infinite loop when stopped before it connects (#26864)
Summary:
When `[RCTReconnectingWebSocket stop]` is called and `[RCTReconnectingWebSocket  reconnect]` is scheduled afterwards (i.e. connection didn't happen before `[RCTReconnectingWebSocket stop]` being invoked), it will keep reconnecting forever.

Also fixes retain loop in block within `[RCTReconnectingWebSocket  reconnect]`. When RCTReconnectingWebSocket is stopped and reference to it set to nil, block in reconnect will still keep self alive and reconnecting forever.

I found this edge case when I tried to stop RCTPackagerConnection after some time, so it doesn't spam with `[] nw_socket_handle_socket_event [C34585.1:1] Socket SO_ERROR [61: Connection refused]` when we don' have Metro running (we have brownfield app, so iOS devs don't need Metro running most of the time).

## Changelog
[iOS] [Fixed] -  RCTReconnectingWebSocket is reconnecting infinitely when stopped before getting connected
Pull Request resolved: https://github.com/facebook/react-native/pull/26864

Test Plan:
- Put breakpoint into `[RCTReconnectingWebSocket  reconnect]`
- Start sample RN app **without having Metro running**
- Into AppDelegate add something like
```objc
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
   [RCTPackagerConnection.sharedPackagerConnection stop]
});
```
- After the previous block is dispatched reconnect should not be invoked anymore

Reviewed By: motiz88

Differential Revision: D19767742

Pulled By: rickhanlonii

fbshipit-source-id: dabb2369b06217b961e9d2611257c106d350f70c
2020-02-11 10:54:39 -08:00
Kacie Bawiec 10254a900a Add innerViewRef prop to ScrollView
Summary:
Right now, people are calling `getInnerViewNode` and `getInnerViewRef` to get the ref of the `View` within `ScrollView`. Instead, this change adds a prop to `ScrollView` to give people direct access to that `View` if they need it.

Previous usage:
```
const myRef = React.createRef<React.ElementRef<typeof ScrollView>>();

<ScrollView ref={myRef} />

const innerViewRef = myRef.current.getInnerViewRef();

innerViewRef.measure();

```

New usage:
```
const myRef = React.createRef<React.ElementRef<typeof View>>();

<ScrollView innerViewRef={myRef} />

// now, myRef.current can be used directly as the ref
myRef.current.measure();
```

Changelog:
[Changed][General] ScrollView: Deprecate getInnerViewNode and getInnerViewRef methods. Use innerViewRef={myRef} prop instead.

Reviewed By: TheSavior

Differential Revision: D19713191

fbshipit-source-id: 3304cb94a253dafb458ef49d6331e0e432693431
2020-02-11 10:39:24 -08:00
Chad Smith 29d3dfbd19 add Detox integrations to Android RNTester app
Summary:
This diff adds required Detox integrations to the RNTester app to be able to run Detox end-to-end tests on the Android version of the app.

* Instructions at https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md were followed.
* The `minSdkVersion` version for the app was bumped to 18, as required by Detox.
* I also added build and test configurations in `package.json`
*  The debug app is able to run some of the existing tests, but the release app instacrashes. I do not know the reason for the instacrash at this time.
* CI integrations to build and test the Android app will be added in future diffs

Changelog:
[Internal] add Detox integrations to the RNTester Android app

Reviewed By: TheSavior

Differential Revision: D19566834

fbshipit-source-id: 5dd506bbdbb426a5db18146e5dc7c450a27b1d0c
2020-02-11 10:09:18 -08:00
Rick Hanlon 6ba2aeefa8 LogBox - Deallocate _rootViewController to release surface reference and break cycle
Summary:
This def breaks a reference cycle in logbox causing a memory leak in development.

Changelog: [iOS] [Fix] LogBox - Fix dependency cycle

Reviewed By: PeteTheHeat

Differential Revision: D19768068

fbshipit-source-id: 518b9c66499aa092465a9213f955965bffeebd88
2020-02-11 06:58:15 -08:00
Daniel Sainati 7bd1abec35 enable unsafe addition check in xplat
Summary:
With the release of 0.118 Flow now checks for unsafe additions between numbers and null/void. This enables this check in xplat.

```~/fbsource/fbcode/flow/tool add-comments --bin `which flow` --comment="//flowlint-next-line unsafe-addition=off" ~/fbsource/xplat/js```

`js1 test -u __tests__/flowconfig-sync-test.js`

Changelog: [Internal]

bypass-lint

Reviewed By: nmote

Differential Revision: D19823403

fbshipit-source-id: 1f059de6c9d973cda11930f1fadb485679d4ecec
2020-02-10 17:23:31 -08:00
Samuel Susla acdaf512e5 Apply small style adjustments to reconcileStateWithTree
Summary:
Changelog: [Internal]

There shouldn't be any logical changes to the code.

Reviewed By: JoshuaGross

Differential Revision: D19814500

fbshipit-source-id: 2be492eebb284c7e241662d9d78117badcb2eee4
2020-02-10 15:35:36 -08:00
Samuel Susla bfa00a5d62 Fix ShadowNode.stateRevision value assignment
Summary:
# Problem

We calculate `stateRevision_` in constructor from children, but children change after shadowNode is initialised and before it is sealed. So the `stateRevision_` we calculate in constructor can be incorrect.

# Solution

Recalculate `stateRevision_` whenever children change. This can happen in two methods `ShadowNode::replaceChild` and `ShadowNode::appendChild`. This diff implements this solution.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D19813840

fbshipit-source-id: 8fc3b6601e4618f4ee5b322eebc230e0bbb92e3a
2020-02-10 15:35:36 -08:00
Janic Duplessis 2c1913f0b3 Implement `adjustsFontSizeToFit` on Android (#26389)
Summary:
This adds support for `adjustsFontSizeToFit` and `minimumFontScale` on Android. The implementation tries to match closely the behaviour on iOS (hardcoded 4px min size for example). It uses a simpler linear algorithm for now, opened to improving it now if it is a deal breaker or in a follow up.

See https://twitter.com/janicduplessis/status/1171147709979516929 for a more detailed thread about the implementation

## Changelog

[Android] [Added] - Implement `adjustsFontSizeToFit` on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/26389

Test Plan: Tested by adding the existing `adjustsFontSizeToFit` example from the iOS text page to android. Also added a case for limiting size by using `maxHeight` instead of `numberOfLines`.

Reviewed By: mdvacca

Differential Revision: D17285473

Pulled By: JoshuaGross

fbshipit-source-id: 43dbdb05e2d6418e9a390d11f921518bfa58e697
2020-02-10 15:00:41 -08:00
Jesse Katsumata 9f8e4accfa chore: add description for rejectResponderTermination prop (#28001)
Summary:
Added description for rejectResponderTermination prop for the TextInput, which seemed to have been deleted.
Descriptions are taken from https://github.com/facebook/react-native/pull/16755/files

## Changelog

[Internal] [Added] - Add description for rejectResponderTermination prop for TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/28001

Test Plan: This PR only changes comment, which has no effect on actual function.

Differential Revision: D19820886

Pulled By: TheSavior

fbshipit-source-id: 5cbaafcbae0bdbf6932ef9c7c0c1a75cd6d8794e
2020-02-10 14:48:50 -08:00
Pascal Hartig 4bb0b4f205 Remove `pickFirst` arguments (#27964)
Summary:
This is no longer necessary with the new Flipper release.
Pull Request resolved: https://github.com/facebook/react-native/pull/27964

Test Plan:
This was a built-time problem so the CI jobs would catch this.

## Changelog

[Android] [Removed] - pickFirst options for RNTester and template

Differential Revision: D19815829

Pulled By: passy

fbshipit-source-id: d8f66e64e7e922b8ea18ad6eeec3a1c8e6bc77fa
2020-02-10 13:39:22 -08:00
Valentin Shergin 887ba8f044 Fabric: Support for `State` in `Element<>`
Summary:
Before this change the Element<> API didn't allow to specify state objects and crashed during instantiation of non-null states.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D19816358

fbshipit-source-id: 95ba5e03ea98c0260593462146e8523c95245e2b
2020-02-10 12:43:26 -08:00
Jesse Katsumata 3f5c42f357 fix: prop name for passwordRules (#27999)
Summary:
There was a typo in passwordRules prop for TextInput.

ref:
https://github.com/facebook/react-native/blob/master/ReactCommon/fabric/components/textinput/iostextinput/propsConversions.h#L106-L110
https://github.com/facebook/react-native/blob/master/Libraries/Components/TextInput/RCTSinglelineTextInputViewConfig.js#L126

## Changelog

[iOS] [Fixed] - Fix prop name of passwordRules in TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/27999

Test Plan: run `flow` type check with TextInput that has `passwordRules` in the prop.

Differential Revision: D19805819

Pulled By: TheSavior

fbshipit-source-id: a59729c466eb3f47675c7f1472bec269d6c3ed5d
2020-02-10 11:11:52 -08:00
Will Holen 2bc2b43fd3 Fix RNTester ignoring build mode and always using JSC
Summary:
RNTester ended up using JSC for both jscDebug and hermesDebug. Now it uses the
correct one. It still includes all executors, but it's a step in the right
direction.

ChangeLog: [General] [Fixed] RNTester now uses the VM specified in the build flavor

Reviewed By: passy

Differential Revision: D19752239

fbshipit-source-id: 0db4e5201fc80c2a0b91531e3f4333148c1d9c7c
2020-02-10 11:07:06 -08:00
empyrical ca81037a0a Fabric: Fix various includes (#27947)
Summary:
This pull request fixes a few `#include`s in the Fabric source:

 * Changes `<Glog/logging.h>` to `<glog/logging.h>` in two files, which was an issue for case-sensitive file systems
 * In `ParagraphProps.cpp`, changes the include of `attributedstring/primitives.h` from a relative style to a more absolute style.

## Changelog

[Internal] [Fixed] - Fabric: Fix various includes
Pull Request resolved: https://github.com/facebook/react-native/pull/27947

Test Plan: Fabric compiles perfectly, and the Fabric test suite passes.

Reviewed By: shergin

Differential Revision: D19788148

Pulled By: sammy-SC

fbshipit-source-id: 30a297e8aea50c7c7fd5f48745edf04811a6bdbd
2020-02-10 06:42:50 -08:00
Samuel Susla 291a2ffea2 Change behaviour of view command setTextAndSelection
Summary:
Changelog: [Internal]

When I was originally implementing this view command (D19471025), I misunderstood the desired behaviour.

The text parameter isn't meant to change text in the specified `select` but it is supposed to override text of entire text input.

Reviewed By: shergin

Differential Revision: D19793484

fbshipit-source-id: 64ba36ddfa27ac5a0adf48495cb4e985a429e005
2020-02-10 04:25:01 -08:00
empyrical 37f012c04e Fabric: Fix CXX Stub for TextLayoutManager (#27948)
Summary:
This pull request fixes the CXX stub for `TextLayoutManager`. The signature for `TextLayoutManager::measure` changed slightly, and this patch updates the stub to reflect that.

## Changelog

[Internal] [Fixed] - Fabric: Fix CXX Stub for TextLayoutManager
Pull Request resolved: https://github.com/facebook/react-native/pull/27948

Test Plan: Fabric compiles, and the Fabric test suite passes.

Reviewed By: shergin

Differential Revision: D19788207

Pulled By: sammy-SC

fbshipit-source-id: 8f42cca0be99022b038742728ad4fec6c04d5cf0
2020-02-10 04:15:11 -08:00
Valentin Shergin 91540d74b1 Fabric: Fixing a retain cycle in between State and ShadowNodeFamily
Summary:
This change removes the concept of `StateTarget`, replacing its role with `ShadowNodeFamily`.
When `StateTarget` was built, we didn't have a concept of `Family`, and when we added it we introduced a retain-cycle: ShadowNode -> Family -> StateTarget -> ShadowNode. This diff fixes that.

This change does not change conceptually how the state behaves, it just adjusts internal machinery.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D19799013

fbshipit-source-id: c1360bfbf6b8ac34e2a856a40047eafeb50ed070
2020-02-09 22:28:40 -08:00
Valentin Shergin 085c6d2675 Fabric: Storing data as a shared pointer inside State object
Summary:
Before this change, the concrete component-specific data/payload object associated with a State was stored inside a templated subclass as a normal instance variable; after the change, it's stored as a shared pointer inside the base class. The original motivation was that storing that inside subclass saves us one shared pointer and one heap allocation.

This approach overcomplicated a lot of things and all possible savings are probably compensated with additional complexity (we have to have templated state-update lamdas in subclasses and so on). And to update the data in the previous approach we need to create a shared pointer to data anyway.

This change will allow future improvements in the coming diff.

 Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D19799014

fbshipit-source-id: 287ed939353ba58d9e434d1502ecfbb208c6daa5
2020-02-09 22:28:39 -08:00
Joshua Gross c525ab5e04 Only use State Reconciliation during certain commits from ReactJS, not during State commits or others
Summary:
Only use State Reconciliation during certain commits from ReactJS, not during State commits or others

The idea is that this will have better perf, since many types of commits don't need State Reconciliation at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19794999

fbshipit-source-id: 336325f225d993a6aae9f55cb95a7a2b38a6d853
2020-02-08 11:33:43 -08:00
Joshua Gross 27981ad991 Core: Add "state reconciliation" to commit phase, pre-layout
Summary:
This implements proposal #2 in our State architecture doc: https://fb.quip.com/bm2EAVwL7jQ5

Problem description: see the text in the comment of TreeStateReconciliation.h

Solution: see also comments in TreeStateReconciliation.h.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D19617329

fbshipit-source-id: 845fb5fe27f2591be433b6d77799707b3516fb1a
2020-02-08 11:33:43 -08:00
Héctor Ramos 1f88b0db2e Issues without any template will get closed (#27996)
Summary:
Update the default issue template (e.g. the one shown when no custom template is chosen at https://github.com/facebook/react-native/issues/new/choose, and instead a new issue is opened via https://github.com/facebook/react-native/issues/new) to clarify that moving forward without a template will result in the issue getting closed.

The bot will aggressively close issues that have no labels, and only using a custom template will guarantee your issue has a label.

## Changelog

[Internal] - GitHub-only change.
Pull Request resolved: https://github.com/facebook/react-native/pull/27996

Test Plan: N/A

Differential Revision: D19802342

Pulled By: hramos

fbshipit-source-id: a3e991bec4fc69e91cb5cedf5e2ee6b8ef1148f9
2020-02-07 17:55:52 -08:00
Samuel Susla fb8f5ea07f Implement setTextAndSelection as view command in TextInput
Summary: Changelog: Add view command `TextInput.setTextAndSelection`

Reviewed By: JoshuaGross

Differential Revision: D19789675

fbshipit-source-id: 8eb19bd21b1e153c9639507016a9f452c5f835b0
2020-02-07 14:10:28 -08:00
Samuel Susla 111f04ff11 Implement setMostRecentEventCount as view command
Summary: Changelog: Add view command `TextInput.setMostRecentEventCount`

Reviewed By: JoshuaGross

Differential Revision: D19789587

fbshipit-source-id: a52456cf5d39e25c730bbb2840009220b2242f87
2020-02-07 14:10:28 -08:00
Valentin Shergin 6e7369e1fd Fabric: Enabling `WITH_FBSYSTRACE` for Fabric code
Summary:
Systraces were disabled a year ago in D14019272 because we suspected they can negatively affect perf. We don't think this is the case anymore.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19786284

fbshipit-source-id: 185ed45b134fdcadf131cfddfcf8faf37537a684
2020-02-07 10:14:10 -08:00
Paige Sun edfdafc7a1 Resolve and reject promise for PushNotificationIOS.requestPermissions
Summary:
**Resolve/Reject Promise**
* Add onFulfill and onReject to the `PushNotificationIOS.requestPermissions()` Promise

**Replace Apple-deprecated notification method**
* Old: In iOS 10, `UIApplication.registerUserNotificationSettings` was deprecated. Calling this would then call the AppDelegate's lifecycle function `didRegisterUserNotificationSettings`, and then in the AppDelegate, we'd call `RCTPushNotificationManager.didRegisterUserNotificationSettings` to return the user settings.
[registerusernotificationsettings Doc](https://developer.apple.com/documentation/uikit/uiapplication/1622932-registerusernotificationsettings?language=objc)

* New: Replace deprecated function with Apple's recommended `UNUserNotificationCenter.currentNotificationCenter getNotificationSettingsWithCompletionHandler`, which no longer needs the AppDelegate lifecycle method because it directly returns the user's settings in a completion hander.
[requestauthorizationwithoptions Doc](https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649527-requestauthorizationwithoptions?language=objc)

**Add Tests**
* Add tests on `PushNotificationIOSExample.js` to test that the onFulfill and onReject are called
* On `PushNotificationIOSExample.js`, instead of asking permission upon page load, ask for permission when the user taps the button "Request Notifications (Should Display Alert)".
* Before, asking for permission multiple times before would result in the RN error "cannot call requestPermissions twice before the first has returned", now you can ask for permission as many times as you want because I've removed the now unused `RCTPromiseResolveBlock`.

**Future**
If this works on device (we have to land this to test push on device), we can delete `RTCPushNotificationManager.didRegisterUserNotificationSettings` which is being called from several apps.

Changelog:
[iOS] [Added]  Resolve and reject promise for PushNotificationIOS.requestPermissions

Reviewed By: PeteTheHeat

Differential Revision: D19700061

fbshipit-source-id: 02ba815787efc9047f33ffcdfafe962b134afe6d
2020-02-07 08:50:26 -08:00
Janic Duplessis a35efb9400 Use autolink script in template on iOS (#27984)
Summary:
We use this for RN tester but it is not currently included in npm releases. It cleans up the podfile a lot and will make adding / removing pods easier in the future since it won't require users to update their project.

## Changelog

[iOS] [Added] - Use autolink script in template on iOS
Pull Request resolved: https://github.com/facebook/react-native/pull/27984

Test Plan: Not sure if there is a way to end to end test this but I've been using this autolink script in my fork for a while.

Differential Revision: D19787729

Pulled By: cpojer

fbshipit-source-id: b843ea723085830f13e8f0149833d1beb1efdfac
2020-02-07 02:51:16 -08:00
Sam Goldman cd194b8333 Deploy Flow v0.118
Summary: Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D19784573

fbshipit-source-id: ffd3a25bb947ba139ea800fd1e5d4e84a9e038cb
2020-02-06 22:09:29 -08:00
Jesse Katsumata 82165673fb chore: add eslint back to template (#27983)
Summary:
This PR is part of https://github.com/react-native-community/releases/issues/157#issuecomment-582504146
Adding eslint back to the template package.json

## Changelog

[Internal] [Fixed] - Add eslint back in template
Pull Request resolved: https://github.com/facebook/react-native/pull/27983

Test Plan:
(edited)
- npx react-native init RN062 --version 0.62.0-rc.1
- yarn add -d eslint
- add npm script for lint
- yarn lint

Differential Revision: D19784567

Pulled By: TheSavior

fbshipit-source-id: 9ce24c0b674c2b1ea9fee3ed5614e8922f992f72
2020-02-06 18:52:07 -08:00
Valentin Shergin ed11a12a7c Revert D19235758: Implement onRequestClose for iOS 13+ modals
Differential Revision:
D19235758

Original commit changeset: c0f1d946c77c

fbshipit-source-id: c4a9d7876aa8d07ff5b8419f097b02e9c28e2880
2020-02-06 14:45:42 -08:00
Eli White 1e9db7bd6d Remove animated prop
Summary:
This prop was deprecated in April 2016 in [this commit](2bb1c263db (diff-931cea019b5e9faceffef4e46f1fff08)), first in 0.26.0

It's been a while, we can remove it now.

Changelog:
[Breaking][General] Modal: Remove support for `aniamted` prop (deprecated in 0.26)

Reviewed By: cpojer

Differential Revision: D19762163

fbshipit-source-id: b6173bba066fc9ad0e786f56a946e2f3fa3d79cc
2020-02-06 12:45:09 -08:00
Michał Pierzchała 4e6adc9d62 - Bump CLI to ^4.0.0 (#27976)
Summary:
Upgrading CLI to latest. This diff is intended to be cherry-picked to 0.62.

cc grabbou kelset

## Changelog

[Internal] [Changed] - Bump CLI to ^4.0.0
Pull Request resolved: https://github.com/facebook/react-native/pull/27976

Test Plan: None

Differential Revision: D19769017

Pulled By: cpojer

fbshipit-source-id: c3f5cd8afc0bc26372ee9f9e9dbaf4e68cdec216
2020-02-06 10:49:15 -08:00
Valentin Shergin 8fe6883fea Fabric: Fixed double-application of `opacity` and `background-color` props on TextInput
Summary:
These props are applied to `View`, therefore they most not be a part of base text attributes, so we reset them.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D19764144

fbshipit-source-id: a0d2900e3161c47b83114360c843fa85a4389f8a
2020-02-06 08:16:37 -08:00
Pieter De Baets 13d8f4848e Stub out callFunctionReturnResultAndFlushedQueue
Summary: Changelog: [Internal] Remove unused BatchedBridge.callFunctionReturnResultAndFlushedQueue

Reviewed By: cpojer

Differential Revision: D19765606

fbshipit-source-id: d639e76c48113060013f9e858a669d8b1e4d20e7
2020-02-06 03:35:32 -08:00
Eli White a26d622d04 Remove deprecated support for Alert.prompt with type as Callback
Summary:
This functionality was deprecated in [this commit](e2bd7db732) on Feb 12th, 2019, originall in 0.59.0

Changelog:
[Breaking][General] Alert: Remove deprecated support for Alert.prompt with type as Callback (deprecated in 0.59)

Reviewed By: cpojer

Differential Revision: D19762618

fbshipit-source-id: a8edb6045bbc57d56e75fd281e602f5370ba1810
2020-02-06 02:02:31 -08:00
Eli White 26912bd979 Delete thumbTintColor, tintColor, onTintColor props
Summary:
Deprecations for these props were added in 0.57, June 2018, in this commit: 965adee109 (diff-6ee4e62c750fcd87064f152f53214a05), with warnings added in 9a4fd6b78d (diff-6ee4e62c750fcd87064f152f53214a05)

It has been a couple releases now, so let's clean up the component code and finally remove support.

For instructions on how to migrate off these props, see the commit summary of 965adee109 (diff-6ee4e62c750fcd87064f152f53214a05)

Changelog:
[Breaking][General] Switch: Remove support for thumbTintColor, tintColor, onTintColor props (deprecated in 0.57)

Reviewed By: cpojer

Differential Revision: D19760913

fbshipit-source-id: 8fdcf7af99fecadecf3157c00e6d1cbab8e63268
2020-02-06 01:58:00 -08:00
Jorge Bernal 8e5fac89bb Implement onRequestClose for iOS 13+ modals (#27618)
Summary:
Starting on iOS 13, a View Controller presented modally will have a "bottom sheet" style unless it's explicitly presented full screen.

Before this, modals on iOS were only being dismissed programatically by setting `visible={false}`. However, now that the dismissal can happen on the OS side, we need a callback to be able to update the state.

This PR reuses the `onRequestClose` prop already available for tvOS and Android, and makes it work on iOS for this use case.

Should fix https://github.com/facebook/react-native/issues/26892

## Changelog

[iOS] [Added] - Add support for onRequestClose prop to Modal on iOS 13+
Pull Request resolved: https://github.com/facebook/react-native/pull/27618

Test Plan:
I tested this using the RNTester app with the Modal example:

1. Select any presentation style other than the full screen ones
2. Tap Present and the modal is presented
3. Swipe down on the presented modal until dismissed
4. Tap Present again and a second modal should be presented

![Screen Recording 2019-12-26 at 14 05 33](https://user-images.githubusercontent.com/8739/71477208-0ac88c80-27e9-11ea-9342-8631426a9b80.gif)

Differential Revision: D19235758

Pulled By: shergin

fbshipit-source-id: c0f1d946c77ce8d1baab209eaef7eb64697851df
2020-02-05 21:42:17 -08:00
Joshua Gross 6be37d8c0a Use a mutex to guard access to lastLayoutMetrics_ in ViewEventEmitter
Summary:
Of course, compare_exchange_strong didn't actually do what I wanted.

Using a mutex is simpler and actually has the semantics we want: atomically get the current value, compare, and bail if the value is the same, or swap and continue.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19754451

fbshipit-source-id: 6b0aef217b235959af683ec5e31b07a0dd7bb040
2020-02-05 18:46:09 -08:00
Eli White f555202531 Make JS Animated Driver use forceUpdate in Fabric for list components
Summary:
List components aren't host components so checking if the direct component itself's internals isn't sufficient to know if we are in Fabric. For lists, we have to call through some helper functions to get to the host component.

Hopefully we will fix this in the future by making the lists use forwardRef, or by getting rid of the JS Driver altogether, but for now, this is fine (TM).

Changelog: Internal

Reviewed By: mdvacca

Differential Revision: D19731067

fbshipit-source-id: 0e73583c6bf7c10de30e668a390d29718d31b295
2020-02-05 18:38:28 -08:00
Emily Janzer c32ec1f2ab Add @DoNotStrip annotation to JavaTimerManager.deleteTimer()
Summary:
This method is being stripped in release builds because it's used directly from C++ and not referenced in Java. Adding `DoNotStrip` to prevent this.

Changelog: [Internal]

Reviewed By: PeteTheHeat, mdvacca

Differential Revision: D19708826

fbshipit-source-id: a572f0295ab3b49e5884d0a6c723d65e4bbc9226
2020-02-05 15:26:11 -08:00
Emily Janzer 73427561f7 Use JavaScriptModuleRegistry.getJSModuleName()
Summary:
It turns out that in release builds, proguard is doing something weird with inner classes, so that getSimpleName() is actually returning "OuterClass$InnerClass" in some cases. We have logic to handle this case already in JavaScriptModuleRegistry, so I'm moving that out to a static method that I can access in bridgeless mode.

Also adding tests for it.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D19701703

fbshipit-source-id: 625737bfb50ca8ba2bd26034e2a74c682783ba8a
2020-02-05 15:26:11 -08:00
Christoph Purrer 014bc95135 Make YGValue.h compile with Clang on Windows
Summary:
- We use a fork of Microsoft's react-native-windows which uses a fork of Facebook's react-native
- YGValue.h does not compile with Clang on Windows
- This change should fix that
- I want to put the change here so that it bubbles back to our fork > https://our.intern.facebook.com/intern/diff/D19656093/

#Changelog:
[General][Fixed] Make YGValue.h compile with Clang on Windows

Reviewed By: SidharthGuglani

Differential Revision: D19717489

fbshipit-source-id: ad867ecaf910bb64a777a06c656a1867bb15484b
2020-02-05 13:37:38 -08:00
Pieter De Baets 46dcce0031 Remove unused callFunctionReturnResultAndFlushedQueue
Summary: Changelog: [Internal] Remove unused BatchedBridge.callFunctionReturnResultAndFlushedQueue

Reviewed By: sammy-SC

Differential Revision: D19740946

fbshipit-source-id: 9919d52074180d0fcfb7c0929005f0d925578912
2020-02-05 13:02:06 -08:00
Marcus Zarra 30790be1b5 Adding [super initialize] to correct misreporting by MDCD
Summary:
In working to remove dead code from the code base, we identified that a number of classes that subclassed `RCTEventEmitter` were being reported as unused when they are in active use.  That was due to a lack of a `[super initialize]`.  This diff adds the call to super.

Changelog:
[General] [Added] - Call to `super` in `+initialize` of `RCTEventEmitter`

Reviewed By: javache

Differential Revision: D19727783

fbshipit-source-id: 19c6c7f08e7a8b2f764988fdfcd70f92dbf1b74b
2020-02-05 09:26:56 -08:00
Rick Hanlon 3797a6d464 Add androidx.swiperefreshlayout to RNTester build.gradle
Summary:
Suggested fix from passy

Changelog: [General] [Fixed] RNTester instacrash from missing androidx dependency

Reviewed By: passy

Differential Revision: D19741935

fbshipit-source-id: 62e02169a92b7418471d2228a3d75ffffbe7a6a6
2020-02-05 04:32:42 -08:00
Gabriel Nunes 399bda5284 Fix errors in documentation for Function::callWithThis
Summary:
The documentation in two out of the three variants of `Function::callWithThis` incorrectly stated that the `this` value was to be `undefined` instead of set to `jsThis`, which contradicts the point of the `callWithThis` method existing in the first place. This diff fixes that issue.

Changelog: [General] [Fixed] - Fix documentation comments for HermesJS's `Function::callWithThis` method to accurately reflect how `this` is handled.

Reviewed By: jbower-fb

Differential Revision: D19714074

fbshipit-source-id: 123688c1f7e578d6356bec54604fb6e30f06b0b1
2020-02-04 19:26:02 -08:00
David Vacca 8dcab66e4b Add android log when trying to add a view into a non viewGroup
Summary:
Easy diff to add extra logging when Fabric tries to add a view inside a view that is not a ViewGroup

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D19737506

fbshipit-source-id: ecb858820de7befc385e725c45b537359e39c0e7
2020-02-04 18:54:22 -08:00
Joshua Gross 928fe129db Core: ViewEventEmitter should not emit duplicate onLayout events
Summary:
Simple hack to prevent duplicate onLayout events from being emitted to JS.

Because of the addition of State Reconciliation to the Fabric lifecycle (see previous diff), in certain circumstances entire subtrees can be relayed-out many, many times even though they aren't changing. For JS product code that responds to every onLayout and forces a ReactJS tree commit (see: some usages of VirtualizedList) this can cause an async infinite loop of commits and layouts even though the tree and the LayoutMetrics aren't actually changing. Even though nothing is changing, it can still cause serious performance regressions and even some bugs since the internals of various state machines may assume onLayout won't be called many times.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D19715280

fbshipit-source-id: d879e24f1c7b1f710ad430b7473aa9293d093dea
2020-02-04 17:28:24 -08:00
Jordan Brown 93c4c248ef add react-dom libdef to xplat/js
Summary:
Flow is moving the react-dom libdef to flow-typed. To prepare for that, we should add `react-dom_v16.x.x` to the react-native library definitions

Changelog: [Internal]

Reviewed By: samwgoldman

Differential Revision: D19726257

fbshipit-source-id: b2dcbc938b482b73947cc2683b87229873b573dd
2020-02-04 16:19:13 -08:00
Peter Argany 5ad964ba3e Disable animations in bridgeless mode
Summary:
Bridgeless mode requires all native modules to be turbomodules. The iOS animated module was converted to TM, but reverted due to perf issues. RSNara is looking into it, but it may be an involved fix. As a short term workaround, to unblock release mode testing of bridgeless mode, use `AnimatedMock`.

Changelog: [Internal] Disable animations in bridgeless mode

Reviewed By: RSNara

Differential Revision: D19729827

fbshipit-source-id: e6c4d89258ec23da252c047b4c67c171f7f21c25
2020-02-04 15:30:54 -08:00