mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 04:35:36 +08:00
Prettier React Native Libraries
Reviewed By: sahrens Differential Revision: D7961488 fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
This commit is contained in:
committed by
Facebook Github Bot
parent
1e2de71290
commit
d01ab66b47
@@ -4,8 +4,10 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const Image = require('Image');
|
||||
@@ -192,13 +194,13 @@ const Slider = createReactClass({
|
||||
testID: PropTypes.string,
|
||||
},
|
||||
|
||||
getDefaultProps: function() : any {
|
||||
getDefaultProps: function(): any {
|
||||
return {
|
||||
disabled: false,
|
||||
value: 0,
|
||||
minimumValue: 0,
|
||||
maximumValue: 1,
|
||||
step: 0
|
||||
step: 0,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -206,8 +208,8 @@ const Slider = createReactClass({
|
||||
uiViewClassName: 'RCTSlider',
|
||||
validAttributes: {
|
||||
...ReactNativeViewAttributes.RCTView,
|
||||
value: true
|
||||
}
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@@ -220,15 +222,17 @@ const Slider = createReactClass({
|
||||
/* $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;
|
||||
}
|
||||
onValueChange && userEvent && onValueChange(event.nativeEvent.value);
|
||||
});
|
||||
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;
|
||||
}
|
||||
onValueChange && userEvent && onValueChange(event.nativeEvent.value);
|
||||
});
|
||||
|
||||
/* $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
|
||||
@@ -238,17 +242,21 @@ const Slider = createReactClass({
|
||||
/* $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) => {
|
||||
onSlidingComplete && onSlidingComplete(event.nativeEvent.value);
|
||||
});
|
||||
props.onSlidingComplete =
|
||||
onSlidingComplete &&
|
||||
((event: Event) => {
|
||||
onSlidingComplete && onSlidingComplete(event.nativeEvent.value);
|
||||
});
|
||||
|
||||
return <RCTSlider
|
||||
{...props}
|
||||
enabled={!this.props.disabled}
|
||||
onStartShouldSetResponder={() => true}
|
||||
onResponderTerminationRequest={() => false}
|
||||
/>;
|
||||
}
|
||||
return (
|
||||
<RCTSlider
|
||||
{...props}
|
||||
enabled={!this.props.disabled}
|
||||
onStartShouldSetResponder={() => true}
|
||||
onResponderTerminationRequest={() => false}
|
||||
/>
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
let styles;
|
||||
@@ -269,7 +277,7 @@ if (Platform.OS === 'android') {
|
||||
options = {
|
||||
nativeOnly: {
|
||||
enabled: true,
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
const RCTSlider = requireNativeComponent('RCTSlider', Slider, options);
|
||||
|
||||
Reference in New Issue
Block a user