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

1676 Коммитов

Автор SHA1 Сообщение Дата
Agastya Darma 8d198ee5b9 Removing unused import on RCTMultilineTextInputNativeComponent & RCTSingelineTextInputNativeComponent spec. (#29652)
Summary:
This pr removes unused import on RCTMultilineTextInputNativeComponent & RCTSingelineTextInputNativeComponent spec.

## Changelog

[General] [Changed] - Removing unused import on RCTMultilineTextInputNativeComponent & RCTSingelineTextInputNativeComponent spec.

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

Test Plan: TODO

Reviewed By: shergin

Differential Revision: D23346830

Pulled By: sammy-SC

fbshipit-source-id: 59e8cb83a6c1e987e98ba00786a4c54744012466
2020-08-27 15:39:35 -07:00
Tim Yung 9c9e677918 RN: Remove `react-animated` Legacy Package
Summary:
Removes the legacy `react-animated` package configuration and collapses the `Animated/src/` directory into `Animated/`.

Also, reconfigures all references to `Animated/src/` to just be `Animated/`.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22450848

fbshipit-source-id: 9fd4861e9f357d817d82e9fec71967a2936a3830
2020-08-25 14:15:35 -07:00
Tim Yung 982272932c RN: Remove `fbjs/warning` Dependency
Summary:
Replaces `fbjs/warning` call sites in React Native with `console.warn`. A few warnings will now log as warnings without the "Warning:" prefix.

Changelog:
[General][Changed] - Some warnings changed to use `console.warn` without the "Warning:" prefix.

Reviewed By: TheSavior, cpojer

Differential Revision: D22445946

fbshipit-source-id: 96b01e1bdee52b89ff3b808bc9d6cd494f6787f5
2020-08-25 14:15:35 -07:00
Tim Yung 8edd2e3ef6 RN: Extract `ScrollViewContext`
Summary:
Extracts `ScrollViewContext` so that other components can use it without requiring `ScrollView` as a dependency.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D22670035

fbshipit-source-id: 7f902697ad2a60cd1869438e9a2b77e479a18065
2020-08-24 15:24:49 -07:00
David Vacca 62de5c001c Migrate AndroidProgressBarComponent to Fabric
Summary:
This diff migrates AndroidProgressBar component to Fabric

changeLog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D23227857

fbshipit-source-id: c5cbbdcc36e63226286cd714d601f0d4690496b2
2020-08-22 01:46:03 -07:00
Peter Argany 4231551270 Lazily create NativeTVNavigationEventEmitter
Summary:
Every single RN iOS application is initializing this native module on first bundle load, regardless if it is used or not. This wrapperModule makes it lazy.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D23175668

fbshipit-source-id: 0424a62d6c0b4fe7d5ce95f6c96e641a03b5fb2c
2020-08-17 17:01:40 -07:00
Agastya Darma d1f217e829 chore: use es6 import for DrawerLayoutAndroid (#29639)
Summary:
Migrating DrawerLayoutAndroid component to use ES6 import

Slowly migrate each file to use es6 import/exports to make this discussion happen
react-native-community/discussions-and-proposals#201 (comment)

## Changelog
[General] [Changed] - Use ES6 import/export syntax for DrawerLayoutAndroid component

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

Test Plan: Manual RNTester for Android

Reviewed By: TheSavior

Differential Revision: D23110137

Pulled By: mdvacca

fbshipit-source-id: a43b4f3981335c9f532185cec8957e46f35aac7b
2020-08-17 12:52:40 -07:00
Rick Hanlon 208ebed074 Switch TextInput to useLayoutEffect
Summary:
This diff fixes an issue in `TextInput` where `TextInputState.currentlyFocusedInputRef` could maintain a ref to a view that no longer exists. This issue was exposed when upgrading React, where cleanups for passive effects are deferred. This change means that `inputRef.current` would no longer reference the host view *to be* destroyed; it would be null because the view was *already destroyed*.

There are two fixes here that would independently fix the bug and fix the issue better together.

First, we convert `useEffect` to `useLayoutEffect`. `useLayoutEffect` is intended to fire synchronously after all host view mutations, and the cleanup function is intended to fire synchronously before the host view is destroyed, similar to the behavior assumed before. This change is now the correct function to use semantically. However, if we made this change without the second then any change in the order the effects fire would surface the same bug.

So second, move the `inputRefValue).blur()` call to the same effect as unregistering. This is because we currently require the `blur` effect to be called to null out `currentlyFocusedInputRef` in addition to calling `unregisterInput`. That makes the semantic ordering of effects in `TextInput` meaningful. Instead, when a TextInput is unregistered we should always `blur` to clear the `currentlyFocusedInputRef`, which will prevent dispatching events to a view that doesn't exist. If we made this change without the first then there's would be a race condition between calling blur on a TextInput and when that TextInput has been unregistered.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23035358

fbshipit-source-id: ab686b8046d85e2becd8b879b0b4b7e69e672754
2020-08-13 20:02:22 -07:00
Samuel Susla 8fc8cd9aea Add todo notes for nativeID hack
Summary: Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D23003735

fbshipit-source-id: 7814de9e1d280604842e47a969ab3e8d453c50a8
2020-08-10 15:37:12 -07:00
Jesse Katsumata d7b1d3359f chore: use es6 import for scroll view (#29184)
Summary:
Migrate ScrollView component to use ES6 import

motivation: trying to slowly migrate each files to use es6 import/exports to make this discussion happen
https://github.com/react-native-community/discussions-and-proposals/issues/201#issuecomment-588454552

## Changelog

[General] [Changed] - Use es6 import/export syntax for ScrollView component

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

Test Plan:
Test on RNTester for iOS

currently having trouble starting up RNTester on Android, but will update when I'm able to check on Android

Reviewed By: TheSavior

Differential Revision: D22959782

Pulled By: PeteTheHeat

fbshipit-source-id: c909bddda3b5b2edd26a526eedaa67fadd4c2b51
2020-08-05 17:51:13 -07:00
Aniket Kumar bb7aef2dd7 Update ActivityIndicator component (#29523)
Summary:
Fixes https://github.com/MLH-Fellowship/react-native/issues/34

The PR is part of an effort to update the code comments to match the current documentation on the React Native website. The project is a part of the MLH Fellowship program and involves the automatic generation of the website docs from code comments and flow types as the end result.

To learn more about the project you can visit the project wiki:
- [Project Details](https://github.com/MLH-Fellowship/0.4.x-projects/wiki/React-Native-Flowtype-API-Docs-Generator)
- [RN Docs Standards](https://github.com/MLH-Fellowship/react-native/wiki/RN-Docs-standards)

Link to the documentation(the source of truth):
- [activityindicator.md](https://github.com/MLH-Fellowship/react-native-website/blob/master/docs/activityindicator.md)

## Changes
* Update the title and prop description from docs.
* Remove unnecessary `*` from the code comments.
* Add Snack player example specified in the docs to the code comments as JSDoc.
* Add `type` annotation to parse supported datatype by the prop.
* Add `platform` annotation to specify platforms supported by a prop.
* Add `default` annotation to parse default value of prop.

## Changelog
[Internal]

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

Test Plan:
All changes are made to the code comments and thus there is no need for testing.

Reviewed by jevakallio

Reviewed By: cpojer

Differential Revision: D22921419

Pulled By: motiz88

fbshipit-source-id: 3701bf3e3f4e0762529c8a5597263354d5243f07
2020-08-04 08:40:57 -07:00
Aniket Kumar 44cb09ac46 Update Switch component (#29546)
Summary:
Fixes https://github.com/MLH-Fellowship/react-native/issues/60

The PR is part of an effort to update the code comments to match the current documentation on the React Native website. The project is a part of the MLH Fellowship program and involves the automatic generation of the website docs from code comments and flow types as the end result.

To learn more about the project you can visit the project wiki:
- [Project Details](https://github.com/MLH-Fellowship/0.4.x-projects/wiki/React-Native-Flowtype-API-Docs-Generator)
- [RN Docs Standards](https://github.com/MLH-Fellowship/react-native/wiki/RN-Docs-standards)

Link to the documentation(the source of truth):
- [switch.md](https://github.com/MLH-Fellowship/react-native-website/blob/master/docs/switch.md)

## Changes
* Update the title and prop description from docs.
* Remove unnecessary `*` from the code comments.
* Add Snack player example specified in the docs to the code comments as JSDoc.
* Add `type` annotation to parse supported datatype by the prop.
* Add `platform` annotation to specify platforms supported by a prop.
* Add `default` annotation to parse default value of prop.

## Changelog
[Internal]

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

Test Plan:
All changes are made to the code comments and thus there is no need for testing.

Reviewed by jevakallio

Reviewed By: cpojer

Differential Revision: D22921438

Pulled By: motiz88

fbshipit-source-id: eaab1e04252c15d7d3dd18a2b162fa97a4478dd6
2020-08-04 08:22:53 -07:00
Ayush Jain 6b7014ab04 Update the documentation of the Button component (#29155)
Summary:
Fixes https://github.com/MLH-Fellowship/react-native/issues/33

The PR is part of an effort to update the code comments to match the current documentation on the React Native website. The project is a part of MLH fellowship program and involves automatic generation of the website docs from code comments and flow types as the end result.

To learn more about the project you can visit the project wiki:
- [Project details](https://github.com/MLH-Fellowship/0.4.x-projects/wiki/React-Native-Flowtype-API-Docs-Generator)
- [RN Docs Standards](https://github.com/MLH-Fellowship/react-native/wiki/RN-Docs-standards)

Link to the documentation(the source of truth):
- [button.md](https://github.com/MLH-Fellowship/react-native-website/blob/master/docs/button.md)

## Changes
* Update the title and prop description from docs.
* Remove unnecessary `*` from the code comments.
*  Add default value to props.
   * Specify the default value of a prop in the code comments with `default` annotation.
   * For multiple defaults (different devices) use `default {platform android/ios}`.
* Update platforms in props.
  * Use comma separated string with `platform` decorator.
* Add Snack player example specified in the docs to the code comments with `example` annotation.

## Changelog
[Internal]

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

Test Plan:
All changes are made to the code comments and thus there is no need for testing.

[Reviewed by jevakallio](https://github.com/MLH-Fellowship/react-native/pull/18)

Reviewed By: cpojer

Differential Revision: D22767877

Pulled By: motiz88

fbshipit-source-id: ccad8d58dc2888d44d34fdbb94b3c187542e9f2b
2020-08-04 05:50:03 -07:00
Samuel Susla 799654b105 Make sticky header position type relative
Summary:
Changelog: [Internal]

Since D22098586 (476ab7481e) zIndex is only applied to views with position other than static.
Sticky header however needs to have its zIndex applied otherwise it goes below the content.

Reviewed By: mdvacca

Differential Revision: D22843134

fbshipit-source-id: d2e3a21441795b82c44b6d4245ccf89620fd9a8e
2020-07-31 08:48:09 -07:00
Samuel Susla b08fff6f86 Fix race condition in KeyboardAvoidingView
Summary:
Changelog: Fix possible race condition inside `KeyboardAvoidingView`

Fabric has different order of events

In Fabric, `keyboardWillChangeFrame` event is fired before `onLayout`, but in Paper it is the other way around.
`KeyboardAvoidingView` depends on the order of events to function properly. Inside `_relativeKeyboardHeight` 0 is returned if `this._frame` is null.

To fix this, `bottom` margin is recalculated whenever `keyboardWillChangeFrame` or `onLayout` is triggered.

Reviewed By: shergin

Differential Revision: D22764192

fbshipit-source-id: 591ac59af4395a4d43c4e78e4fbc0ff118b292f8
2020-07-27 13:16:38 -07:00
Rubén Norte 4409642811 Migrate large amount of modules to flow strict and strict-local
Summary:
| Group | Before | After | Change |
| Untyped | 50 | 49 | -1 |
| flow | 197 | 155 | -42 |
| flow strict-local | 226 | 185 | -41 |
| flow strict | 33 | 117 | +84

Changelog: [Changed] Improved Flow typing of multiple modules (with migrations to `flow strict` and `flow strict-local`

Reviewed By: motiz88

Differential Revision: D22549140

fbshipit-source-id: ed29415332cfce15b244ee4dea9e13d035543175
2020-07-22 09:46:16 -07:00
Joshua Gross d61a8b7bb8 Pressable Views should not be flattened
Summary:
In Fabric if you use a Pressable or PressableBackground and only provide an `onPress` but don't provide background color or anything else, the View might be flattened away and with it the event handlers.

We assume that if the product engineer is using a Pressable, they want it to do something in the View hierarchy, so force it to never be flattened.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D22557026

fbshipit-source-id: 171c5b51e8d828fbb2816685d188286179a10af9
2020-07-15 18:50:54 -07:00
David Vacca 61cd596137 Remove unused dependency
Summary:
Remove unused dependency

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D22470766

fbshipit-source-id: e49180d1a9eb01e8380fb2bde16b8d4378018693
2020-07-14 21:27:38 -07:00
simek e5a8f4270e fix StatusBar showHideTransition flow type issue (#29034)
Summary:
This small PR adds third, missing [`StatusBarAnimation`](https://github.com/facebook/react-native/blob/master/Libraries/Components/StatusBar/StatusBar.js#L45) possible value to the `showHideTransition` prop validation - `'none'`.

This fixes the following issue when `<StatusBar showHideTransition="none" />` code  is used:

<img width="970" alt="Screenshot 2020-06-02 at 22 39 37" src="https://user-images.githubusercontent.com/719641/83567510-f6b85200-a521-11ea-9f1c-48825d0285bf.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
-->

[iOS] [Fixed] - fix StatusBar showHideTransition flow type issue

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

Test Plan: I have run the `flow` check in the test project which uses local working copy of `react-native` with this change included.

Reviewed By: GijsWeterings

Differential Revision: D22493825

Pulled By: cpojer

fbshipit-source-id: 463badec67e6725cb8711a79aa43d84f9b09f796
2020-07-14 08:38:39 -07:00
David Vacca d5bc0a7bff Fix inconsistency on AndroidTextInput view configs
Summary:
BubblingEventTypes are inconsistent between AndroidTextInputViewConfig.js and ReactTextInputManager.java, this diff fixes this inconsistency

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D22470096

fbshipit-source-id: 3940dcc0ae67a42ac070c06ec2d54bc365eab6b7
2020-07-09 22:20:53 -07:00
Tim Yung caf010914c RN: Remove `fbjs/performanceNow` Dependency
Summary:
Replaces `fbjs/performanceNow` call sites in React Native with `performance.now`.

We did not originally polyfill this in `InitializeCore`, but now we do (and back it with a proper `nativePerformanceNow` implementation). Also, added the missing polyfill to our Jest setup.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22445948

fbshipit-source-id: dcfd9867c050617f6e2a3d0a1eb6f48a44771dda
2020-07-09 11:40:57 -07:00
Tim Yung ae193942fe RN: Remove `fbjs/{keyMirror,keyOf}` Dependencies
Summary:
Removes `fbjs/keyMirror` and `fbjs/keyOf` call sites from React Native.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22438238

fbshipit-source-id: 0f84b6e9d81811f95a2a24886f38ad16b8e6e74f
2020-07-09 11:40:57 -07:00
Lulu Wu 0471f90f16 Change onAssetDidLoad to bubbling event
Summary:
onAssetDidLoad is defined as bubbling event in iOS, change it to bubbling event and adde it to bubblingEventTypes to fix "missing: topAssetDidLoad" error in Viewpoints iOS.

Changelog: [Internal]

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D22209406

fbshipit-source-id: 5da779d9d1d62c70d85d84ad80807ff688e29e2f
2020-06-30 06:40:23 -07:00
Samuel Susla 3d4535a2bb Introduce InputAccessoryView
Summary:
Changelog: [Internal]

Introducing InputAccessoryView.

There is one big difference between Fabric's implementation and Paper's implementation.

Fabric searches for text input from InputAccessoryView, unlike Paper where it is the other way around.

Reviewed By: shergin

Differential Revision: D22160445

fbshipit-source-id: 55313fe50afeced7aead5b57137d711dd1cfd3ae
2020-06-30 01:36:04 -07:00
Chris Dadabo 72285d808d Add accessibilityHint to TouchableNativeFeedback (#29154)
Summary:
The docs suggest that TouchableNativeFeedback [inherits `TouchableWithoutFeedback` props](https://reactnative.dev/docs/touchablewithoutfeedback#props) but `accessibilityHint` was missing.

## Changelog

[Android] [Added] - Add accessibilityHint to TouchableNativeFeedback
Pull Request resolved: https://github.com/facebook/react-native/pull/29154

Test Plan: Not sure how this should be tested, but I'm happy to implement what others may suggest

Reviewed By: kacieb

Differential Revision: D22109459

Pulled By: TheSavior

fbshipit-source-id: 573267a26414a97ba23a1a7995bff1608f9ba34f
2020-06-29 12:57:25 -07:00
Tim Yung 4a1820dbdf EventEmitter: Import `{Native,RCTDevice}EventEmitter`
Summary:
Upgrades `require` expressions of `NativeEventEmitter` and `RCTDeviceEventEmitter` to `import`.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22203919

fbshipit-source-id: 4fdf01b66ba0501d0e0714931923531c97d29be2
2020-06-27 02:18:10 -07:00
Lulu Wu 6f99beff7e Fix for Unsupported top level event type "onAssetDidLoad"
Summary:
Fix for Unsupported top level event type "onAssetDidLoad"

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D22184964

fbshipit-source-id: d1ce920311fb380923ed9a2ef8aa5a49fc9f8dc2
2020-06-24 06:02:47 -07:00
Tim Yung 70a73ca461 EventEmitter: Import `{Emitter => Event}Subscription`
Summary:
Changes dependents of `EmitterSubscription` to instead import the `EventSubscription` type from `EventEmitter.js`.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: cpojer

Differential Revision: D22182309

fbshipit-source-id: 575f4c59248ef50182ddb33911f1e6f3ba88ec07
2020-06-23 13:50:26 -07:00
Jesse Katsumata a69bd9dadf chore: use es6 import for SafeAreaView component (#29143)
Summary:
This PR is to help proceed this discussion. https://github.com/react-native-community/discussions-and-proposals/issues/201#issuecomment-588454552

Converted `require` to `import` for SafeAreaView.

## 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] - switched to es6 import for SafeAreaView
Pull Request resolved: https://github.com/facebook/react-native/pull/29143

Test Plan: Tested that App runs on RNTester

Reviewed By: shergin

Differential Revision: D22109435

Pulled By: TheSavior

fbshipit-source-id: 57dc4ab88bf497b43422b20416afbe4c4a1e001d
2020-06-18 14:41:43 -07:00
Eddie Dugan 078e386024 fix setNativeSelectedPosition native command
Summary:
telling native that `selected` is the new selection is basically ignoring the most recent user input and resetting it back to the previous value. the reason it flips back and forth is that by the next time `onSelect` is called, the above code has updated the value of `selected` (line 63)

Changelog:
[Android] [Fixed] Picker - fix usage of setNativeSelectedPosition in onSelect

Reviewed By: mdvacca

Differential Revision: D22022456

fbshipit-source-id: fe51f9cbd712b5578e9fd9ea2992bd12d48f4ec4
2020-06-12 13:02:32 -07:00
Joshua Gross fa5d3fb6b8 ScrollViewStickyHeader: update position (translateY) in Fabric ShadowTree when scrolling stops
Summary:
In Fabric, some uses of the ScrollViewStickyHeader don't work after scrolling because even though the UI correctly reflects the translateY that the StickyHeader should be at, the underlying C++ Fabric ShadowTree doesn't have the updated parameters.

1. We add a mechanism to pass static props through to animated nodes; these get passed to the platform through the normal commit-diff process. This is to allow passing props to the platform that are also controlled by the animation. This mechanism could be reused elsewhere.
2. In ScrollViewStickyHeader, listen to updates for the translateY value and pass them to the platform when it stops changing - for Fabric only. This noops for non-Fabric since it's not necessary.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21948830

fbshipit-source-id: b203ecde466732203dd12a86e2339e81f66b27e7
2020-06-09 16:35:36 -07:00
Jiayan Zhuang 345d0c1abb delete DEPRECATED_sendUpdatedChildFrames prop from ScrollView
Summary:
Changelog:
[iOS][Removed] - Removed DEPRECATED_sendUpdatedChildFrames prop to ScrollView component because there are no callsites of it anymore

Reviewed By: shergin

Differential Revision: D21941946

fbshipit-source-id: 0b7d6d0986ddff4b250e70e0450a6f7e166b41f4
2020-06-09 15:30:53 -07:00
Ramanpreet Nara 6de3fffc37 Memoize repeated calls to getConstants() in MP Home, and Search
Reviewed By: fkgozali

Differential Revision: D21899206

fbshipit-source-id: 44ab118dc49697c1270d3c3f164c1ddf7bef0be4
2020-06-05 11:35:09 -07:00
Samuel Susla 851d01b0aa Move Collapsable into shared props
Summary:
Changelog: Move collapsable to Shared View props

I'm researching why `collapsable` isn't passed to Fabric UIManager in production build, I discovered that collapsable was Android only prop but in Fabric we use it in iOS as well.

This doesn't fix the collapsable not being passed through but I think this makes code semantically correct.

Reviewed By: mdvacca

Differential Revision: D21862770

fbshipit-source-id: 492c6a15955b907dbbeb8530c81f6a868cf379c3
2020-06-04 04:05:57 -07:00
Vojtech Novak 92160f3144 use React.Children.count for counting children (#28991)
Summary:
just a minor change - uses the [count api](https://reactjs.org/docs/react-api.html#reactchildrencount)

> Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked.

## Changelog

not needed I think
Pull Request resolved: https://github.com/facebook/react-native/pull/28991

Test Plan: tested locally

Differential Revision: D21794081

Pulled By: TheSavior

fbshipit-source-id: bf6d11b2bc854d938aed7268911f89a00bb3f596
2020-05-29 15:00:58 -07:00
David Vacca dc357b859c Revert Virtual Text Press Bug workaround
Summary:
This diff reverts the workaround added as part of D21432793, now that D21432793 is released in production for FB4A / FBiOS

changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D21772129

fbshipit-source-id: 3b39738cb8fc871ec85d87f347c7f0ef408ccc3e
2020-05-28 15:44:04 -07:00
Tim Yung 43c161c30a Touchable: Revert `minPressDuration` on Legacy Components
Summary:
When `minPressDuration` was introduced to `Pressability`, all of the legacy Touchable components inherited the new default.

This restore the former behavior for these legacy components so that only `Pressable` gets the new `minPressDuration` default value.

Changelog:
[General][Fixed] - Revert `minPressDuration` effect on legacy Touchable components

Reviewed By: fkgozali

Differential Revision: D21682764

fbshipit-source-id: b71a61843fae7f0f726155876a064fabd3ba1c64
2020-05-21 14:06:11 -07:00
Tim Yung 8ac467c51b Pressable: Add Support for Inspector Overlay
Summary:
Adds support for the debug overlay (enabled via the Inspector) that the legacy touchable components supported.

Changelog:
[General][Added] - Added Inspector overlay support for Pressable

Reviewed By: TheSavior

Differential Revision: D21614412

fbshipit-source-id: b884e04f8dba1bfd35e61de25d33d6d47bc34b03
2020-05-18 10:24:17 -07:00
Eli White 66103277d2 Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables
Summary:
Text and the other Touchables have this prop called pressRetentionOffset. Pressable should be consistent with that.

Changelog:
[Breaking][General]: Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables

Reviewed By: yungsters

Differential Revision: D21552255

fbshipit-source-id: 31e64bad9e48ac98e4934dd2f4c0a7f526de5cb6
2020-05-13 12:59:48 -07:00
Manvir Singh d54113d8c4 implemented showSoftInputOnFocus for iOS (#28834)
Summary:
`showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243.

On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not)

## Changelog

[iOS] [Added] - Add showSoftInputOnFocus to TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/28834

Test Plan:
You'd use this just like you would in the Android implementation:
```jsx
<TextInput showSoftInputOnFocus={false} />
```

## GIFs
### Before change
![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif)

### After change
![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif)

Differential Revision: D21418763

Pulled By: shergin

fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf
2020-05-11 09:01:33 -07:00
Tim Yung a1ac2518a3 TextInput: Default `blurOnSubmit` in JS
Summary:
Consolidates the logic for the default value of `blurOnSubmit` on `TextInput` in the JavaScript component.

This only materially impacts Fabric.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D21491482

fbshipit-source-id: 16d8aba32e7d0321a4583e87e03405ea587e35d4
2020-05-09 17:24:19 -07:00
João Vieira 16ea9ba813 Support excluding multiple platforms.
Summary:
Currently the schema only allows to exclude a single platform (iOS OR Android). There are cases where we need to exclude multiple. This change converts the previous `excludePlatform` string property into an `excludePlatforms` array.

Changelog:
[Internal][Changed] - Added support to exclude multiple platforms in Codegen.

Reviewed By: sammy-SC

Differential Revision: D21426950

fbshipit-source-id: eff36ffa207109274794b4b300bf6313f8286161
2020-05-07 09:43:52 -07:00
Tim Yung d14b89bd8a RN: Workaround Fabric + Virtual Text Press Bug
Summary:
Workaround for a bug with Fabric when pressing on virtual text.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: JoshuaGross

Differential Revision: D21432793

fbshipit-source-id: fe20eeadd5365707fb71edae7a76d374e26b4c86
2020-05-06 14:23:05 -07:00
Mats Byrkjeland de7f69a58e Fix type of exported Touchables: ComponentType -> AbstractComponent (#28737)
Summary:
Fixes https://github.com/facebook/react-native/issues/28726

When importing TouchableOpacity, it is treated as any by Flow. Replacing ComponentType with AbstractComponent works.

The [Flow documentation](https://flow.org/en/docs/react/types/#toc-react-componenttype) says the following about ComponentType:
> Note: In 0.89.0+, React.ComponentType is an alias for React.AbstractComponent<Config, any>, which represents a component with config type Config and any instance type.

So I'm thinking that since the instance type is treated as any with ComponentType, Flow treats TouchableOpacity as any as well.

## 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] - Fix Touchable{Opacity,Bounce,Highlight} being exported as `any` (Flow)
Pull Request resolved: https://github.com/facebook/react-native/pull/28737

Test Plan: I have done the same changes to react-native in my project's node_modules and seen that the components TouchableOpacity went from any to AbstractComponent with some props. Now I have a bunch of errors because I'm sending in wrong props to some touchables, which is good!

Reviewed By: cpojer

Differential Revision: D21362601

Pulled By: TheSavior

fbshipit-source-id: 5b98cc79eaef034eccdb7f47242f9f44be2ef2b8
2020-05-05 12:44:50 -07:00
Joshua Gross ed29ba13f9 Support `contentOffset` property in Android's ScrollView and HorizontalScrollView
Summary:
For a very long time, iOS has supported the `contentOffset` property but Android has not:

https://github.com/facebook/react-native/issues/6849

This property can be used, primarily, to autoscroll the ScrollView to a starting position when it is first rendered, to avoid "jumps" that occur by asynchronously scrolling to a start position.

Changelog: [Android][Changed] ScrollView now supports `contentOffset`

Reviewed By: mdvacca

Differential Revision: D21198236

fbshipit-source-id: 2b0773569ba42120cb1fcf0f3847ca98af2285e7
2020-04-23 15:39:45 -07:00
Christoph Nakazawa f248ba1c8b Upgrade to Jest 25
Summary:
This diff upgrades Jest to the latest version which fixes a bunch of issues with snapshots (therefore allowing me to enable the Pressable-test again). Note that this also affects Metro and various other tooling as they all depend on packages like `jest-worker`, `jest-haste-map` etc.

Breaking changes: https://github.com/facebook/jest/blob/master/CHANGELOG.md

This diff increases node_modules by 3 MiB, primarily because it causes more duplicates of `source-map` (0.8 MiB for each copy) and packages like `chalk` 3.x (vs 2.x). The base install was 15 MiB bigger and I reduced it to this size by playing around with various manual yarn.lock optimizations. However, D21085929 reduces node_modules by 11 MiB and the Babel upgrade reduced node_modules by 13 MiB. I will subsequently work on reducing the size through other packages as well and I'm working with the Jest folks to get rid of superfluous TypeScript stuff for Jest 26.

Other changes in this diff:
* Fixed Pressable-test
* Blackhole node-notifier: It's large and we don't need it, and also the license may be problematic, see: https://github.com/facebook/jest/pull/8918
* Updated jest-junit (not a Jest package) but blackholed it internally because it is only used for open source CI.
* Updated some API calls we use from Jest to account for breaking changes
* Made two absolutely egrigious changes to existing product code tests to make them still pass as our match of async/await, fake timers and then/promise using `setImmediate` is tripping up `regenerator` with `Generator is already run` errors in Jest 25. These tests should probably be rewritten.
* Locked everything to the same `resolve` version that we were already using, otherwise it was somehow pulling in 1.16 even though nothing internally uses it.

Changelog: [General] Update Jest

Reviewed By: rickhanlonii

Differential Revision: D21064825

fbshipit-source-id: d0011a51355089456718edd84ea0af21fd923a58
2020-04-20 01:27:35 -07:00
Zack Argyle 0a67133124 Make ColorValue public in StyleSheet.js
Summary:
This diff makes the ColorValue export "official" by exporting it from StyleSheet in order to encourage its use in product code.

Changelog: Moved ColorValue export from StyleSheetTypes to StyleSheet

Reviewed By: TheSavior

Differential Revision: D21076969

fbshipit-source-id: 972ef5a1b13bd9f6b7691a279a73168e7ce9d9ab
2020-04-17 13:03:47 -07:00
Christoph Nakazawa 75a6178279 Update Babel to 7.8.x/7.9.x
Reviewed By: motiz88

Differential Revision: D20697095

fbshipit-source-id: ef35d02da0916109ce528d3026f7ca0956911dda
2020-04-15 01:30:45 -07:00
Samuel Susla b861782562 Remove setMostRecentEventCount from TextInput view commands
Summary:
Changelog: [Internal]

We don't use view command `setMostRecentEventCount`, let's get rid of it.

Reviewed By: JoshuaGross

Differential Revision: D21016600

fbshipit-source-id: 6491c063e9d6a89252300cb47c010b248e473f4b
2020-04-14 15:27:59 -07:00
Samuel Susla 9c54bf4199 Remove redundant input from TextInput
Summary:
`const ReactNative` is assigned to but never used. Let's get rid of it.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21016502

fbshipit-source-id: afcb0cfc501adf07e0c4d4452a831160e1cda088
2020-04-14 10:59:43 -07:00