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

1314 Коммитов

Автор SHA1 Сообщение Дата
Alan Kenyon 09f17a4e29 AccessibilityInfo.announceForAccessibility (#24746)
Summary:
AccessibilityInfo.announceForAccessibility is currently only available on iOS. I've added the Android specific implementation, updated RNTester, and the documentation.

[Android] [Added] - Added AccessibilityInfo.announceForAccessibility for Android
[General] [Added] - RNTester example for AccessibilityInfo.announceForAccessibility
Pull Request resolved: https://github.com/facebook/react-native/pull/24746

Differential Revision: D15258054

Pulled By: cpojer

fbshipit-source-id: 3e057a5c32b28e30ea2ee74a18854b012cd2dbfd
2019-05-08 03:58:13 -07:00
Nat Mote 0e1dfd4369 Upgrade to Flow v0.98
Summary:
https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/#update-xplat-js

allow-large-files

Reviewed By: avikchaudhuri

Differential Revision: D15149545

fbshipit-source-id: 85b6107c058d50d9fe80fd277fcdd005faccea8e
2019-05-03 11:43:10 -07:00
Yury Korzun 45e77c8324 Adds a touchSoundDisabled prop to Touchable (#24666)
Summary:
Currently, every time a touchable is pressed on Android, a system sound is played. It was added in the PR #17183. There is no way to disable it, except disabling touch on sound on the system level. I am pretty sure there are cases when touches should be silent and there should be an option to disable it.

Related PRs - #17183, #11136

[Android][added] - Added a touchSoundDisabled prop to Touchable. If true, doesn't system sound on touch.
Pull Request resolved: https://github.com/facebook/react-native/pull/24666

Differential Revision: D15166582

Pulled By: cpojer

fbshipit-source-id: 48bfe88f03f791e3b9c7cbd0e2eed80a2cfba8ee
2019-05-01 09:35:29 -07:00
David Vacca 5eac8ca9b0 Migrate VirtualizedList to use ref.measureLayout
Summary: This diff migrates VirtualizedList to use ref.measureLayout instead of UIManager.measureLayout, this is a pre-req to make measureLayout to work in Fabric

Reviewed By: JoshuaGross, TheSavior

Differential Revision: D14865762

fbshipit-source-id: 45dd3374813370188c914acfc7e631075508f74a
2019-04-30 15:05:02 -07:00
A C SREEDHAR REDDY 82148da667 call onValueChange only when value changes (#24653)
Summary:
`OnValueChange` function of `Picker` is called when Picker is initialized.

[Android][fixed] - `OnValueChange` will be called only when the `selectedValue` changes.
Pull Request resolved: https://github.com/facebook/react-native/pull/24653

Differential Revision: D15146483

Pulled By: cpojer

fbshipit-source-id: e26f5aa4caa673015c50c853f00b99572e803755
2019-04-30 02:42:15 -07:00
Avik Chaudhuri 88c18fa93b add typeof to resolve `Component: Component` flow error
Summary: A Flow error suppression was hiding two errors: one is a real type incompatibility, another is a "kind" mismatch error where the type of a component was being cast to another component (rather than its type).

Reviewed By: nmote

Differential Revision: D15141749

fbshipit-source-id: a090c02c949eb6614b46f2691ad41cee0b0f3dbd
2019-04-29 17:18:06 -07:00
zhongwuzw cc2b3d0ebf Add setNativeProps support for SafeAreaView (#24589)
Summary:
Fixes #24576 .
cc. cpojer .

[iOS] [Fixed] - Add setNativeProps support for SafeAreaView
Pull Request resolved: https://github.com/facebook/react-native/pull/24589

Differential Revision: D15099303

Pulled By: cpojer

fbshipit-source-id: f694f19fd932236c001056f38cc976db38db68a6
2019-04-26 08:47:09 -07:00
Brandon Carroll 782dc940a6 add snapshots for mocked and unmocked components part 2 (#24593)
Summary:
Per conversation with TheSavior, in #24538, this adds snapshot tests for more components. Shallow and deep snapshots are included.

[General] [Added] - Snapshots
Pull Request resolved: https://github.com/facebook/react-native/pull/24593

Differential Revision: D15082831

Pulled By: TheSavior

fbshipit-source-id: bc7f27317e2fd0bad133f4ba4d81996d08a12c44
2019-04-25 12:12:34 -07:00
Marc Mulcahy 1aeac1c625 Additional Accessibility Roles and States (#24095)
Summary:
Assistive technologies use the accessibility role of a component to tell the disabled user what the component is, and provide hints about how to use it. Many important roles do not have analog AccessibilityTraits on iOS. This PR adds many critical roles, such as editabletext, checkbox, menu, and switch to name a few.

Accessibility states are used to convey the current state of a component. This PR adds several critical states such as checked, unchecked, on and off.

[general] [change] - Adds critical accessibility roles and states.
Pull Request resolved: https://github.com/facebook/react-native/pull/24095

Differential Revision: D15079245

Pulled By: cpojer

fbshipit-source-id: 941b30eb8f5d565597e5ea3a04687d9809cbe372
2019-04-25 06:13:07 -07:00
Spencer Ahrens c87de765f6 don't throttle below 16ms
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
2019-04-24 17:04:58 -07:00
Brandon Carroll de12b98cd5 WIP: add snapshots for mocked and unmocked components (#24554)
Summary:
Per a conversation with TheSavior, in #24538, this adds snapshot tests for all components whose mocks will be addressed in that PR. Shallow and deep snapshots are included.

[General] [Added] - Snapshots
Pull Request resolved: https://github.com/facebook/react-native/pull/24554

Differential Revision: D15062197

Pulled By: cpojer

fbshipit-source-id: 70ddbaa5e6d1d2c0fd1130ab04c458d9c49d0ee8
2019-04-24 06:52:20 -07:00
Sam Mathias Weggersen 01bcde3ed8 Keyboard accessibility improvements (#24359)
Summary:
In order to meet our accessibility requirements we need to have full support for keyboard navigation. The Touchable components works with press/tap with a finger, but doesn't respond to 'enter' when using a keyboard. Navigation works fine. This PR adds an onClick listener to touchable views that have the onPress prop defined.

[Android] [Added] - Add View.OnClickListener to Touchable components when onPress is defined
Pull Request resolved: https://github.com/facebook/react-native/pull/24359

Differential Revision: D14971230

Pulled By: cpojer

fbshipit-source-id: ca5559ca1308ee6c338532a00dcea4d00fa57f42
2019-04-17 09:55:24 -07:00
Taylor123 faaa92bb04 disable momentum scrolling for horizontal ScrollView (#24045)
Summary:
Would like feedback from the community as this may not be the best solution for all

I would like to restrict (or paginate) the fling of a horizontal ScrollView when `snapToInterval` is set. This is not currently possible with `pagingEnabled`, since the pagination works only when items are the entire width of the ScrollView.

This implementation simply restricts the predicted `targetOffset` found from the `x` velocity and replaces it with the offset when the pan gesture ended.

To get pagination working, I may paginate based on the interval by calculating the offset delta from the beginning of the gesture to current offset and restricting the scrolling behavior to the `snapToInterval`. If this is preferred, I can update this PR or make a new one, but wanted to start a discussion since it seems like there are many in the community that would like this feature  #21302 .

[General] [Added] - add prop `disableIntervalMomentum` to disable the predictive scrolling behavior of horizontal ScrollViews
Pull Request resolved: https://github.com/facebook/react-native/pull/24045

Differential Revision: D14939754

Pulled By: sahrens

fbshipit-source-id: 26be19c47dfb8eed4d7e6035df53a77451e23081
2019-04-15 14:40:44 -07:00
Estevão Lucas f70e58f355 - remove accessibilityComponentType and accessibilityTraits props (a11y) (#24344)
Summary:
Closes: https://github.com/facebook/react-native/issues/24016

React Native 0.57 introduced cross-platform `accessibilityRole` and `accessibilityStates` props in order to replace `accessibilityComponentType` (for android) and `accessibilityTraits` (for iOS). With #24095 `accessibilityRole` and `accessibilityStates` will increase, receiving more options, which seems to be a good moment to remove deprecated props.

Remove deprecated `accessibilityComponentType` and `accessibilityTraits` props.

[General] [Removed] - Remove accessibilityComponentType and accessibilityTraits props
Pull Request resolved: https://github.com/facebook/react-native/pull/24344

Reviewed By: rickhanlonii

Differential Revision: D14842214

Pulled By: cpojer

fbshipit-source-id: 279945e503d8a23bfee7a49d42f5db490c5f6069
2019-04-15 10:53:50 -07:00
David Vacca 9202d4f772 - Created schema for AndroidSwipeRefreshLayoutSchema
Summary: Created schema for AndroidSwipeRefreshLayoutSchema component

Reviewed By: shergin

Differential Revision: D14817451

fbshipit-source-id: 22e8f71e476cd51ea61ce83f26c69ae71bbdafb5
2019-04-10 16:18:20 -07:00
Kevin Gozali 417adf526f Fabric iOS: allow using fallback component for unsupported ones
Summary:
This allows an unsupported component to be rendered as a "unimplemented view" for better visualization of which component is missing. It is off by default, but configurable in the component factory.

For now, the layout simply follows regular <View />, which means the width/height etc is based on the react component styling. The side effect is that components with 0 height/width won't show up at all.

Reviewed By: mdvacca

Differential Revision: D14869656

fbshipit-source-id: f31e012fb7dc1c64fcc431ea5aa45079a23a618e
2019-04-10 11:04:23 -07:00
Brandon Carroll a2b699daf6 change jest native method mocks to jest functions (#24337)
Summary:
Currently calling native methods on internal react native components throw a warning. I believe this is problematic because _users_ aren't calling native methods on internal components, the _component_ is making the call.

So for instance, if I unmount a component that has a form with a few uses of `TextInput`, which is a perfectly valid test case, my test output will be full of warnings that I can't call `.blur()` in the test renderer environment. That's very misleading, because I didn't, the internal component did. In fact, as far as I can tell, there's not really even anything I can do to stop that call or use the output from it, its all internal. `TextInput` is a black box, and 99% of users writing tests probably won't even know it calls `.blur()` under the hood on unmount.

I want to change these to `jest.fn()` because I think this eliminates a lot of chatter in test output, but also doesn't send users down a rabbit hole of trying to find workarounds that may involve filtering console output, which could potentially lead them to inadvertently filter out real warnings that they should see.

So I'm willing to change the implementation of how I did this, but I don't think its right to warn users that they called a native method when they didn't. If they build a component that calls these methods, I believe it's on them to do something similar to this, and maybe we can make this exposed as a helper that can be used for third party component mocks?

[General] [Changes] - Changed MockNativeMethods for core components to `jest.fn()` instead of function that warns about calling native methods.
Pull Request resolved: https://github.com/facebook/react-native/pull/24337

Differential Revision: D14822126

Pulled By: cpojer

fbshipit-source-id: 2199b8c8da8e289d38823bdcd2c43c82f3f635c9
2019-04-07 11:54:48 -07:00
Craig_Martin 6f4239b37c Add scrollToOverflowEnabled prop to ScrollView (#24296)
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
2019-04-03 16:21:08 -07:00
PIYUSH GUPTA 59e50237bf fixed touchable longpress (#24238)
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
2019-04-03 10:45:35 -07:00
Adam Comella a2285b1790 Android: Enable views to be nested within <Text> (#23195)
Summary:
Potential breaking change: The signature of ReactShadowNode's onBeforeLayout method was changed
  - Before: public void onBeforeLayout()
  - After:  public void onBeforeLayout(NativeViewHierarchyOptimizer nativeViewHierarchyOptimizer)

Implements same feature as this iOS PR: https://github.com/facebook/react-native/pull/7304

Previously, only Text and Image could be nested within Text. Now, any view can be nested within Text. One restriction of this feature is that developers must give inline views a width and a height via the style prop.

Previously, inline Images were supported via FrescoBasedReactTextInlineImageSpan. To get support for nesting views within Text, we create one special kind of span per inline view. This span is called TextInlineViewPlaceholderSpan. It is the same size as the inline view. Its job is just to occupy space -- it doesn't render any visual. After the text is rendered, we query the Android Layout object associated with the TextView to find out where it has positioned each TextInlineViewPlaceholderSpan. We then position the views to be at those locations.

One tricky aspect of the implementation is that the Text component needs to be able to render native children (the inline views) but the Android TextView cannot have children. This is solved by having the native parent of the ReactTextView also host the inline views. Implementation-wise, this was accomplished by extending the NativeViewHierarchyOptimizer to handle this case. The optimizer now handles these cases:
  - Node is not in the native tree. An ancestor must host its children.
  - Node is in the native tree and it can host its own children.
  - (new) Node is in the native tree but it cannot host its own children. An ancestor must host both this node and its children.

I added the `onInlineViewLayout` event which is useful for writing tests for verifying that the inline views are positioned properly.

Limitation: Clipping
----------

If Text's height/width is small such that an inline view doesn't completely fit, the inline view may still be fully visible due to hoisting (the inline view isn't actually parented to the Text which has the limited size. It is parented to an ancestor which may have a different clipping rectangle.). Prior to this change, layout-only views had a similar limitation.
Pull Request resolved: https://github.com/facebook/react-native/pull/23195

Differential Revision: D14014668

Pulled By: shergin

fbshipit-source-id: d46130f3d19cc83ac7ddf423adcc9e23988245d3
2019-04-01 19:55:23 -07:00
Dulmandakh 11ac06fda4 fix typo in DatePickerAndroidTypes.js (#24234)
Summary:
fix typo in DatePickerAndroidTypes.js, fixes https://github.com/facebook/react-native/issues/24137

[Android] [Changed] - fix typo in DatePickerAndroidTypes.js
Pull Request resolved: https://github.com/facebook/react-native/pull/24234

Differential Revision: D14705691

Pulled By: cpojer

fbshipit-source-id: 0d4aee045f7ec36b0cfcd5b4ce5a2cd47cee9ec5
2019-04-01 08:41:45 -07:00
Rick Hanlon 0b3f99bf93 Move requireNativeComponent calls to standalone files
Summary: Moves a number of requireNativeComponent calls to standalone files to support codegen

Reviewed By: TheSavior

Differential Revision: D14654018

fbshipit-source-id: 349b975cd3a99a9373b2b9b1a19aa311d7c36399
2019-03-29 18:50:19 -07:00
Christoph Nakazawa 5fa8258138 Move WebView JS files to FB internal
Summary: This moves all the JS files and updates the BUCK files. The next step is to move the Android and iOS native files.

Reviewed By: TheSavior

Differential Revision: D14618890

fbshipit-source-id: 42984acdf5920e712f272d5742c778943be37ac5
2019-03-29 14:38:57 -07:00
Christoph Nakazawa 938c3bdfa0 Change WebView to be required from 'WebView' module directly
Summary: This is the first diff part of moving WebView internally to Facebook. It will be available under the same name `WebView` but won't be required from `react-native` any longer.

Reviewed By: TheSavior

Differential Revision: D14598043

fbshipit-source-id: f870d3f58e1d304071405344de09598dd22cdcc2
2019-03-26 08:20:37 -07:00
Achille Urbain 3711ea6937 Make KeyboardAvoidingView with behavior="height" resize on keyboard close (#18889)
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
2019-03-22 15:08:21 -07:00
Rahul kishan M aa10b3f293 Null check on Picker Items (#24057)
Summary:
when conditional rendering is used then picker breaks when the child is null in iOS

This conditional rendering inside Picker fails when "someBooleanValue" variable is false

```
{
   this.state.someBooleanValue && <Picker.Item label="value" value="value" />
}
```

[iOS] [Fixed] - null check on children by using filter
Pull Request resolved: https://github.com/facebook/react-native/pull/24057

Differential Revision: D14538337

Pulled By: cpojer

fbshipit-source-id: d9324671931b5f1dac65d8058d9aa957b650af25
2019-03-20 08:11:47 -07:00
Alec Larson 68825f9ca5 Fix prop overrides of TouchableWithoutFeedback (#23966)
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
2019-03-18 11:06:38 -07:00
Estevão Lucas 40de0495b9 - add more iOS flags into AccessibilityInfo (#23913)
Summary:
As a follow-up to this other PR #23839, it adds support for other, iOS only, flags into `AccessibilityInfo`.

It adds these other 4 methods:
* `isBoldTextEnabled()`
* `isGrayscaleEnabled()`
* `isInvertColorsEnabled()`
* `isReduceTransparencyEnabled()`

P.S: Android implementation for those methods just return `false` (with `Promise.resolve(false)`)

And the corresponding event listeners:
* `boldTextChanged`
* `grayscaleChanged`,
* `invertColorsChanged`,
* `reduceTransparencyChanged`
Pull Request resolved: https://github.com/facebook/react-native/pull/23913

Differential Revision: D14482214

Pulled By: cpojer

fbshipit-source-id: b97725fd12706957d4dad880a97e6b0993738272
2019-03-15 11:34:20 -07:00
Eli White b43aa232eb Migrate TextInput to use new setNativeProps API
Summary:
See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information.

This shouldn't be a user facing change.

Reviewed By: shergin

Differential Revision: D14176217

fbshipit-source-id: 784739e5a69a98ddd1d5db75ee5267b7459e477b
2019-03-14 12:04:14 -07:00
Peter van der Zee dcd4e90d9a Bump Prettier to 1.16.4
Summary:
@public
This bumps Prettier to v1.16.4
Only format source files were updated.

Reviewed By: mjesun

Differential Revision: D14454893

fbshipit-source-id: 72f9872fe764a79dbf0d9fab9bebb1456b039f2f
2019-03-14 07:00:27 -07:00
Rick Hanlon 8bedca849b Generate RCTRefreshControlNativeType
Summary: Another component from https://fb.quip.com/aM59AkQ7At1K

Reviewed By: TheSavior

Differential Revision: D14404786

fbshipit-source-id: 29f2b675e9dd377ab03702feb5d23ba61c2f8c03
2019-03-13 07:02:32 -07:00
a-c-sreedhar-reddy 85e8b3e21d Fix PickerAndroid breaking when child is null. (#23884)
Summary:
On conditional rendering if child is null then the PickerAndroid breaks.

when conditional rendering is used then picker breaks when the child is null.

This conditional rendering inside Picker fails when a is 1, because child will be null in PickerAndroid.android.js.

```
{
   this.state.a === 2 && <Picker.Item label="value" value="value" />
}
```
[ANDROID] [FIXED] - Filter props.children.
Pull Request resolved: https://github.com/facebook/react-native/pull/23884

Differential Revision: D14436860

Pulled By: cpojer

fbshipit-source-id: 6a8fca604acf77c20729f26a53cd7f67e514deac
2019-03-13 00:38:52 -07:00
Estevão Lucas 0090ab32c2 - Add support for "reduce motion" into AccessibilityInfo (#23839)
Summary:
This PR adds `isReduceMotionEnabled()` to `AccessibilityInfo` in other to add support for "reduce motion", exposing the Operational System's settings option. Additionally, it adds a new event, `reduceMotionChanged`, in order to listen for this flag's update.

With this feature, developers will be able to disable or reduce animations, _**something that will be required as soon as WCAG 2.1 draft got approved**._ See [WCAG 2.1 — 2.3.3 Animations from Interaction criteria](https://knowbility.org/blog/2018/WCAG21-233Animations/)

It's exposed by [`UIAccessibility`' isReduceMotionEnabled ](https://developer.apple.com/documentation/uikit/uiaccessibility/1615133-isreducemotionenabled
) on iOS and [Settings.Global.TRANSITION_ANIMATION_SCALE](https://developer.android.com/reference/android/provider/Settings.Global#TRANSITION_ANIMATION_SCALE) on Android.

Up until now, `AccessibilityInfo` only exposes screen reader flag. By adding this second accessibility option, it's a good opportunity to rename `fetch` method to an appropriate name, `isScreenReaderEnabled`, as well as rename `change` event to `screenReaderChanged`, which will make it clearer and more specific.

(In case it's approved, a follow-up PR could exposes [more iOS acessibility flags](https://developer.apple.com/documentation/uikit/uiaccessibility), such as `isShakeToUndoEnabled`, `isReduceTransparencyEnabled`, `isGrayscaleEnabled`, `isInvertColorsEnabled`)

(iOS code inspired by [phonegap-mobile-accessibility](https://github.com/phonegap/phonegap-mobile-accessibility). And Android by [Flutter](https://github.com/flutter/engine/blob/master/shell/platform/android/io/flutter/view/AccessibilityBridge.java
))
Pull Request resolved: https://github.com/facebook/react-native/pull/23839

Differential Revision: D14406227

Pulled By: hramos

fbshipit-source-id: adf43be84c488522bf1e29d862681220ad193883
2019-03-12 20:28:21 -07:00
Ramanpreet Nara f741d33840 Fix internal breakages
Summary: D13103990 updated the flow types for ScrollView. This diff just updates our internal callsites to address the flow errors.

Reviewed By: TheSavior

Differential Revision: D14305453

fbshipit-source-id: 58fe28da06a6c83a81ba29bebe96e74c2f3ed5e5
2019-03-08 11:39:41 -08:00
Michał Pierzchała fe533a482d Flow strict ScrollView; get rid of InternalScrollViewType (#22301)
Summary:
Relates to #22100.

I left 2 `$FlowFixMe`s as I was not sure how to handle generic `React.Element<>` and which native props can I pass to ScrollView (would be cool to document it once we got proper types there).

I also got rid of `InternalScrollViewType` because we have better typings in original `ScrollView` now.
Pull Request resolved: https://github.com/facebook/react-native/pull/22301

Reviewed By: TheSavior

Differential Revision: D13103990

Pulled By: RSNara

fbshipit-source-id: 9664ee9d7f570b00992215e10901e5317f24fe5c
2019-03-08 11:39:41 -08:00
George Zahariev 35d2dfcabf Deploy 0.94 to xplat
Summary:
Update Flow version in xplat (https://our.intern.facebook.com/intern/wiki/Flow/Flow_Release_Process/#update-xplat-js)

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14317820

fbshipit-source-id: 07ec22c0745321db036f4e10a502009a4b640652
2019-03-06 14:57:30 -08:00
Rick Hanlon d48bd1759e Use codegen for Slider props + events
Summary: Use the codegen for the Slider component with the new `inferfaceOnly` option

Reviewed By: TheSavior

Differential Revision: D14295981

fbshipit-source-id: 0482572892fbcffada43c7c6fbf17e70546300b8
2019-03-05 11:53:56 -08:00
A C SREEDHAR REDDY cd18527e77 Fix breaking of PickerAndroid when child is null. (#23748)
Summary:
when conditional rendering is used then picker breaks when the child is null.

This conditional rendering inside Picker fails when a is 1, because child will be null in PickerAndroid.android.js.
```
{
   this.state.a === 2 && <Picker.Item label="value" value="value" />
}
```

[ANDROID] [FIXED] - When child is null it returns.
Pull Request resolved: https://github.com/facebook/react-native/pull/23748

Differential Revision: D14319140

Pulled By: cpojer

fbshipit-source-id: 07d48cd054a131e6984cfe3bdce7538ffbc50622
2019-03-04 18:44:30 -08:00
Ryan Stelly ced155327e chore: update comment in DrawerLayoutAndroid (#23730)
Summary:
...referencing stale function component limitations

While preparing a short tutorial on the DrawerLayoutAndroid using the v59 RC, I came across a comment that we can update that states refs as being available only in Class components. This updates that with both class and function components.

If we'd rather delete the comment entirely and move both examples to the website, I'm fine with that too. The current docs page doesn't address the imperative API. https://facebook.github.io/react-native/docs/drawerlayoutandroid

[General] [fixed] - Update stale comment to provide both class and functional component ref example for DrawerLayoutAndroid
Pull Request resolved: https://github.com/facebook/react-native/pull/23730

Differential Revision: D14298527

Pulled By: cpojer

fbshipit-source-id: 3e9f0d6ae49588045fd9d924996fe7cff3d6a156
2019-03-03 20:16:44 -08:00
Rick Hanlon 85d343d056 Capitalize enum default values
Summary: It was weird that the default values for enums did not match the casing for the enum options

Reviewed By: TheSavior

Differential Revision: D14258101

fbshipit-source-id: f601e50390a6c67f20e7a18aa94b377597a831cc
2019-03-02 12:56:01 -08:00
Rick Hanlon 858efb222e Use Generated ActivityIndicatorView Schema
Summary:
We are now generating the native cpp files for ActivityIndicatorView via Buck.

Deleting the hand written files and switching over.

Reviewed By: TheSavior

Differential Revision: D14247446

fbshipit-source-id: 63a6df3254e4184de6c8abb9ea2c89654ad54398
2019-03-02 12:56:01 -08:00
Rick Hanlon 6e0f2bc8b3 Update ActivityIndicator size prop type
Summary:
This diff updates the flow types for the ActivityIndicator size prop.

The android component [here](diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java$31-30) does not use a size prop

The iOS component [here](diffusion/FBS/browse/master/xplat/js/react-native-github/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm;e82762cefe5cddad4a7e8144c42c76eb4d907e56$14-15,23) uses the size prop, but only for small/large, not for the number type

Reviewed By: TheSavior

Differential Revision: D14247432

fbshipit-source-id: 43b74574548eaf97f96d68c18ed627465fd5e133
2019-03-02 12:56:01 -08:00
Masayuki Iwai 58c956768a Update _scrollAnimatedValue offset of ScrollViews. (#19481)
Summary:
`_scrollAnimatedValue` offset of ScrollView is set once in `UNSAFE_componentWillMount` but it is never updated.
It causes unexpected render result.

![rn-scrollview-fix1](https://user-images.githubusercontent.com/143255/40640292-61843eca-6350-11e8-9412-f5383ea65ea0.gif)

So I suggest to update `_scrollAnimatedValue` offset when ScrollView contentInset is updated.
Pull Request resolved: https://github.com/facebook/react-native/pull/19481

Differential Revision: D14223304

Pulled By: cpojer

fbshipit-source-id: 4191cfcf6414adf3a0abd156517d5f9778565671
2019-02-26 01:42:28 -08:00
Pim de Witte 7c4dbd617d Prop to disable the default pan responder on ScrollView that blocks touches when snapToInterval is enabled (#19110)
Summary:
The ScrollView component seems to have been written for a default touch up / touch down scrolling behavior. However, when using snapToInterval, this default behavior of adding PanResponders while the ScrollView is animating or has an active touch causes bugs with the PanResponder hijacking touches it is not supposed to hijack.
Pull Request resolved: https://github.com/facebook/react-native/pull/19110

Differential Revision: D14071342

Pulled By: hramos

fbshipit-source-id: ac285d9967dd6e2a347943b2455d4f986062ef62
2019-02-25 12:14:19 -08:00
Vojtech Novak 976f4be457 support checkbox tinting (#18300)
Summary:
RN offers checkbox component on android: https://facebook.github.io/react-native/docs/checkbox.html

The Checkbox colors for checked and unchecked states cannot be controlled from JS at the moment; this PR adds support for that.

The essence of changing colors for the states is this:

```
ColorStateList cls = new ColorStateList(
        new int[][] {
                new int[] { -android.R.attr.state_checked }, // unchecked
                new int[] {  android.R.attr.state_checked }  // checked
        },
        new int[] {
                uncheckedColor,
                checkedColor
        }
);
checkBox.setSupportButtonTintList(cls);
```

Because of this, I did it so that both colors have to provided together in an object. This is similar to [switch](https://facebook.github.io/react-native/docs/switch#trackcolor)
Pull Request resolved: https://github.com/facebook/react-native/pull/18300

Differential Revision: D14180218

Pulled By: cpojer

fbshipit-source-id: 88a9d1faf061c0651e3e28950f697535b90fbfd4
2019-02-21 20:16:14 -08:00
Grégoire Rit c416b40542 Add setNextFocus support (#22082)
Summary:
Add properties to be able to set the nextFocus. It can be very useful with Android TV.

New android View properties :

* nextFocusDown binded to [setNextFocusDownId](https://developer.android.com/reference/android/view/View.html#setNextFocusDownId(int))
* nextFocusForward binded to [setNextFocusForwardId](https://developer.android.com/reference/android/view/View.html#setNextFocusForwardId(int))
* nextFocusLeft binded to [setNextFocusLeftId](https://developer.android.com/reference/android/view/View.html#setNextFocusLeftId(int))
* nextFocusRight binded to [setNextFocusRightId](https://developer.android.com/reference/android/view/View.html#setNextFocusRightId(int))
* nextFocusUp binded to [setNextFocusUpId](https://developer.android.com/reference/android/view/View.html#setNextFocusUpId(int))

Can be used to fix :

* Fixes #20593
* Fixes #20100

Same PR as #22080 but accorded to changes on master
Pull Request resolved: https://github.com/facebook/react-native/pull/22082

Differential Revision: D14162740

Pulled By: cpojer

fbshipit-source-id: 9a13a185d4e8307ce67014fb076c62d135c487c3
2019-02-20 23:37:35 -08:00
Vishwesh Jainkuniya 9126add6b9 Add prop to configure `importantForAutofill`. (#22763)
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
2019-02-17 14:33:37 -08:00
Daniel Sainati 8da1f1149f deploy 0.93
Summary:
upgrades flow version

allow-large-files
bypass-lint

Reviewed By: nmote

Differential Revision: D14095305

fbshipit-source-id: 000b3b2e085f673bc443fc8bc1b3aae1b42df0e9
2019-02-15 12:04:32 -08:00
Cassio Zen f15145639d Add autoComplete prop (#21575)
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
2019-02-15 09:13:05 -08:00
Emily Janzer 7652e31d8c Pass through track color values for true/false to native component
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
2019-02-12 10:47:58 -08:00