Revert D8234803: [RN] Slider remove $FlowFixMe
Differential Revision: D8234803 Original commit changeset: cfc0466a54f3 fbshipit-source-id: 354fcc1853597cbcd518abaf4be5b11116f594b3
This commit is contained in:
parent
ac9a3d0c99
commit
7498e5ce77
|
@ -249,10 +249,17 @@ const Slider = createReactClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
const style = StyleSheet.compose(styles.slider, this.props.style);
|
const {style, onValueChange, onSlidingComplete, ...props} = this.props;
|
||||||
|
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This comment
|
||||||
|
* suppresses an error found when Flow v0.54 was deployed. To see the error
|
||||||
|
* delete this comment and run Flow. */
|
||||||
|
props.style = [styles.slider, style];
|
||||||
|
|
||||||
const onValueChange =
|
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This comment
|
||||||
this.props.onValueChange &&
|
* suppresses an error found when Flow v0.54 was deployed. To see the error
|
||||||
|
* delete this comment and run Flow. */
|
||||||
|
props.onValueChange =
|
||||||
|
onValueChange &&
|
||||||
((event: Event) => {
|
((event: Event) => {
|
||||||
let userEvent = true;
|
let userEvent = true;
|
||||||
if (Platform.OS === 'android') {
|
if (Platform.OS === 'android') {
|
||||||
|
@ -260,27 +267,26 @@ const Slider = createReactClass({
|
||||||
// dragging the slider.
|
// dragging the slider.
|
||||||
userEvent = event.nativeEvent.fromUser;
|
userEvent = event.nativeEvent.fromUser;
|
||||||
}
|
}
|
||||||
this.props.onValueChange &&
|
onValueChange && userEvent && onValueChange(event.nativeEvent.value);
|
||||||
userEvent &&
|
|
||||||
this.props.onValueChange(event.nativeEvent.value);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const onChange = this.props.onValueChange;
|
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This comment
|
||||||
|
* suppresses an error found when Flow v0.54 was deployed. To see the error
|
||||||
|
* delete this comment and run Flow. */
|
||||||
|
props.onChange = props.onValueChange;
|
||||||
|
|
||||||
const onSlidingComplete =
|
/* $FlowFixMe(>=0.54.0 site=react_native_fb,react_native_oss) This comment
|
||||||
this.props.onSlidingComplete &&
|
* suppresses an error found when Flow v0.54 was deployed. To see the error
|
||||||
|
* delete this comment and run Flow. */
|
||||||
|
props.onSlidingComplete =
|
||||||
|
onSlidingComplete &&
|
||||||
((event: Event) => {
|
((event: Event) => {
|
||||||
this.props.onSlidingComplete &&
|
onSlidingComplete && onSlidingComplete(event.nativeEvent.value);
|
||||||
this.props.onSlidingComplete(event.nativeEvent.value);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RCTSlider
|
<RCTSlider
|
||||||
{...this.props}
|
{...props}
|
||||||
style={style}
|
|
||||||
onChange={onChange}
|
|
||||||
onSlidingComplete={onSlidingComplete}
|
|
||||||
onValueChange={onValueChange}
|
|
||||||
enabled={!this.props.disabled}
|
enabled={!this.props.disabled}
|
||||||
onStartShouldSetResponder={() => true}
|
onStartShouldSetResponder={() => true}
|
||||||
onResponderTerminationRequest={() => false}
|
onResponderTerminationRequest={() => false}
|
||||||
|
|
Loading…
Reference in New Issue