Summary:
<!--
Required: Write your motivation here.
If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged.
-->
Fixes#13754
Pull Request resolved: https://github.com/facebook/react-native/pull/18889
Differential Revision: D14486115
Pulled By: PeteTheHeat
fbshipit-source-id: 7b8b4fa9d2c99fc5d6145fed4681afdc4bb14fb8
Summary:
Child props were being overridden by `<Touchable>` props even when the `<Touchable>` props were undefined.
[General] [Fixed] - Prevent prop override by TouchableWithoutFeedback when undefined
Pull Request resolved: https://github.com/facebook/react-native/pull/23966
Differential Revision: D14502918
Pulled By: cpojer
fbshipit-source-id: 614ee43bbb6f062a98bd9318693807320979a016
Summary: For some reason the scroll events are sometimes generated with highly irregular spacing, some coming less than a millisecond apart. For interactions that must track scrolling exactly, this can cause them to glitch. With a scroll throttle of less than 17 ms, the intention is clear that the UI should be updated in sync with the scroll view so we shouldn't drop any events.
Reviewed By: PeteTheHeat
Differential Revision: D15068841
fbshipit-source-id: 730e7cb29cc3ddae66f37cf7392e02e0cc9d7844
Summary:
ScrollView's scrollTo behavior on iOS was recently changed to limit the offset to the content size plus any content inset (see #23427). This departure from the old behavior created UI issues for anyone that is using the over-scroll ability for the purpose of positioning elements at specific coordinates on the screen. Examples include using this behavior to position TextInputs above the virtual keyboard programmatically when focused or moving drop down elements positioned near the bottom of the content toward the top of the screen when selected to show a larger absolutely positioned item list. Default behavior does not change and this is an "opt-in" type of prop to re-enable the old behavior.
[iOS] [Added] - Added scrollToOverflowEnabled prop to ScrollView
Pull Request resolved: https://github.com/facebook/react-native/pull/24296
Differential Revision: D14762619
Pulled By: cpojer
fbshipit-source-id: d2a552b5cb321d52e8ea4116327bf9ec647a3aae
Summary:
This diff fixes a bug in TouchableNativeFeedback where a long press is not registered.
cause of the bug is _touchableHandleResponderMove_ being invoked **regardless** of a moving gesture ( even when movedDistance is 0) in some devices ( including OnePlus5t ), which was eventually clearing out the long-press timeout.
fix is to prevent _touchableHandleResponderMove_ from Implementing if the state of touchable is RESPONDER_INACTIVE_PRESS_IN.
[General] [Fixed] - Touchable onLongPress fix.
Pull Request resolved: https://github.com/facebook/react-native/pull/24238
Reviewed By: cpojer
Differential Revision: D14712986
Pulled By: rickhanlonii
fbshipit-source-id: e85a66a7e8b61e0a33146b2472e2e055726a0e93
Summary:
There's a bug in the OSS Switch component where the track color value is reset to the default value when the switch is toggled. It looks like the Java class resets the track color value in `setOn` (which fires in a press event): https://fburl.com/vmugfzja but these values aren't actually initialized from JS - in Switch.js we only pass through the current track color: https://fburl.com/vytekd0o.
The React component already has an API for defining both true/false track colors. However, we should also make sure not to reset these values for people using the old API of `tintColor`/`onTintColor`, so I'm changing it to only reset the value when both of those props are null.
Reviewed By: mdvacca
Differential Revision: D14035007
fbshipit-source-id: 12d968076bd47d54deedbfc15b12ff3cd77e2fd0
Summary:
In API 26, autofill framework was introduced in Android.
Read more about Autofill at https://developer.android.com/guide/topics/text/autofill.
Now, if in case for some text input if developer wants to disable
autofill then he can take help from this `importantForAutoFill` prop
and pass `no` to it.
Also important of auto fill can be configured with this prop, like:
* `auto`: Let the Android System use its heuristics to determine if the view is important for autofill.
* `no`: This view isn't important for autofill.
* `noExcludeDescendants`: This view and its children aren't important for autofill.
* `yes`: This view is important for autofill.
* `yesExcludeDescendants`: This view is important for autofill, but its children aren't important for autofill.
Default value if `auto`.
Read more at: https://developer.android.com/guide/topics/text/autofill-optimize
Changelog:
----------
[Android] [Added] - Add prop to configure `importantForAutofill` in `TextInput`.
Pull Request resolved: https://github.com/facebook/react-native/pull/22763
Differential Revision: D14121242
Pulled By: cpojer
fbshipit-source-id: aa4360480dd19f6dde66f0409d26a41a6a318c94
Summary:
TL;DR: Setting `autoComplete` will allow the system to suggest autofill options for the `<TextInput>` component.
Android Oreo introduced the AutoFill Framework, for secure communication between an app and autofill services (e.g. Password managers). When using `<TextInput>` on Android Oreo+, the system already tries to autofill (based on heuristics), but there is no way to set configuring options or disable.
The quick solution would be to just add the same Android attributes (`autofillHints` & `importantForAutofill`) in React Native TextInput, but that doesn't bond well with the cross-platform nature of the library.
Introduces an `autoComplete` prop based on HTML's `autocomplete` attribute, mapping to Android `autofillHints` & `importantForAutofill` and serving as a proper placeholder for autofill/autocomplete in other platforms:
Also gives you the ability to disable autofill by setting autocomplete="off".
Pull Request resolved: https://github.com/facebook/react-native/pull/21575
Differential Revision: D14102949
Pulled By: hramos
fbshipit-source-id: 7601aeaca0332a1f3ce8da8020dba037b700853a
Summary: This is the first step in organizing React Native slightly differently. This doesn't set up a "monorepo" structure for the GitHub repo yet, it merely moves a few files around and I slightly updated the package.json file for the codegen project.
Reviewed By: rickhanlonii, TheSavior
Differential Revision: D13974180
fbshipit-source-id: f53375f3b6618ef12658064cb1fc690ef1f95299
Summary:
- Improve type inference of the `event.easing` keyboard event property with the `KeyboardEventEasing` type.
- Exporting `KeyboardEventName` and `KeyboardEventEasing` for others to use.
- Removing unnecessary optional property flag (ie.`?`) for all properties in `KeyboardEvent`. (I personally haven't seen any of the properties not being returned for all keyboard events).
[iOS] [Changed] - Refine Keyboard API Event typings
Pull Request resolved: https://github.com/facebook/react-native/pull/23272
Differential Revision: D13941758
Pulled By: cpojer
fbshipit-source-id: 4891898c29cf6963069dbe6b4d439694761fd9e7
Summary:
Given two apps loaded side-by-side and when a `Keyboard` event is triggered, there is no way to ascertain which app triggered the keyboard event. This ambiguity can arise in slide over/split view scenarios.
This pull request exposes the `isLocalUserInfoKey` property of the native `UIKeyboard` iOS events to the `Keyboard` event listener; this property will return `true` for the app that triggered the keyboard event.
(Also, I threw in a couple of Keyboard.js tests just for fun 😅)
[iOS][Added] - Expose isLocalUserInfoKey to keyboard event notifications
1. Load two apps side-by-side, with the app on the left side subscribing to the keyboard events (and logging out the events as they happen)
1. Trigger a keyboard to appear with the left app. The logged keyboard event will contain the `isEventFromThisApp` property which will be true.
1. Dismiss the keyboard
1. Trigger a keyboard to appear with the right app. The left app will still log the keyboard event, but the event's `isEventFromThisApp` property will be false (because the left app didn't trigger the keyboard event)
Pull Request resolved: https://github.com/facebook/react-native/pull/23245
Differential Revision: D13928612
Pulled By: hramos
fbshipit-source-id: 6d74d2565e2af62328485fd9da86f15f9e2ccfab
Summary:
Motivation:
----------
This is one of the more sought after feature requests for RN:
react-native.canny.io/feature-requests/p/add-speed-attribute-to-scrollto
This PR adds the support to add a "duration" whenever using "scrollTo" or "scrollToEnd" with
a scrollView. Currently this only exists for Android as the iOS implementation will be somewhat more involved.
This PR is also backwards compatible and does not yet deprecate the "animated" boolean. It may not make sense to ever deprecate "animated", as it could be the flag that is used when devs want the system default duration (which is 250ms for Android). I'm not sure what it is for iOS. It would simplify things to remove "animated", though.
Pull Request resolved: https://github.com/facebook/react-native/pull/22884
Differential Revision: D13860038
Pulled By: cpojer
fbshipit-source-id: f06751d063a33d7046241c95348b6abbb327d36f
Summary:
This is a new attempt to get #11251 merged. I just cherry-picked the relevant commits. TextInputs are set to always ignore responder termination requests, which is not desirable when they are enclosed inside a swipeable area like a ListView
Create a TextInput inside a ListView and set the `rejectResponderTermination` prop to false. Otherwise, all TextInputs should have the same behavior they do now.
[IOS] [ENHANCEMENT] [TextInput] - Add `rejectResponderTermination` prop to to TextInput. This enables TextInputs inside Swipeables to function properly.
Pull Request resolved: https://github.com/facebook/react-native/pull/16755
Differential Revision: D7846365
Pulled By: cpojer
fbshipit-source-id: eb21140061ae1f475fbd83fc63a23819e931787d
Summary:
Changelog:
----------
[General] [Fixed] - After using React's `<StricMode>` it was discovered that a string ref was set, which is bad practice.
Pull Request resolved: https://github.com/facebook/react-native/pull/23146
Differential Revision: D13802397
Pulled By: cpojer
fbshipit-source-id: c2744877b25ad59eb1e4e9ce48a45e762f227b56
Summary:
PR Related to: #22990
Changelog:
[Android][Changed] - All the imports connected to requireNativeComponent in ActivityIndicator was moved to a seperate file.
Pull Request resolved: https://github.com/facebook/react-native/pull/23104
Differential Revision: D13781451
Pulled By: cpojer
fbshipit-source-id: 7204976d59a96abdaa81cdd7fd54fd001f7d1ee9
Summary:
His PR is related to #22990
Changelog:
----------
[IOS][Changed] - move the call to requireNativeComponent from TabBarIOS.ios.js to RCTTabBarNativeComponent.js
Pull Request resolved: https://github.com/facebook/react-native/pull/23118
Differential Revision: D13781428
Pulled By: cpojer
fbshipit-source-id: 3034c7db127a992c5757d70e22d98ee9acf4847b
Summary:
This PR exposes three static methods (`pushStackEntry`, `popStackEntry`, and `replaceStackEntry`) on StatusBar that enable imperative manipulation of the StatusBar style within the stack established by mounted StatusBar components.
Motivation:
----------
The StatusBar **component** provides a sensible API for manipulating that StatusBar style: every time a StatusBar component is mounted, its props are pushed onto a stack, and the props from the most recently mounted component are applied.
However, there are some scenarios where you may need to manipulate the StatusBar style from imperative code — particularly when invoking imperative third-party APIs that cause UI to appear. (For example, a user feedback utility or bug reporter that launches a full-screen modal.)
In modern iOS development, `UIViewControllerBasedStatusBarAppearance` is typically set to `YES`, which allows the third-party UIViewController to specify its preferred status bar style. However, as has been discussed at length in #11710, React Native has disabled this setting, which means that either the app's code or the third-party's React Native wrapper needs to manually manipulate React Native's StatusBar API to achieve the desired outcome.
The existing imperative StatusBar APIs are not a good fit for these needs because they simply overwrite the existing StatusBar styles, and provide no means of reverting StatusBar style changes when the third-party UI is dismissed.
To improve upon this situation, this PR makes it possible to call `StatusBar.pushStackEntry` before launching the third-party UI, wait for the UI to dismiss, and then call `StatusBar.popStackEntry` (supplying the token returned from the push call).
I've featured the new stack-based imperative methods in the documentation, but stopped short of explicitly deprecating the older imperative methods — though I can think of no reason not to deprecate them. Feedback is welcome on this point.
Release Notes:
--------------
[GENERAL] [ENHANCEMENT] [StatusBar] - Add static methods to manipulate StatusBar stack imperatively
Pull Request resolved: https://github.com/facebook/react-native/pull/21206
Differential Revision: D9945247
Pulled By: cpojer
fbshipit-source-id: ec118268cff5b47e87be81d0b9e1728ecc3a9b02
Summary:
[Android][Changed] - All the imports connected to `requireNativeComponent` in `ViewPager` was moved to a separate file.
Issue in focus: #22990
Pull Request resolved: https://github.com/facebook/react-native/pull/22995
Differential Revision: D13760459
Pulled By: cpojer
fbshipit-source-id: fca1633ce933ea4909ef81d7bbe8123d654e24fb
Summary:
Created a standalone JS file for the `RCTProgressView` native component.
This PR is part of #22990.
Changelog:
----------
[iOS] [Changed] - Created a standalone JS file for the `RCTProgressView` native component
Pull Request resolved: https://github.com/facebook/react-native/pull/23077
Differential Revision: D13760036
Pulled By: cpojer
fbshipit-source-id: 0f449528b28fde089d9c6b0eb9b752dee3a85af6
Summary:
his PR is related to #22990
Changelog:
----------
[Android][Changed] - move the call to requireNativeComponent from ProgressBarAndroid.android.js to ProgressBarAndroidNativeComponent.js
Pull Request resolved: https://github.com/facebook/react-native/pull/23068
Differential Revision: D13760445
Pulled By: cpojer
fbshipit-source-id: b74ff42c6f207803de70be549a13487d59125a66
Summary:
[iOS] [Changed] - As #22990 said, move requireNativeComponent to a separate file.
I am not familiar with flow, I try to follow the https://pastebin.com/RFpdT76V example but I am not sure I have done it right.
Pull Request resolved: https://github.com/facebook/react-native/pull/22996
Differential Revision: D13697082
Pulled By: cpojer
fbshipit-source-id: c0c87a8e1a7f0553da994aba230f69b496140200
Summary: Upgrades flow in xplat/js to 0.91. This diff also adds and removes suppressions.
Reviewed By: samwgoldman
Differential Revision: D13720697
fbshipit-source-id: 1bf8830ce286db92277476a2d2404cf0c0dddca2
Summary:
Changelog:
----------
[Android] [Fixed] - Fix Picker.onValueChange sometimes not fired due to race condition. Fixes#15556
Root Cause:
------------
Please check my code snippet at https://snack.expo.io/kudochien/android-picker-issue
and try to select different items on Picker to see if console.log() hit.
If calling setState() with some latency, e.g. setTimeout() or changes from redux,
the second time changing picker item on UI, the onValueChange() will be not fired.
The root cause comes from the `forceUpdate` in PickerAndroid.android.js.
If user's setState() update comes after forceUpdate(), the flow will be:
1. First time select picker item
2. onValueChange + forceUpdate
3. user's setState() + componentDidUpdate + setNativeProps({ selected: ... })
4. mSuppressNextEvent = true
5. Second time select picker item
6. Since mSuppressNextEvent is true, the onValueChange will not be fired.
Solution:
---------
Like other controlled components, disable change listener during setup values from JS.
Android Spinner `setSelection(int position)` is asynchronous call, i.e. will fire onItemSelected in next run loop and is not suitable for us.
`setSelection(int position, boolean animate)`, however, is synchronous call which I used.
Some more references about setSelection:
https://stackoverflow.com/a/43512925/2590265http://androidxref.com/8.1.0_r33/xref/frameworks/base/core/java/android/widget/AbsSpinner.java#276
The two arguments version will use `setSelectionInt()` which set mBlockLayoutRequests as true to prevent onItemSelected call from next layout().
I also moved the setOnItemSelectedListener() call after onLayout to prevent onValueChange() during intialization.
Pull Request resolved: https://github.com/facebook/react-native/pull/22821
Differential Revision: D13731979
Pulled By: cpojer
fbshipit-source-id: e06bd9aa62463b66c8f3fd7214485898d5375054
Summary:
Removes unused suppressions before deploying 0.91. See D13708161 for more context on why these couldn't be removed before.
I will follow up with 2 more diffs:
1. A diff that bumps the flow version in xplat and removes unused suppressions
2. A diff that adds new suppressions for 0.91
Reviewed By: samwgoldman
Differential Revision: D13720219
fbshipit-source-id: b07dd163962fed7ff27ce3e0a4a73a71c51965d9
Summary:
Changelog:
----------
[Android] [Changed] - As mentioned in #22990, I have moved native components required by DrawerLayoutAndroid.android.js into separate files and added Flow Typing.
Question
----------
I have two questions.
It is not included in the files mentioned by #22990 [comment](https://github.com/facebook/react-native/issues/22990#issue-399165354). Perhaps we should be adding knowledge of that type to the codegen since it is quite complicated, what do you think TheSavior?
The `Props` type include `renderNavigationView: () => React.Element<any>,` and `children?: React.Node,`. Therefore I added `const React = require('React');` to the file, is it ok?
Pull Request resolved: https://github.com/facebook/react-native/pull/23036
Differential Revision: D13710035
Pulled By: cpojer
fbshipit-source-id: 671423b76c3b443d85e4b63d05d6253dbd33b29c
Summary:
Changelog:
----------
[iOS] [Changed] - moved RCTRefreshControl from RefreshControl as a separate component, as mentioned in #22990
[Android] [Changed] - moved AndroidSwipeRefreshLayout from RefreshControl as a separate component, as mentioned in #22990
Pull Request resolved: https://github.com/facebook/react-native/pull/23039
Reviewed By: rickhanlonii
Differential Revision: D13710076
Pulled By: cpojer
fbshipit-source-id: 332520b74d6fc73e50dbe511dae22f82015c2d3a
Summary:
Applies the `thumbTintColor` prop to Sliders on iOS (which has been supported since iOS 5.0). Updates other documentation so that it is not labeled as Android-only, including the RNTester app
Pull Request resolved: https://github.com/facebook/react-native/pull/22177
Differential Revision: D13695554
Pulled By: hramos
fbshipit-source-id: 250f6574b193a37b3cd237bcf42612c3e91bf813
Summary:
[Android] [Changed] - create standalone JS file for ToolbarAndroid, as part of #22990
I have a question.
`ToolbarAndroid` component use 2 types from other files.
They are not included files mentioned by https://github.com/facebook/react-native/issues/22990#issue-399165354.
One type `ColorValue` is very simple and I'll copy it.
But `ImageSource` type is a bit complicated I think it wolud be better to add to the codegen.
How do you think about it? TheSavior
Update: -> solved 👍
----------
- [x] yarn lint
- [x] yarn flow-check-android
- [x] yarn flow
- [x] yarn test
Pull Request resolved: https://github.com/facebook/react-native/pull/23009
Differential Revision: D13697524
Pulled By: TheSavior
fbshipit-source-id: 72ce43e1510be0986a3798d795f07ab176bd2a92
Summary:
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change:
Changelog:
----------
[iOS] [Changed] - As mentioned in #22990, I have moved native components required by DatePickerIOS.ios.js into separate files and added Flow Typing.
Pull Request resolved: https://github.com/facebook/react-native/pull/23013
Differential Revision: D13697591
Pulled By: TheSavior
fbshipit-source-id: 5aec5a2270cbfc708f3e3a67662abd8071f1333f
Summary:
Changelog:
----------
[Android] [Changed] - As mentioned in #22990, I have moved native components required by PickerAndroid.android.js into separate files and added Flow Typing.
Pull Request resolved: https://github.com/facebook/react-native/pull/22999
Differential Revision: D13697130
Pulled By: TheSavior
fbshipit-source-id: 42da73d82cca45fefa066871eed5a637811643c8
Summary:
This PR is related to #22990
Changelog:
----------
[Android][Changed] - move the call to requireNativeComponent from `Checkbox.android.js` to `AndroidCheckBoxNativeComponent.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/23003
Reviewed By: TheSavior
Differential Revision: D13690827
Pulled By: rickhanlonii
fbshipit-source-id: 08bc83a7f097414b5c833a3b43715e5aec277d65
Summary:
Refactoring the codegen buck target from being used just for testing to a way that can be depended on for the real fabric target to replace the existing component code.
After this change, we can build a target for react native to use the codegen to create the native files for Switch. A follow up diff will be necessary to hook this up and actually replace the native files for switch.
Reviewed By: mdvacca
Differential Revision: D13662363
fbshipit-source-id: 599dd9ed9ca24ffb5c5784396f4bee7457d94d6d
Summary: I was reading through the ScrollView code and realized that the documentation was incomplete, and some of the flow types were wrong.
Reviewed By: yungsters
Differential Revision: D13583133
fbshipit-source-id: 11c495681e9671e078e4d2c9df76c25b04558696
Summary: On Android, the status bar color is not always black by default. The existing code causes the status bar to revert to black once the last `<StatusBar>` component is unmounted from the "stack". This diff reverts the bar background color to what it was before, instead of assuming black.
Reviewed By: yungsters
Differential Revision: D13368136
fbshipit-source-id: ef0154f776607b57bb9400b72d521f5f485b0075
Summary: This was added in [this PR](https://github.com/facebook/react-native/pull/22047) with a non strict type
Reviewed By: yungsters
Differential Revision: D13617894
fbshipit-source-id: 849f83203556e2830ac725570c9053503377f4be
Summary: In D13408886, I landed a PR that broke the `autoFocus` prop. This diff fixes this prop by partially reveting some of the changes in that diff.
Reviewed By: TheSavior
Differential Revision: D13611258
fbshipit-source-id: 225b9b59b2500cfac092f13c273685aaeb599ab0