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

669 Коммитов

Автор SHA1 Сообщение Дата
Andres Suarez aee88b6843 Tidy up license headers [3/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952693

fbshipit-source-id: 8fcb8e58a2e04e7a3169f4d525bffc00835768e6
2019-10-16 10:06:34 -07:00
Andres Suarez 3b31e69e28 Tidy up license headers [2/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952694

fbshipit-source-id: 17c87de7ebb271fa2ac8d00af72a4d1addef8bd0
2019-10-16 10:06:34 -07:00
Samuel Susla be89e4d928 Fix tintColor in SegmentedControlIOS component
Summary:
iOS 13 introduced a new design for `UISegmentedControl` and new APIs to control this. `[UISegmentedControl tintColor]` is now ignored.

We try to maintain backwards compatibility so the appearance is as close as possible to iOS 12.

Changelog:
Fix `tintColor` on SegmentedControlIOS

Reviewed By: shergin

Differential Revision: D17905892

fbshipit-source-id: 964ac64c8543660929c43b427dce4f78094b1255
2019-10-15 08:13:37 -07:00
Valentin Shergin beae6d6fa0 Revert D17456225: [RN] RCTRefreshControl was renamed to PullToRefreshView (for Paper)
Differential Revision:
D17456225

Original commit changeset: a8db99ddd507

fbshipit-source-id: 3186d76de13cccc21619702a1ad07842a4788b15
2019-10-15 07:11:53 -07:00
Valentin Shergin 08d6cb19c4 RCTRefreshControl was renamed to PullToRefreshView (for Paper)
Summary:
The component RCTRefreshControl was renamed to PullToRefreshView (for Paper). Now only old Objective-C class names have the old name, which is okay.

Changelog: [Internal] [Changed] - The internal name of PullToRefresh component was changed from `RCTRefreshControl` to `PullToRefreshView` (No public API changes)

Reviewed By: rickhanlonii

Differential Revision: D17456225

fbshipit-source-id: a8db99ddd507377d8c98b26707a3b9fae483d20c
2019-10-14 20:49:48 -07:00
Sharon Gong baa66f63d8 Announce accessibility state changes happening in the background (#26624)
Summary:
Currently the react native framework doesn't handle the accessibility state changes of the focused item that happen not upon double tapping. Screen reader doesn't get notified when the state of the focused item changes in the background.
To fix this problem, post a layout change notification for every state changes on iOS.
On Android, send a click event whenever state "checked", "selected" or "disabled" changes. In the case that such states changes upon user's clicking, the duplicated click event will be skipped by Talkback.

## Changelog:
[General][Fixed] - Announce accessibility state changes happening in the background
Pull Request resolved: https://github.com/facebook/react-native/pull/26624

Test Plan: Add a nested checkbox example which state changes after a delay in the AccessibilityExample.

Differential Revision: D17903205

Pulled By: cpojer

fbshipit-source-id: 9245ee0b79936cf11b408b52d45c59ba3415b9f9
2019-10-14 00:28:34 -07:00
Samuel Susla 1ba67fd9a6 Move RCTScrollEvent into separate file
Summary: Move RCTScrollEvent into separate file and export its header.

Reviewed By: shergin

Differential Revision: D17831709

fbshipit-source-id: f4ee4e09147ef5703b85a10238ddb6cdefdf05a5
2019-10-11 04:46:16 -07:00
Mehdi Mulani 2a3fa968b4 Revert D17793693: [RN] Add debug message to RCTShadowView when we insert a subview incorrectly
Differential Revision:
D17793693

Original commit changeset: 848ae658200e

fbshipit-source-id: e59299f596f95e2bea978b07cd7e8f1de345708a
2019-10-09 12:15:13 -07:00
Samuel Susla 5dbd62c7ff Add support for events
Summary:
LegacyViewManagerInterop layer can now handle events as well.

We expose `eventInterceptor` from `NSComponentData`, that way we can hook into event dispatching that happens within `NSComponentData`.

Coordinator has a map of `UIView -> reactTag` which it uses to figure out to which component view to forward the event.

New `LegacyViewManagerInteropViewEventEmitter` exposes APIs to send `folly::dynamic` to javascript.

Reviewed By: shergin

Differential Revision: D17765834

fbshipit-source-id: 25e75e445b32c69ec9ab0189c4ab7fba5f8c7b5d
2019-10-08 09:05:15 -07:00
Mehdi Mulani 72c03900d2 Add debug message to RCTShadowView when we insert a subview incorrectly
Summary:
@public
This will provide a more useful error message and hopefully allow us to debug the issue further.

Reviewed By: JoshuaGross

Differential Revision: D17793693

fbshipit-source-id: 848ae658200ea5e3892d8a88888599c1c248c994
2019-10-07 13:37:53 -07:00
Samuel Susla f580409919 Add command to set date on RCTDatePickerManager
Summary: We are moving away from setNativeProps, this adds necessary method on native to leverage commands API

Reviewed By: shergin

Differential Revision: D17787877

fbshipit-source-id: 8f06cdd85c96bce4ea9bb7a8cd5f6c1a1d68b20a
2019-10-07 10:36:37 -07:00
Samuel Susla 62cbdceedd Implement setNativeSelectedIndex command for Picker component
Summary:
This is required so we can switch to using commands instead of `setNativeProps`.
`setNativeProps` are not supported in Fabric, we are moving away from it.

Reviewed By: JoshuaGross

Differential Revision: D17764967

fbshipit-source-id: 16e54ebe1f0c58b80a6491db970a60c01fec8a15
2019-10-07 04:24:08 -07:00
Samuel Susla eb08b428b6 Add setValue command to RCTSwitchManager
Reviewed By: shergin

Differential Revision: D17714133

fbshipit-source-id: ccb89be1b763678f44f1271e4d5882afd37ccf65
2019-10-03 03:59:47 -07:00
Marc Mulcahy c7aa6dc827 Add onSlidingComplete callbacks when sliders adjusted via a11y (#26600)
Summary:
When sliders are adjusted via accessibility, no onSlidingComplete callback is
generated. This causes problems for components which perform behavior in this
callback, and means that such components don't behave properly when adjusted via
accessibility. For example, if an app hosting a volume control slider only commits the volume change to the hardware on onSlidingComplete, it is impossible for a screen reader user to ever actually adjust the volume.

Ensure that sliders call the onSlidingComplete callback after adjusted via
accessibility.

## Changelog

[General] [Fix] - Add onSlidingComplete callbacks when sliders adjusted via a11y.

[CATEGORY] [TYPE] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/26600

Test Plan: Prior to this change, using the RNTester slider example with a screen reader, the onSlidingComplete callback tests never shows any callbacks when the slider is adjusted. With this change applied, the callback test will show a number of callbacks corresponding to the number of times the slider was adjusted via the screen reader.

Differential Revision: D17661157

Pulled By: cpojer

fbshipit-source-id: a6eedef099c6c1b571b290c329059ac9b69b53dd
2019-09-29 19:45:06 -07:00
Marc Mulcahy 7df3eea1a7 Add accessibilityValueDescription support. (#26169)
Summary:
React Native components need a mechanism to specify their value to assistive technologies. This PR adds the notion of accessibilityValueDescription-- a property which either contains a textual description of a component's value, or for range-based components, such as sliders and progress bars, it contains range information (minimum, current, and maximum).

On iOS, the range-based info if present is converted into a percentage and added to the accessibilityValue property of the UIView. If text is present as part of the accessibilityValueDescription, it is used instead of the range-based information.

On Android, any range-based information in accessibilityValueDescription is exposed in the AccessibilityNodeInfo's RangeInfo. Text which is part of accessibilityValueDescription is appended to the content description.

## Changelog

[GENERAL] [Change] - add accessibilityValuedescription property.
Pull Request resolved: https://github.com/facebook/react-native/pull/26169

Test Plan: Added two new accessibility examples to RNTester, one which uses text and another which uses range-based info in accessibilityValueDescription. Verified that they both behave correctly on both Android and iOS.

Differential Revision: D17444730

Pulled By: cpojer

fbshipit-source-id: 1fb3252a90f88f7cafe1cbf7db08c03f14cc2321
2019-09-18 03:16:42 -07:00
Marc Mulcahy 7b35f427fd Remove deprecated accessibilityStates property. (#26168)
Summary:
We added the accessibilityState property as a more semantically rich way for components to describe information about their state to accessibility services. This PR removes the old accessibilityStates property.

 <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->

## Changelog

[General] [Change] - Remove accessibilityStates property.
Pull Request resolved: https://github.com/facebook/react-native/pull/26168

Test Plan: Ensure that RNTester accessibility examples function properly on both iOS and Android.

Differential Revision: D17152891

Pulled By: cpojer

fbshipit-source-id: d71d3cf0f2e0846979d2ba104b6c69e4e5725252
2019-09-02 11:25:31 -07:00
Guilherme Iscaro 14b0ed4c5d Do not override ActivityIndicator color when setting its size (#25849)
Summary:
The activityIndicatorViewStyle property overrides the previous set color
if it's changed. Depending on the property set order you may end in a state
that the color property will never be respected since it first sets
the color and then the activityIndicatorViewStyle property (which overrides
the color property). In order to prevent this problem
before setting the new activityIndicatorViewStyle save the old
color and override it after activityIndicatorViewStyle is set. Thus
always respecting the user's color.

## Changelog

[iOS] [Fixed] - Do not override ActivityIndicator color when setting its size
Pull Request resolved: https://github.com/facebook/react-native/pull/25849

Test Plan:
Using the code below on iOS notice that the last ActivityIndicator will always have its color set to white while te testID is provided

### Without the patch
Notice the white -> blue transition when disabling the testID

![broken](https://user-images.githubusercontent.com/984610/61999339-16c2ed80-b095-11e9-80f7-81c38eca761a.gif)

### With the patch
Color remains unchanged

![working](https://user-images.githubusercontent.com/984610/61999338-1165a300-b095-11e9-9cb6-e45999db1544.gif)

```javascript
import React from "react";
import { View, StyleSheet, ActivityIndicator, Button } from "react-native";

const App = () => {
  const [enableTestID, onSetEnableTestID] = React.useState(true);
  const onPress = React.useCallback(() => {
    onSetEnableTestID(!enableTestID);
  }, [enableTestID]);
  return (
    <View style={styles.container}>
      <ActivityIndicator size="large" color="red" />
      <ActivityIndicator size="small" color="red" />
      <ActivityIndicator size="small" />
      <ActivityIndicator color="green" />
      <ActivityIndicator
        key={enableTestID.toString()}
        size="large"
        color="blue"
        testID={enableTestID ? 'please work' : undefined}
      />
      <Button
        title={enableTestID ? 'Disable testID' : 'enable testID'}
        onPress={onPress}
      />
    </View>
  );
};

export default App;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
    backgroundColor: "black"
  },
});

```

Closes https://github.com/facebook/react-native/issues/25319

Reviewed By: cpojer

Differential Revision: D16559929

Pulled By: sammy-SC

fbshipit-source-id: ac6fd572b9f91ee5a2cbe46f8c46c1f46a1ba8b3
2019-07-30 04:31:24 -07:00
Samuel Susla bd2b7d6c03 Fix onDismiss in Modal
Summary:
# Disclaimer:
I might be missing something as the solution I implemented here seems like something that was considered by original author. If this solution isn't good, I have a plan B.

# Problem:
`onDismiss` prop isn't being called once the modal is dismissed, this diff fixes it.

Also I've noticed that `onDismiss` is meant to only work on iOS, why is that? By landing this diff, it'll be called on Android as well so we need to change the docs (https://facebook.github.io/react-native/docs/modal.html#ondismiss).

## Video that shows the problem
Following code is in playground.js P70222409 which just increments number everytime onDismiss is called

{F166303269}

Reviewed By: shergin

Differential Revision: D16109536

fbshipit-source-id: 3fba56f5671912387b217f03b613dffd89614c9d
2019-07-29 11:19:30 -07:00
Min ho Kim 84f5ebe4f9 Fix typos (#25770)
Summary:
Fix typos mostly in comments and some string literals.

## Changelog

[General] [Fixed] - Fix typos
Pull Request resolved: https://github.com/facebook/react-native/pull/25770

Differential Revision: D16437857

Pulled By: cpojer

fbshipit-source-id: ffeb4d6b175e341381352091134f7c97d78c679f
2019-07-23 03:23:11 -07:00
David Vacca 458c06b8e7 Back out "[RN][iOS] Remove definition of viewIsDescendantOf method in RN iOS code"
Summary:
Adding viewIsDescendantOf back again, more context 9ae7f0c7da
This method might no not be implemented in Fabric

Reviewed By: fkgozali

Differential Revision: D16186406

fbshipit-source-id: 9cd4c9e20c01713d4e8608a54c6f54082067e27f
2019-07-10 20:56:39 -07:00
David Vacca 9ae7f0c7da Remove definition of viewIsDescendantOf method in RN iOS code
Summary: The viewIsDescendantOf method is not required anymore, deleting code in RN iOS

Reviewed By: JoshuaGross

Differential Revision: D16014665

fbshipit-source-id: fab63973cfa4340f4f8d91d8bce41defc81486e6
2019-06-26 18:47:13 -07:00
zhongwuzw 2dd7dd8e45 Removed autoresizing mask for modal host container view (#25150)
Summary:
Fixes #18177 . Related #24497. Autoresizing mask would conflict with `AutoLayout`. For example , it would impact `SafeAreaView`. And actually we don't need to use autoresizing mask,  we observe the bounds change notification and [update the frame manually](1151c096da/React/Views/RCTModalHostView.m (L59)).

## Changelog

[iOS] [Fixed] - Removed autoresizing mask for modal host container view
Pull Request resolved: https://github.com/facebook/react-native/pull/25150

Differential Revision: D15645148

Pulled By: cpojer

fbshipit-source-id: 95d5f40feaa980b959a3de6e273dccac8158c57b
2019-06-05 05:02:52 -07:00
zhongwuzw fd7f5bb768 Keep the order of Modals that we can dismiss in sequence (#24961)
Summary:
Fixes https://github.com/facebook/react-native/issues/16037.
We need to keep the order of Modals, if we dismiss Modal randomly(before we use hash table), some Modals may not dismiss successfully.

This PR should based on https://github.com/facebook/react-native/pull/24959.

## Changelog

[iOS] [Fixed] - Keep the order of Modals that we can dismiss in sequence
Pull Request resolved: https://github.com/facebook/react-native/pull/24961

Differential Revision: D15621858

Pulled By: cpojer

fbshipit-source-id: 964729f8f4584995f4e1dd527af4b61534d369ba
2019-06-04 07:12:46 -07:00
Sharon Gong afc142bc76 Fix accessibilityActions accessors (#25134)
Summary:
The accessibilityActions accessors  in UIView+React.m are not aligned with the property declaration in the header file.

## Changelog

[General] [Fixed] - Fix accessibilityActions accessors
Pull Request resolved: https://github.com/facebook/react-native/pull/25134

Differential Revision: D15621848

Pulled By: cpojer

fbshipit-source-id: f344689292ae7988e46d0d4263980306d364366b
2019-06-04 07:05:47 -07:00
zhongwuzw 1148c03f6f Fixes wrong time unit of scroll event throttle (#25098)
Summary:
We need to use second for calculation, so change 17ms to 0.017s instead.

## Changelog

[iOS] [Fixed] - Fixes wrong time unit of scroll event throttle
Pull Request resolved: https://github.com/facebook/react-native/pull/25098

Reviewed By: sahrens, cpojer

Differential Revision: D15576526

Pulled By: sammy-SC

fbshipit-source-id: ddd8dd9098cbe582c6923ce8466892c363c090fc
2019-06-03 01:54:13 -07:00
zhongwuzw 9d0d7b61b6 Add ultrabold pairs for font weight (#24948)
Summary:
Add `ultrabold` map of font weight, if not, `ultrabold` would map to `bold`.
Fixes https://github.com/facebook/react-native/issues/23512.

## Changelog

[iOS] [Fixed] - Add ultrabold pairs for font weight
Pull Request resolved: https://github.com/facebook/react-native/pull/24948

Differential Revision: D15575568

Pulled By: cpojer

fbshipit-source-id: 5d1d6a033c166d91a330526ba8996ac0416f3887
2019-05-31 03:08:36 -07:00
zhongwuzw 284c5f0ad0 Using presentingViewController to dismiss Modal (#24959)
Summary:
Fixes https://github.com/facebook/react-native/issues/23463.
Using `presentingViewController` to dismiss Modal VC directly, don't let Modal VC to find `presentingViewController`, then dismiss.

## Changelog

[iOS] [Fixed] - Using presentingViewController to dismiss Modal
Pull Request resolved: https://github.com/facebook/react-native/pull/24959

Differential Revision: D15575571

Pulled By: cpojer

fbshipit-source-id: e275e7c7fef644c06cc8e64dba5b5a5af4129192
2019-05-31 03:01:37 -07:00
Sharon Gong 651cc2613f Move accessibilityActions property to UIView+React (#25015)
Summary:
As PR [#24743](https://github.com/facebook/react-native/pull/24743) suggested, accessibility properties are better to set on UIView+React instead of RCTView so they can be used safely on any UIView.

## Changelog

[General] [Fixed] - Move accessibilityActions props to UIView+React
Pull Request resolved: https://github.com/facebook/react-native/pull/25015

Differential Revision: D15503131

Pulled By: cpojer

fbshipit-source-id: dedf9afbd0a1d35a5abbd13ace95ee620f718f39
2019-05-24 15:33:43 -07:00
Marc Mulcahy 099be9b356 New Accessibility states API. (#24608)
Summary:
As currently defined, accessibilityStates is an array of strings, which represents the state of an object. The array of strings notion doesn't well encapsulate how various states are related, nor enforce any level of correctness.

This PR converts accessibilityStates to an object with a specific definition. So, rather than:

<View
...
accessibilityStates={['unchecked']}>

We have:

<View
accessibilityStates={{'checked': false}}>

And specifically define the checked state to either take a boolean or the "mixed" string (to represent mixed checkboxes).

We feel this API is easier to understand an implement, and provides better semantic definition of the states themselves, and how states are related to one another.

## Changelog

[general] [change] - Convert accessibilityStates to an object instead of an array of strings.
Pull Request resolved: https://github.com/facebook/react-native/pull/24608

Differential Revision: D15467980

Pulled By: cpojer

fbshipit-source-id: f0414c0ef6add3f10f7f551d323d82d978754278
2019-05-23 05:37:33 -07:00
Samuel Susla d4ff5ed258 Don't return empty string for `accessibilityLabel` for RCTView
Summary:
In case `RCTView` had no subviews, `RCTRecursiveAccessibilityLabel` was returning an empty string rather than nil.

I've noticed that https://fburl.com/i95iynxi returns empty string as well. Shall we change it there as well?

Reviewed By: shergin

Differential Revision: D15337865

fbshipit-source-id: 8e38a88321f3dcfdf35a38d43fdbe4f5118796f1
2019-05-20 01:40:52 -07:00
Sharon Gong 14b4668947 Extended Accessibility Actions Support (#24695)
Summary:
This is a reconstitution of #24190. It extends accessibility actions to include both a name and user facing label. These extensions support both standard and custom actions.

We've also added actions support on Android, and added examples to RNTester showing how both standard and custom accessibility actions are used.

## Changelog

[general] [changed] - Enhanced accessibility actions support
Pull Request resolved: https://github.com/facebook/react-native/pull/24695

Differential Revision: D15391408

Pulled By: cpojer

fbshipit-source-id: 5ed48004d46d9887da53baea7fdcd0e7e15c5739
2019-05-20 01:32:53 -07:00
Rick Hanlon 7927437a6d Switch Slider onSlidingComplete event to a non-bubbling event on iOS to match Android
Summary:
## Overview

This diff switches the RCTSlider onSlidingComplete event on iOS from a bubbling event to a direct (non-bubbling) event to match the non-bubbling type on android.

Note that in this case these seems like a bug. I will still explain the motivation and reasoning as this will come up in future diffs.

## Changelog
[Slider][BREAKING] Switch Slider onSlidingComplete event to a non-bubbling event on iOS to match Android

## Motivation:

The motivation here is that when we codgen the view configs, we'll need to unify all of the events and props across platforms for components that have the same name on iOS and Android.

In this case, the view configs (below) conflict for onSlidingComplete. On iOS this is under bubblingEventTypes, on Android this is under directEventTypes. We have code [here](https://fburl.com/3s1dahm2) in the react native renderer which ensures an event is not listed as both.

```
// iOS
const SliderViewConfig = {
  bubblingEventTypes: {
    onSlidingComplete: {
      phasedRegistrationNames: {
        captured: 'onChangeCapture',
        bubbled: 'onChange'
      }
    }
  },

  directEventTypes: {
    // None
  },

  validAttributes: {
    // ...
  }
};
```
```
// Android
const SliderViewConfig = {
  bubblingEventTypes: {
    // None
  },

  directEventTypes: {
    onSlidingComplete: {
      registrationName: 'onEventDirect'
    }
  },

  validAttributes: {
    // ...
  }
};
```

## Solutions
There are three solutions to this issue:
1. Don't generate view configs
2. Rename the component on one platform
3. Make a breaking change in the event behavior on one platform to make it consistent across both platforms

Here we've chosen option #3

Reviewed By: TheSavior

Differential Revision: D15322304

fbshipit-source-id: ff1ab86efe9e2bc50fd3f7619e6760ab5c1c5090
2019-05-16 10:51:07 -07:00
zhongwuzw 2cdf9694b5 Fixes ScrollView centerContent not work in some cases (#24817)
Summary:
The bug description can see https://github.com/facebook/react-native/issues/24688, we add `contentView` size check before center the content, because in some cases, the contentView's size not yet be calculated, in those cases, we don't adjust the `contentOffset`.

cc. cpojer .

[iOS] [Fixed] - Fixes ScrollView centerContent not work in some cases
Pull Request resolved: https://github.com/facebook/react-native/pull/24817

Differential Revision: D15322502

Pulled By: sahrens

fbshipit-source-id: e2081f13e9f2e8597a379a9db1607451ea496909
2019-05-13 13:03:26 -07:00
Janic Duplessis 9261035c2b Move accessibility props to UIView+React (#24743)
Summary:
React Native Gesture Handler uses a `RCTViewManager` subclass to manage `UIControl` so the cast to set accessibility props is not safe. This moves the accessibility props we set to `UIView+React` so they can be used safely on any `UIView`.

![image](https://user-images.githubusercontent.com/2677334/57042641-46e42700-6c33-11e9-9a97-76661ad5d14d.png)

[General] [Fixed] - Move accessibility props to UIView+React
Pull Request resolved: https://github.com/facebook/react-native/pull/24743

Differential Revision: D15258062

Pulled By: cpojer

fbshipit-source-id: 4a25b79407e5cb7b3b368c7506161e989794bb26
2019-05-08 03:48:03 -07:00
zhongwuzw f75d47c915 Fixes SafeAreaView when set emulateUnlessSupported on safeArea supported devices (#24615)
Summary:
On safeArea supported devices like `iPhoneX`, we need to forbid invalidate `safeAreaInsets` when set `emulateUnlessSupported` prop, otherwise `SafeAreaView` would broken.

cc. cpojer shergin .

Before:
![before](https://user-images.githubusercontent.com/5061845/56792861-33088180-683d-11e9-8183-a1c8a5c9cb37.gif)

After:
![after](https://user-images.githubusercontent.com/5061845/56792867-38fe6280-683d-11e9-9b4d-01848b42a9b0.gif)

[iOS] [Fixed] - Fixes SafeAreaView when set emulateUnlessSupported on safeArea supported devices
Pull Request resolved: https://github.com/facebook/react-native/pull/24615

Differential Revision: D15122211

Pulled By: cpojer

fbshipit-source-id: 8a1c3f2aedbde707d8d6c8f36c97e6424585dc59
2019-04-29 10:02:58 -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
Mehdi Mulani 2c0af4b317 Add react_recursiveDescription to UIView and debugging to RCTScrollView
Summary:
@public
RCTScrollView sometimes asserts with another contentView set. While this doesn't crash, it'd be good to know what's causing the assert. This will add a recursive description of the contentView.

Changelog: [iOS] [Changed] RCTScrollView: added debugging to help fix assert

Reviewed By: PeteTheHeat

Differential Revision: D15049869

fbshipit-source-id: 5431de7764881922327c6c0a3bdd392668396b58
2019-04-23 14:58:19 -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
Christoph Nakazawa 6ca438a7f4 Move iOS WebView files to FB internal
Summary: This moves the iOS WebView files to be fb internal which completes the removal of WebView from React Native open source as part of the Lean Core effort.

Reviewed By: TheSavior

Differential Revision: D14630076

fbshipit-source-id: 7bc11d6c1470bb748c823c86cbb8b5ee94b508ff
2019-04-04 15:46:00 -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
Junhui Park fe9d21f6fa Fix setting the contentOffset value when refresh ends (#24191)
Summary:
It closes #24170.
I opened the issue yesterday, and I think I found the way how to resolve it. So, I'm opening this PR directly without any comment on the issue.

In the `endRefreshProgrammatically` of `RCTRefreshControl.m`, the comment says that " The contentOffset of the scrollview MUST be greater than 0". However, if the `contentInset` prop is set for the `FlatList`, I think `contentOffset` can be a negative value after refreshing and should be greater than `-contentInset.top`.

As I reported the bug in that issue, If I am using `contentInset` prop to the `FlatList`, making `contentOffset` value be always 0 when refreshing ends causes something wrong situation.

[iOS] [Fixed] - Fix setting the contnetOffset when refreshing ends
Pull Request resolved: https://github.com/facebook/react-native/pull/24191

Differential Revision: D14710987

Pulled By: sahrens

fbshipit-source-id: 03f06df9a93a2a46a7cc0b56269091778805917e
2019-04-01 12:54:36 -07:00
Janic Duplessis 41343f6a73 BREAKING - RCTEvent improvements, remove deprecated [sendInputEventWithName:body:] (#15894)
Summary:
This makes the RCTEvent protocol more generic to make it easier to use the event coalescing feature for type of events other than components. This does a few other improvements that will be useful in follow up PRs.

- Add `RCTComponentEvent` which is used instead of deprecated `[sendInputEventWithName:body:]` and remove that method completely (was only used at 2 places).
- Make `coalescingKey` optional for events that return NO from `canCoalesce`.
- Make `viewTag` optional for events that are not related to views.
- Fast path for events that return NO from `canCoalesce`.
- Add a missing test for event coalescing with different view tags.

Ended up making only one PR for all this since the changes are related and hard to separate.

**Migration**
Use a custom RCTEvent subclass with `[sendEvent:]` (preferred way to allow type safe events) or `RCTComponentEvent`.

**Test plan**
- Ran RCTEventDispatcher unit tests
- Tested manually in RNTester

Changelog:

[iOS] [Changed] - Remove deprecated RCTEvent method, sendInputEventWithName:body:
Pull Request resolved: https://github.com/facebook/react-native/pull/15894

Reviewed By: shergin

Differential Revision: D13726194

Pulled By: hramos

fbshipit-source-id: 11f63a99e08f46ec6b4f16f8d9949cdbf5c3fe13
2019-03-27 11:20:22 -07:00
zhongwuzw 942bf4054d Fixed minuteInterval invalid in time mode (#23923)
Summary:
From https://github.com/facebook/react-native/pull/23861#issue-260337314
> changing "interval" example from "time-only" to "datetime" because there's a known bug that prevented the previous example from working

We need to ensure set minuteInterval after set datePickerMode, otherwise minuteInterval invalid in time mode.

cc. grabbou cpojer .

[iOS] [Fixed] - Fixed minuteInterval invalid in time mode
Pull Request resolved: https://github.com/facebook/react-native/pull/23923

Differential Revision: D14477549

Pulled By: cpojer

fbshipit-source-id: 2c612d488b6d592b1907e150df5e07fe83132829
2019-03-15 11:34:20 -07:00
zhongwuzw b7b8836a7f Implement the nativeID functionality in a more efficient way (#23662)
Summary:
Implement TODO, implement the nativeID functionality in a more efficient way instead of searching the whole view tree.

[iOS] [Fixed] - Implement the nativeID functionality in a more efficient way
Pull Request resolved: https://github.com/facebook/react-native/pull/23662

Differential Revision: D14323747

Pulled By: shergin

fbshipit-source-id: 3d45dbf53ad2b6adb79b4331600d53b51ede76d4
2019-03-05 09:41:19 -08:00
zhongwuzw 06c6c7c673 Remove compatible system code for iOS8 and before (#23656)
Summary:
We already only support `iOS9+`, so we can remove all compatible codes now.

[iOS] [Fixed] - Remove compatible system code for iOS8 and before
Pull Request resolved: https://github.com/facebook/react-native/pull/23656

Differential Revision: D14224986

Pulled By: hramos

fbshipit-source-id: cac9ffe6788dd3eaf4f4f5f2b219f325ba78e85f
2019-02-26 07:58:52 -08:00
ericlewis 78b167c735 Call super if shouldDisableScrollInteraction false (#23647)
Summary:
Allow iOS to handle `touchesShouldCancelInContentView` on RCTScrollView if we aren't disabling the scroll interaction.

[iOS] [Changed] - RCTScrollView allows iOS to handle touchesShouldCancelInContentView
Pull Request resolved: https://github.com/facebook/react-native/pull/23647

Differential Revision: D14214248

Pulled By: hramos

fbshipit-source-id: 6e1bab3085aed6cabb93fb5dc988afe3911817e8
2019-02-25 14:35:17 -08:00
zhongwuzw 9c1c5a7455 Fix scrollview over bounds of content size (#23427)
Summary:
Fix scrollview `offset` out of content size in iOS, Android uses `scrollTo` and `smoothScrollTo` which not have this issue.

Fixes like #13594 #22768 #19970 .

[iOS] [Fixed] - Fixed scrollView offset out of content size.
Pull Request resolved: https://github.com/facebook/react-native/pull/23427

Differential Revision: D14162663

Pulled By: cpojer

fbshipit-source-id: a95371c8d703b6d5f604af0072f86c01c2018f4a
2019-02-20 21:32:51 -08:00
zhongwuzw 2ea4bcd001 Fixed ScrollView adjust inset behavior (#23555)
Summary:
Fixes #23500 , if user set prop `contentInsetAdjustmentBehavior="automatic"` of ScrollView, it not works when initial on the screen. We fixes it by filter valid offset, if offset is valid, just return.

[iOS] [Fixed] - Fixed ScrollView adjust inset behavior
Pull Request resolved: https://github.com/facebook/react-native/pull/23555

Differential Revision: D14161593

Pulled By: cpojer

fbshipit-source-id: 01434e55106ffde7f8e39f66dd5b0f02df9b38b1
2019-02-20 20:32:28 -08:00