Stop other views from stealing the responder from PickerIOS and DatePickerIOS

Summary:
Similar to 52ddfd9b51 the `DatePickerIOS` and `PickerIOS` components need to stop the propagation of swiping gestures in order to prevent other views from responding to them.

This is most noticable when placed inside a modal behind a scrollView.

<table>
    <tr>
        <td>Before</td>
        <td>After</td>
    </tr>
    <tr>
        <td>
            <img src="https://cloud.githubusercontent.com/assets/13004162/20035981/ad8b97f6-a3b6-11e6-957c-2d3048e0e78b.gif" />
        </td>
        <td>
            <img src="https://cloud.githubusercontent.com/assets/13004162/20036025/e7206766-a3b7-11e6-8630-492f8092f3d4.gif" />
        </td>
    </tr>
</table>
Closes https://github.com/facebook/react-native/pull/10768

Differential Revision: D4142351

Pulled By: spicyj

fbshipit-source-id: 22395aefaf46179bf2f77031c329209d4c33ee71
This commit is contained in:
Adam Dierkens 2016-11-07 18:01:09 -08:00 committed by Facebook Github Bot
parent 7a0affad2a
commit f276425ab8
2 changed files with 4 additions and 0 deletions

View File

@ -134,6 +134,8 @@ const DatePickerIOS = React.createClass({
minuteInterval={props.minuteInterval}
timeZoneOffsetInMinutes={props.timeZoneOffsetInMinutes}
onChange={this._onChange}
onStartShouldSetResponder={() => true}
onResponderTerminationRequest={() => false}
/>
</View>
);

View File

@ -62,6 +62,8 @@ var PickerIOS = React.createClass({
items={this.state.items}
selectedIndex={this.state.selectedIndex}
onChange={this._onChange}
onStartShouldSetResponder={() => true}
onResponderTerminationRequest={() => false}
/>
</View>
);