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}