From 7498e5ce77a7b5c2d3aadf9da0413559f701ed94 Mon Sep 17 00:00:00 2001 From: Eli White Date: Fri, 1 Jun 2018 19:48:11 -0700 Subject: [PATCH] Revert D8234803: [RN] Slider remove $FlowFixMe Differential Revision: D8234803 Original commit changeset: cfc0466a54f3 fbshipit-source-id: 354fcc1853597cbcd518abaf4be5b11116f594b3 --- Libraries/Components/Slider/Slider.js | 38 ++++++++++++++++----------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/Libraries/Components/Slider/Slider.js b/Libraries/Components/Slider/Slider.js index e1de6b3c3..efe22529f 100644 --- a/Libraries/Components/Slider/Slider.js +++ b/Libraries/Components/Slider/Slider.js @@ -249,10 +249,17 @@ const Slider = createReactClass({ }, 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 = - 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.onValueChange = + onValueChange && ((event: Event) => { let userEvent = true; if (Platform.OS === 'android') { @@ -260,27 +267,26 @@ const Slider = createReactClass({ // 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 ( true} onResponderTerminationRequest={() => false}