Skip to content

Commit

Permalink
Revert D8234803: [RN] Slider remove $FlowFixMe
Browse files Browse the repository at this point in the history
Differential Revision:
D8234803

Original commit changeset: cfc0466a54f3

fbshipit-source-id: 354fcc1853597cbcd518abaf4be5b11116f594b3
  • Loading branch information
elicwhite authored and facebook-github-bot committed Jun 2, 2018
1 parent ac9a3d0 commit 7498e5c
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions Libraries/Components/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,38 +249,44 @@ const Slider = createReactClass({
},

render: function() {
const style = StyleSheet.compose(styles.slider, this.props.style);

const onValueChange =
this.props.onValueChange &&
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];

/* $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.onValueChange =
onValueChange &&
((event: Event) => {
let userEvent = true;
if (Platform.OS === 'android') {
// On Android there's a special flag telling us the user is
// dragging the slider.
userEvent = event.nativeEvent.fromUser;
}
this.props.onValueChange &&
userEvent &&
this.props.onValueChange(event.nativeEvent.value);
onValueChange && userEvent && 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 =
this.props.onSlidingComplete &&
/* $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.onSlidingComplete =
onSlidingComplete &&
((event: Event) => {
this.props.onSlidingComplete &&
this.props.onSlidingComplete(event.nativeEvent.value);
onSlidingComplete && onSlidingComplete(event.nativeEvent.value);
});

return (
<RCTSlider
{...this.props}
style={style}
onChange={onChange}
onSlidingComplete={onSlidingComplete}
onValueChange={onValueChange}
{...props}
enabled={!this.props.disabled}
onStartShouldSetResponder={() => true}
onResponderTerminationRequest={() => false}
Expand Down

0 comments on commit 7498e5c

Please sign in to comment.