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

1756 Коммитов

Автор SHA1 Сообщение Дата
Luna Wei 7248291d5d Simplify logic
Summary:
Changelog:
[Internal] - Simplify logic by not creating an unnecessary object

Reviewed By: kacieb

Differential Revision: D27371155

fbshipit-source-id: c34db151f57f9f6e46cc1984a5a9ef24f81adecd
2021-03-29 18:34:30 -07:00
Kacie Bawiec eacabe1398 Convert ScrollViewStickyHeader to functional component and gate the change
Summary:
Changelog:
[Internal][Added] - Use injected ScrollViewStickyHeader if set

Reviewed By: lunaleaps

Differential Revision: D26931404

fbshipit-source-id: 6f6f1b501b610a05999898be3e2ce08aeb4dab1b
2021-03-29 15:25:19 -07:00
simek 95f7c791c5 remove unused VR-only props (#31230)
Summary:
It looks like `ScrollView` still contains the remnant props for VR platform, which afaik has be discontinued a while ago (please correct me, if I'm wrong).

This PR removes `scrollBarThumbImage` prop marked as VR platform only prop from `ScrollView`.

## 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
-->

[VR] [Removed] - remove VR platform specific `scrollBarThumbImage` prop from `ScrollView`

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

Test Plan: CI

Reviewed By: javache

Differential Revision: D27367267

Pulled By: PeteTheHeat

fbshipit-source-id: b76fdb0e03c443aaf87308162bf75f8683220918
2021-03-29 03:32:09 -07:00
Kacie Bawiec d754bdefc6 Fix ScrollViewStickyHeader to push up header above it
Summary:
When there are multiple sticky headers, ScrollViewStickyHeader should push up the header above it when it gets to the top.

This behavior was accidentally changed in D21948830 (fa5d3fb6b8) when this component was fixed to work in Fabric.

This diff added a new variable `_shouldRecreateTranslateY`, which determines whether the `translateY` value should be recreated on render. `_shouldRecreateTranslateY` was not being set to true during `setNextHeaderY`, so the next header's Y value was never accounted for at render.

Changelog:
[General][Fixed] Fix ScrollViewStickyHeader to push up header above it

Reviewed By: lunaleaps

Differential Revision: D27277829

fbshipit-source-id: 83c9aacd454be178649bf8d060d1a5c750f4060f
2021-03-25 11:32:42 -07:00
Daniel Sainati 05418f8fcc codemod objects to interfaces where they appear as supertypes of classes
Summary:
Flow is changing the behavior of object types to no longer be valid supertypes of classes. This replaces object types when they appear as supertypes of classes to be interfaces to avoid errors when this change rolls out.

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D27193522

fbshipit-source-id: c3e3fca8a4cacd90770a95b773ff2c659774b9a6
2021-03-23 10:26:19 -07:00
Jesse Katsumata f69e096bb4 feat: set disabled accessibilityState when TouchableHighlight is disabled (#31135)
Summary:
https://github.com/facebook/react-native/issues/30950

automatically set `disabled` to accessibilityState when TouchableHighlight is disabled

## 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] [Changed] - Set disabled accessibilityState when TouchableHighlight is disabled

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

Test Plan: Tested on physical android device that pressing disabled TouchableHighlight announces "dim" when talkback is on

Reviewed By: yungsters, nadiia

Differential Revision: D27157207

Pulled By: kacieb

fbshipit-source-id: b8e24aad699c43cf02401b3ba39726a06b751995
2021-03-22 14:04:16 -07:00
David Vacca eacc94005b Extend AccessibilityInfo.sendAccessibilityEvent to support 'click' event for Android
Summary:
This diff extends AccessibilityInfo.sendAccessibilityEvent to support 'click' event on RN Android

changelog: [internal] internal

Reviewed By: kacieb

Differential Revision: D27060395

fbshipit-source-id: 5bf7479d72efb66c3a388fc3ea11990e285ca054
2021-03-20 03:01:01 -07:00
Kacie Bawiec d40f2a29c6 Switch AdsManagerRefreshableScrollView to use ElementConfig instead of ElementProps
Summary:
Changelog:
[Changed] Removed rest operator from ScrollViewStickyHeader props

Reviewed By: lunaleaps

Differential Revision: D27100507

fbshipit-source-id: 7d90ebeaf757bcaed0b125a4a8abf44f07adf98f
2021-03-18 08:03:38 -07:00
Huzaifa Khan 5889cbebe3 Added talkback support for button accessibility: disabled prop (#31001)
Summary:
Issue # https://github.com/facebook/react-native/issues/30934 .When using a screen reader disabled buttons do not announce that they are disabled.

## Changelog

[Android] [Changed] - Passing accessibility state in button so it can announce disabled in talkback

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

Test Plan:
I have added Button in Button Example with accessibiltyState prop that will announce button is disabled when testing with talkback.

## Ios test
I am unable to run ios project on my machine. RNTesterPods.xcworkspace gives workspace integrity error :/

Reviewed By: kacieb

Differential Revision: D26492483

Pulled By: lunaleaps

fbshipit-source-id: c4bbe8ca896b0d303976591c300ccac67a96ac73
2021-03-11 12:02:40 -08:00
David Biedenbach 310a6bcf4b Fix Issue 10718: Add iOS support for progressViewOffset (#30737)
Summary:
Fixes https://github.com/facebook/react-native/issues/10718, bringing `progressViewOffset` support to iOS.

Thanks to Taylor123 for the initial PR upon which this fix is based.

## Changelog

[iOS] [Fix] - `progressViewOffset` prop of `RefreshControl` and `VirtualizedList` now works on iOS

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

Test Plan:
Tested with quick-and-dirty sample app.

![progressViewOffset-iOS](https://user-images.githubusercontent.com/1563532/104526540-82fe1d80-55b7-11eb-9f99-e025bedf4874.gif)

## Documentation

The corresponding documentation update PR can be found [here](https://github.com/facebook/react-native-website/pull/2441).

Reviewed By: kacieb

Differential Revision: D26813977

Pulled By: sammy-SC

fbshipit-source-id: 45cc5a647d70e44a29c6391b7586cb41ca011bef
2021-03-11 10:27:25 -08:00
Tim Yung 035718ba97 RN: Restore Deprecated Event Methods
Summary:
Restore deprecated event listener removal methods in order to minimize breaking changes for the next release. The methods will work, but they will not report a warning via `console.error`.

Changelog:
[General][Added] - `EventEmitter.removeListener` now emits a deprecation notice.
[General][Added] - Restored `AppState.removeEventListener` with a deprecation notice.
[General][Added] - Restored `Keyboard.removeEventListener` with a deprecation notice.
[General][Added] - Restored `Linking.removeEventListener` with a deprecation notice.

Reviewed By: nadiia, kacieb

Differential Revision: D26589441

fbshipit-source-id: 7d89982a182cf2163136e157d4c1beee91c30393
2021-03-10 16:06:26 -08:00
Yan Zhang ffba25c648 add a hide-on-scroll feature to ScrollView
Summary:
Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up
Changelog:
[General][Added] - Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up

Reviewed By: JoshuaGross

Differential Revision: D26900810

fbshipit-source-id: 6bfb1a4da07fff0763223d60836df187f9d95dd6
2021-03-09 12:36:20 -08:00
David Vacca 4c73ab08ed Migrate AndroidDropdownPicker to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates AndroidDropdownPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26810196

fbshipit-source-id: 7be0396d49d9e1413d424ab1be035cbb6a211706
2021-03-04 13:54:45 -08:00
David Vacca aeed84d361 Migrate AndroidDialogPicker to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates AndroidDialogPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26799476

fbshipit-source-id: d6605f60cc083d1d22b4f0fc0a2f79881502b1b4
2021-03-04 13:54:45 -08:00
David Vacca ce0b7e080b Migrate RCTPicker to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates RCTPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26799477

fbshipit-source-id: 2f5935e0a4796c7a76921762a087cf7823ebd62e
2021-03-04 13:54:45 -08:00
Kacie Bawiec 921c9ff165 Fix sticky header not sticking on first render in ScrollView
Summary:
# The bug
Sticky headers would not "stick" to the top of the ScrollView on initial render. On subsequent redners, all sticking would work correctly.

# Why the bug existed
This code to initialize the animated values used for sticky headers was in `UNSAFE_componentWillMount` prior to D26375818 (1641d46529). `UNSAFE_componentWillMount` is called before `render`.

In D26375818 (1641d46529), I moved the code into `componentDidMount`, which is called after `render`.

This caused a problem because code in `render` was relying on these initializations being done already.

# How I resolved the bug
To resolve this, I initialize these values in the constructor.

# Reference
Docs for React mount ordering: https://reactjs.org/docs/react-component.html#mounting

Changelog:
[General][Fixed] Fix sticky header not sticking on first render in ScrollView

Reviewed By: nadiia

Differential Revision: D26792003

fbshipit-source-id: c575e8cdd1d986ce3c38941d95d763e329e74874
2021-03-03 15:19:00 -08:00
Nadiia D 397bfa6ad7 Hide caret during test runs
Summary:
Changelog:
[General][Changed] Hide caret in the TextInput during test runs.

Reviewed By: lunaleaps

Differential Revision: D26728766

fbshipit-source-id: b75827f00b4d5c6243d93106093f97b40dc4b366
2021-03-02 18:04:28 -08:00
Joshua Gross 4e243ca7a3 Fix RTL scrolling
Summary:
We recently fixed RTL scrolling in Fabric on iOS: D26608231 (e5921f7f38)

Turns out, the mechanism for RTL scrolling on Android is completely different. It requires that content be wrapped in a "directional content view", which is `View` in LTR and `AndroidHorizontalScrollContentView` in RTL, backed by `ReactHorizontalScrollContainerView.java`.

iOS doesn't require that and just uses View and some custom logic in ScrollView itself.

In the future it would be great to align the platforms, but for now, for backwards-compat with non-Fabric and so we don't have to tear apart ScrollView.js, we codegen the AndroidHorizontalScrollContentView so it exists in C++, register the component, and stop mapping it to View explicitly in C++.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D26659686

fbshipit-source-id: 3b9c646dbdb7fe9527d24d42bdc6acb1aca00945
2021-02-25 10:09:32 -08:00
Nadiia D 7b09eb54e7 Use flow strict-local
Summary:
Changelog:
[General][Changed] TextInput: use flow strict-local

Reviewed By: kacieb

Differential Revision: D26573763

fbshipit-source-id: 9d7d48310dd41949d07ad7616c4713b521c2545d
2021-02-22 18:30:01 -08:00
Nadiia D c4aa411ee3 Replace Touchable with usePressability hook
Summary:
Changelog:
[General][Changed] textInput component changes:
- use Pressability hook directly
- no more cloning the component

Reviewed By: yungsters, kacieb

Differential Revision: D26573762

fbshipit-source-id: 17b47c8b0b9af22796d6e1528e8e3c16b5ed5d51
2021-02-22 15:39:57 -08:00
Nadiia D 7f005e6077 Add cancelable prop, use mixed return type for event handlers
Summary:
Changelog:
[General][Added] Added `cancelable` prop to Pressable.
[General][Changed] Event handlers return mixed type instead of void.

Reviewed By: yungsters

Differential Revision: D26432837

fbshipit-source-id: c7bafdec085d08a06e859b45bff91a3b07d747ed
2021-02-19 17:54:19 -08:00
Paige Sun 10f8c1a1c0 Add ViewConfig for MultilineTextInput
Differential Revision: D26463558

fbshipit-source-id: fe73e60f9a03d865bc9deab59260321072151e22
2021-02-18 09:20:22 -08:00
Kacie Bawiec aaede1029d Remove UNSAFE_componentWillReceiveProps
Summary:
This diff removes `UNSAFE_componentWillReceiveProps` and adds the changes to `componentDidUpdate` instead.

Why use `componentDidUpdate`? When reading through the [React docs on removing UNSAFE_componentWillReceiveProps](https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops), it says:
> If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use componentDidUpdate lifecycle instead.

The original usage of `UNSAFE_componentWillReceiveProps` updates the content inset when `props.contentInset` changes. However, we don't always want it to update if the content inset hasn't changed, as calling `setValue` will reset the animated value unnecessarily, and kill any current animations (which we don't want to do). [React Native doc on setValue for reference](https://reactnative.dev/docs/animatedvalue#setvalue).

Changelog:
[General] Use componentDidUpdate instead of UNSAFE_componentwillReceiveProps in ScrollView

Reviewed By: lunaleaps

Differential Revision: D26487276

fbshipit-source-id: 77419deacf5db676cd721b58f34932bd6ca2399f
2021-02-17 15:00:07 -08:00
Kacie Bawiec 1641d46529 Replace UNSAFE_componentWillMount with componentDidMount
Summary:
Changelog:
[General] Replace UNSAFE_componentWillMount with componentDidMount in ScrollView

Reviewed By: nadiia

Differential Revision: D26375818

fbshipit-source-id: 1a33a7fddcf78c05cc1e4f04bd85b48a59290560
2021-02-17 09:58:10 -08:00
Kacie Bawiec 099f67cf8a Move ScrollResponder.Mixin methods into ScrollView and Remove ScrollResponder.js
Summary:
The purpose of this diff is to move all of the ScrollResponder methods into ScrollView to delete ScrollResponder.Mixin.

NOTE: ScrollResponder.Mixin uses a variable named "state" but it does not use React state correctly. Instead of calling `setState()`, state is set using `this.state.item = 123` ([example](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Components/ScrollResponder.js?lines=315)).  This means these are not actually React state - these are functionally just variables. In this stack, these "state" items from ScrollResponder are turned into regular internal variables.

Changelog:
[General][Removed] Moved ScrollResponder.Mixin methods into ScrollView to Remove ScrollResponder.js

Reviewed By: lunaleaps, nadiia

Differential Revision: D20715880

fbshipit-source-id: 99441434a6dc1c8ff3f435e7d6ec2840821e4e05
2021-02-16 08:03:11 -08:00
Micha Reiser cb0764eeb0 Upgrade react-hooks rules
Summary:
Upgrades the `react-hooks` eslint-rules to `4.2.0`

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D26366235

fbshipit-source-id: 04628e8f2a6c56eacba516d877df143c6c81adb8
2021-02-10 07:43:52 -08:00
Tim Yung 1049835b50 RN: Simplify `Keyboard`
Summary:
Simplifies `Keyboard` by removing redundant methods and changing `addEventListener` to return an `EventSubscription`.

Changelog:
[General][Changed] - `Keyboard.addListener` now returns an `EventSubscription` object.
[General][Removed] - Removed `Keyboard.removeListener`. Instead, use the `remove()` method on the object returned by `Keyboard.addListener`.
[General][Removed] - `Keyboard` no longer inherits from `NativeEventEmitter`, so it no longer implements `removeAllListeners`, and `removeSubscription`.

Reviewed By: milroc

Differential Revision: D26163536

fbshipit-source-id: b4bd91627cd027a13fcba269a253823913eb7589
2021-02-08 17:49:31 -08:00
Kacie Bawiec 1c7d9c8046 Fix disabled prop not disabling onPress for voice assistant
Summary:
It is currently possible to activate a disabled Pressable with VoiceOver/TalkBack. This fixes this.

Changelog:
[General][Fixed] Fix disabled prop not disabling onPress for voice assistant

Reviewed By: blavalla

Differential Revision: D26225448

fbshipit-source-id: 67fa10f9e5c50143d986dc709a2fb639fdc3e718
2021-02-08 15:18:50 -08:00
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.

This diff removes all "use strict" directives from ES modules.

Changelog:

[Internal]

Reviewed By: motiz88

Differential Revision: D26172715

fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
2021-02-02 11:12:56 -08:00
Tim Yung ef765d423c RN: Move `TOUCH_TARGET_DEBUG` to PressabilityDebug
Summary:
This is just cleanup. When I migrated components to `Pressability` instead of `Touchable`, I left `TOUCH_TARGET_DEBUG` alone to minimize moving pieces. But I had created `PressabilityDebug` as the eventual destination for this logic.

Now that `Text` is migrated away from `Touchable` (see D26106824 (f275514f27)), this cleans up the final internal reference to `Touchable`.

Changelog:
[General][Changed] - `Touchable.renderDebugView` now accepts `ColorValue` instead of `string | number`.
[General][Removed] - Removed `Touchable.TOUCH_TARGET_DEBUG` property.

Reviewed By: kacieb

Differential Revision: D26108570

fbshipit-source-id: 2694c9a9c29182ae04a77ba6c2e4406fcd5a277e
2021-01-28 14:13:43 -08:00
Joshua Gross 99b7052248 Implement sendAccessibilityEvent in the React(Fabric/non-Fabric) renderer
Summary:
`sendAccessibilityEvent_unstable` is a cross-platform, Fabric/non-Fabric replacement for previous APIs (which went through UIManager directly on Android, and a native module on iOS).

Changelog: [Added] sendAccessibilityEvent_unstable API in AccessibilityInfo and sendAccessibilityEvent in React renderer

Reviewed By: kacieb

Differential Revision: D25821052

fbshipit-source-id: 03f7a9878c95e8395f9102b3e596bfc9f03730e0
2021-01-27 17:37:38 -08:00
David Vacca 4cdafd997a Add supoprt for Text Input view configs
Summary:
This diff adds TextInput in the list of components that support static view configs

changelog: [internal]

Reviewed By: yungsters

Differential Revision: D26040854

fbshipit-source-id: d6b5d3a78ef4657acf3f2c4ebe527ad4ca40bcb5
2021-01-26 14:05:33 -08:00
David Vacca dd60414578 Change flow types of RefreshControl.size prop
Summary:
This diff changes the flow types of RefreshControl.size prop from 'int' to string'. For more context see previous diff of the stack.
This diff will be landed as soon as the native release containing D25933458 (65975dd28d) goes to production.

It's important to clarify that there are currently no usages of this prop in production

Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'

Reviewed By: JoshuaGross

Differential Revision: D25933457

fbshipit-source-id: 2f34566f2f8a097e6d40f63c09ecb3ada2fd8409
2021-01-25 21:05:56 -08:00
Nadiia D 881860886c TextInput: sort props
Summary:
Changelog:
[General][Changed] - Refactor TextInput component

Reviewed By: lunaleaps

Differential Revision: D26009114

fbshipit-source-id: 25676a93d59d43ec6c5073fc481d4b9cd20e2f9a
2021-01-22 13:13:57 -08:00
David Vacca 65975dd28d Change type of SwipeRefreshLayoutManager.size prop from Int to String
Summary:
This diff changes the type of the SwipeRefreshLayoutManager.size prop from Int to String in Fabric.

The current implementation of this prop allows JS developers to use "int" type when fabric is enables and "int or string" types when using Fabric is disabled.
Since long term we want to only support "string" type for this prop, I'm changing the type of the prop to be String.

After my diff Fabric will start supporting only "string" types, non fabric screens will keep supporting "int or string" values.

**Will this break production?**
No, because there are no usages of RefreshControl.Size prop in fbsource

**What about if someone start using this prop next week?**
IMO It's very unlikely because of the nature of this prop, I will be monitoring next week and if there's an usage it will be detected by flow when trying to land D25933457.

Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'

Reviewed By: JoshuaGross

Differential Revision: D25933458

fbshipit-source-id: 55067d7405b063f1e8d9bb7a5fd7731f5f168960
2021-01-17 02:57:02 -08:00
Vladislav Shabanov 6e36d046a3 Fix ScrollView getInnerViewNode and getInnerViewRef ref methods (#30588)
Summary:
Currently ScrollView ref's `getInnerViewNode` and `getInnerViewRef` are unbound and don't work as expected returning empty values. The origin of this problem probably is issued by d2f314af75

Working example of the problem is available here: https://github.com/vshab/RNGetInnerViewBug

This PR binds getInnerViewNode and getInnerViewRef to ScrollView and adds test checking the value of getInnerViewRef.

Before:
![Simulator Screen Shot - iPhone 11 - 2020-12-15 at 02 07 03](https://user-images.githubusercontent.com/6755908/102149544-c7df4900-3e7f-11eb-89de-de39a28fbdb3.png)
After:
![Simulator Screen Shot - iPhone 11 - 2020-12-15 at 01 49 31](https://user-images.githubusercontent.com/6755908/102149559-d168b100-3e7f-11eb-8b27-031c9e43112c.png)

## 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
-->

[JavaScript] [Fixed] - ScrollView: Fix `getInnerViewNode` and `getInnerViewRef` ref methods

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

Test Plan:
1. The test checking the value of getInnerViewRef is added.
2. Example app demonstrating the problem is provided with before/after screenshots.

Reviewed By: TheSavior, nadiia

Differential Revision: D25916413

Pulled By: kacieb

fbshipit-source-id: bf18079682be7c647b8715bd0f36cf84953abcfa
2021-01-14 14:45:55 -08:00
Samuel Susla c42a59af7e Fix detection of Fabric in ScrollViewStickyHeader
Summary:
Changelog: [internal]

Revert a change introduced in https://github.com/facebook/react-native/pull/30333 where rickhanlonii asked it to be reverted as well.

The change breaks sticky header in Fabric.

Reviewed By: rubennorte

Differential Revision: D25883861

fbshipit-source-id: b01305c6def390d0664c7be939ab3fc72186a07a
2021-01-12 09:59:03 -08:00
Valentin Shergin e37e56b042 Back out "Add onFocus and onBlur to Pressable."
Summary:
I suspect it's causing T82781515.

Changelog:
[Category][Type] - Backout of "[react-native][PR] Add onFocus and onBlur to Pressable."

Reviewed By: p-sun

Differential Revision: D25864414

fbshipit-source-id: efba9136edba97d5bd2a0de15f9ddae7dfd24e51
2021-01-10 13:56:27 -08:00
Igor Klemenski cab4da7288 Add onFocus and onBlur to Pressable. (#30405)
Summary:
Starting to upstream keyboard-related features from React Native Windows - this is the Android implementation.
Exposing onFocus and onBlur callbacks on Pressable; they're already declared for View in ViewPropTypes.js, which Pressable wraps.

Registering event listeners in ReactViewManager to listen for native focus events.
## 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
-->

[Android] [Added] - Add onFocus/onBlur for Pressable on Android.

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

Test Plan:
Tested on v63-stable, since building master on Windows is now broken. Screenshots from RNTester running on the emulator:
![image](https://user-images.githubusercontent.com/12816515/99320373-59777e80-2820-11eb-91a8-704fff4aa13d.png)
![image](https://user-images.githubusercontent.com/12816515/99320412-6f853f00-2820-11eb-98f2-f9cd29e8aa0d.png)

Reviewed By: mdvacca

Differential Revision: D25444566

Pulled By: appden

fbshipit-source-id: ce0efd3e3b199a508df0ba1ce484b4de17471432
2021-01-08 13:59:48 -08:00
Kshitij Kotasthane 835117aba3 Added sharedAction example to Share API (#30333)
Summary:
* Added an example for `sharedAction` and `dismissedAction` in Share API examples

**Motivation** - Missing example for `sharedAction` in examples

## 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] [Added] - Added an example in ShareExample.js

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

Test Plan:
* Tested on Android

![sharedAction](https://user-images.githubusercontent.com/26821140/98447958-ed758600-214e-11eb-8a50-67ad5dcebea5.png)

Reviewed By: cpojer

Differential Revision: D25246375

Pulled By: rickhanlonii

fbshipit-source-id: f0d25a04c77ba02c9bea07aceccbfb65b2aa67e9
2021-01-08 12:41:32 -08:00
Rubén Norte fa406ac2aa Implement typed event emitters
Summary:
Adds types to Event Emitters and migrates the most relevant modules using them in `react-native`.

The most relevant file of this diff is `react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js` with the Flow tests showing and testing the behavior of the new types

Changelog: [Internal] Add types for Event Emitters and subclasses

Reviewed By: motiz88

Differential Revision: D25587936

fbshipit-source-id: feeb09f9ad15d383cdd82deaaaba0d12b94e868b
2021-01-07 03:19:04 -08:00
Rubén Norte e2033c5b7b Add FlowFixMes for future violations of typed EventEmitter
Summary:
This prevents having to modify too many files when we add the proper typing for that module

Changelog: [Internal]

Reviewed By: nadiia

Differential Revision: D25586848

fbshipit-source-id: 16001ada4a37a58f83b6e5a4400daebf9257be72
2021-01-04 03:56:57 -08:00
Rubén Norte c7463f0059 Add FlowFixMes for future violations of typed NativeEventEmitter
Summary:
Migrates all usages of `NativeEventEmitter` to `NativeEventEmitter<$FlowFixMe>`.

This prevents having to modify a very large number of files in the same change that adds support for typed events. It adds an unused typed parameter to `NativeEventEmitter` so we can change all usages to add `$FlowFixMe`.

Changelog: [Internal]

Reviewed By: nadiia

Differential Revision: D25575774

fbshipit-source-id: c7979e1502e980401d9c03456282eba333c1606d
2021-01-04 03:56:57 -08:00
Valentin Shergin 00e038689d TextInput measuring error in ScrollResponder downgraded to a warning
Summary:
Even though replacing an error with a warning does not look like a future-proof solution here are the reasons for this:
* The measuring operation might just fail because of the async nature of React Native. And here, from my understanding, we don't even have a good reason for measuring. Auto-scrolling to selected textinput (which is the reason for this code, AFAIK) is a standard feature that OS does for all text input. I suspect that this (very old) feature was built in a timeframe where this system feature was originally broken (sometime before 2016).
* This product-facing API does not have an error-callback, so just loggin an error here is as (not) actionable as logging a warning.
* The error callback was never implemented in the pre-Fabric world, so it *never* got called for years, and now when Fabric is starting calling in some cases, it is being "punished" for this. In the next diff, I will try to retrofit this feature back to Paper to reach parity with Paper.

Changelog: [Internal]

Differential Revision: D25700156

fbshipit-source-id: 319a146b17cc2130848148ad11adbde16e86c5d5
2020-12-29 15:58:56 -08:00
Mike c4950610e4 fix: First press not working after pull to refresh (#30291)
Summary:
According to https://github.com/facebook/react-native/issues/20011, the first onPress will not work after pull to refresh.

Dive into the code, found out that is because the state `isTouching` in `Libraries/Components/ScrollResponder.js` is not updated after the pull to refresh.

Update the `isTouching` state in `scrollResponderHandleResponderRelease` to fix this.

## 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] - First press not working after pull to refresh

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

Test Plan:
### Before
- The first onPress fail
![ezgif-4-c6aa5383e898](https://user-images.githubusercontent.com/48589760/97789482-cd4c4100-1bfb-11eb-8a6b-649e8a966b99.gif)
### After
- The first onPress success
![ezgif-4-195f9f6c302e](https://user-images.githubusercontent.com/48589760/97789488-da693000-1bfb-11eb-9a87-f005e61b8ad0.gif)

Eli:
I tested this myself internally using this code sample:

```
'use strict';

import PlaygroundRoute from 'PlaygroundRoute';
import type {SurfaceProps} from 'Surface';
import TetraText from 'TetraText';
import TetraView from 'TetraView';
import {TouchableOpacity, Text, View, ScrollView, RefreshControl, StyleSheet} from 'react-native';
import * as React from 'react';

type Props = SurfaceProps<PlaygroundRoute>;

class App extends React.Component<{}> {
  constructor() {
    super();
    this.state = {refreshing: true, items: []};
  }

  componentDidMount() {
    this.refresh();
  }

  refresh = () => {
    this.setState({
      refreshing: true,
      items: [],
    });

    setTimeout(
      () =>
        this.setState({
          refreshing: false,
          items: [0, 1, 2, 3, 4, 5],
        }),
      1500,
    );
  };

  renderItem = ({item}) => {
    return (
      <TouchableOpacity onPress={() => alert('pressed!')} key={`${item}`}>
        <Text style={{width: '100%', height: 48, backgroundColor: 'white'}}>
          {item}
        </Text>
        <View style={{width: '100%', height: 1, backgroundColor: 'gray'}} />
      </TouchableOpacity>
    );
  };

  render() {
    return (
      <View style={{flex: 1, padding: 48}}>
        <ScrollView
          style={{
            flex: 1,
            backgroundColor: '#aaa',
            borderColor: 'gray',
            borderWidth: 1,
          }}
          keyExtractor={item => `${item}`}
          refreshControl={
            <RefreshControl
              refreshing={this.state.refreshing}
              onRefresh={this.refresh}
            />
          }>
          {this.state.items.map(item => this.renderItem({item}))}
        </ScrollView>
      </View>
    );
  }
}

export default function Playground(props: Props): React.Node {
  return (
    <App />
  );
}

const styles = StyleSheet.create({
  container: {
    padding: 10,
    paddingTop: 30,
  },
});
```

{F351458967}

Reviewed By: appden

Differential Revision: D25574927

Pulled By: TheSavior

fbshipit-source-id: 7abf8a2f947d94150419e51d46a19e792441c981
2020-12-16 10:14:02 -08:00
Samuel Susla 67309277fe Fix infinite loop in KeyboardAvoidingView
Summary:
Changelog: [General][Fixed] Fix stalling UI due to a bug in KeyboardAvoidingView

I introduced this bug in D22764192 (b08fff6f86).

The stalling was caused by onLayout in JavaScript triggering native layout which called onLayout in JavaScript without terminating condition.

The fix is to only cause native layout once from JavaScript's onLayout function. This makes sure both Fabric and Paper works correctly and UI stall isn't caused.

Resolves:
https://github.com/facebook/react-native/issues/30495
https://github.com/facebook/react-native/issues/30532

Reviewed By: TheSavior

Differential Revision: D25522362

fbshipit-source-id: 602e540bb1c40ae4f421b3e6ebc5a047cd920c17
2020-12-15 12:04:36 -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
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
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