Slider move prop comments to flow types

Reviewed By: yungsters

Differential Revision: D8246378

fbshipit-source-id: f62a77d64016f6502b3445ab6d0d1558034333e6
This commit is contained in:
Eli White 2018-06-02 22:35:45 -07:00 committed by Facebook Github Bot
parent 1615f9d161
commit 615daeb68f
1 changed files with 79 additions and 85 deletions

View File

@ -34,13 +34,35 @@ const RCTSlider = requireNativeComponent('RCTSlider');
type Event = Object; type Event = Object;
type IOSProps = $ReadOnly<{| type IOSProps = $ReadOnly<{|
/**
* Assigns a single image for the track. Only static images are supported.
* The center pixel of the image will be stretched to fill the track.
*/
trackImage?: ?ImageSource, trackImage?: ?ImageSource,
/**
* Assigns a minimum track image. Only static images are supported. The
* rightmost pixel of the image will be stretched to fill the track.
*/
minimumTrackImage?: ?ImageSource, minimumTrackImage?: ?ImageSource,
/**
* Assigns a maximum track image. Only static images are supported. The
* leftmost pixel of the image will be stretched to fill the track.
*/
maximumTrackImage?: ?ImageSource, maximumTrackImage?: ?ImageSource,
/**
* Sets an image for the thumb. Only static images are supported.
*/
thumbImage?: ?ImageSource, thumbImage?: ?ImageSource,
|}>; |}>;
type AndroidProps = $ReadOnly<{| type AndroidProps = $ReadOnly<{|
/**
* Color of the foreground switch grip.
* @platform android
*/
thumbTintColor?: ?ColorValue, thumbTintColor?: ?ColorValue,
|}>; |}>;
@ -48,16 +70,73 @@ type Props = $ReadOnly<{|
...ViewProps, ...ViewProps,
...IOSProps, ...IOSProps,
...AndroidProps, ...AndroidProps,
/**
* Used to style and layout the `Slider`. See `StyleSheet.js` and
* `ViewStylePropTypes.js` for more info.
*/
style?: ?ViewStyleProp, style?: ?ViewStyleProp,
/**
* Initial value of the slider. The value should be between minimumValue
* and maximumValue, which default to 0 and 1 respectively.
* Default value is 0.
*
* *This is not a controlled component*, you don't need to update the
* value during dragging.
*/
value?: ?number, value?: ?number,
/**
* Step value of the slider. The value should be
* between 0 and (maximumValue - minimumValue).
* Default value is 0.
*/
step?: ?number, step?: ?number,
/**
* Initial minimum value of the slider. Default value is 0.
*/
minimumValue?: ?number, minimumValue?: ?number,
/**
* Initial maximum value of the slider. Default value is 1.
*/
maximumValue?: ?number, maximumValue?: ?number,
/**
* The color used for the track to the left of the button.
* Overrides the default blue gradient image on iOS.
*/
minimumTrackTintColor?: ?ColorValue, minimumTrackTintColor?: ?ColorValue,
/**
* The color used for the track to the right of the button.
* Overrides the default blue gradient image on iOS.
*/
maximumTrackTintColor?: ?ColorValue, maximumTrackTintColor?: ?ColorValue,
/**
* If true the user won't be able to move the slider.
* Default value is false.
*/
disabled?: ?boolean, disabled?: ?boolean,
/**
* Callback continuously called while the user is dragging the slider.
*/
onValueChange?: ?Function, onValueChange?: ?Function,
/**
* Callback that is called when the user releases the slider,
* regardless if the value has changed. The current value is passed
* as an argument to the callback handler.
*/
onSlidingComplete?: ?Function, onSlidingComplete?: ?Function,
/**
* Used to locate this view in UI automation tests.
*/
testID?: ?string, testID?: ?string,
|}>; |}>;
@ -127,106 +206,21 @@ const Slider = createReactClass({
propTypes: { propTypes: {
...ViewPropTypes, ...ViewPropTypes,
/**
* Used to style and layout the `Slider`. See `StyleSheet.js` and
* `ViewStylePropTypes.js` for more info.
*/
style: ViewPropTypes.style, style: ViewPropTypes.style,
/**
* Initial value of the slider. The value should be between minimumValue
* and maximumValue, which default to 0 and 1 respectively.
* Default value is 0.
*
* *This is not a controlled component*, you don't need to update the
* value during dragging.
*/
value: PropTypes.number, value: PropTypes.number,
/**
* Step value of the slider. The value should be
* between 0 and (maximumValue - minimumValue).
* Default value is 0.
*/
step: PropTypes.number, step: PropTypes.number,
/**
* Initial minimum value of the slider. Default value is 0.
*/
minimumValue: PropTypes.number, minimumValue: PropTypes.number,
/**
* Initial maximum value of the slider. Default value is 1.
*/
maximumValue: PropTypes.number, maximumValue: PropTypes.number,
/**
* The color used for the track to the left of the button.
* Overrides the default blue gradient image on iOS.
*/
minimumTrackTintColor: ColorPropType, minimumTrackTintColor: ColorPropType,
/**
* The color used for the track to the right of the button.
* Overrides the default blue gradient image on iOS.
*/
maximumTrackTintColor: ColorPropType, maximumTrackTintColor: ColorPropType,
/**
* If true the user won't be able to move the slider.
* Default value is false.
*/
disabled: PropTypes.bool, disabled: PropTypes.bool,
/**
* Assigns a single image for the track. Only static images are supported.
* The center pixel of the image will be stretched to fill the track.
* @platform ios
*/
trackImage: Image.propTypes.source, trackImage: Image.propTypes.source,
/**
* Assigns a minimum track image. Only static images are supported. The
* rightmost pixel of the image will be stretched to fill the track.
* @platform ios
*/
minimumTrackImage: Image.propTypes.source, minimumTrackImage: Image.propTypes.source,
/**
* Assigns a maximum track image. Only static images are supported. The
* leftmost pixel of the image will be stretched to fill the track.
* @platform ios
*/
maximumTrackImage: Image.propTypes.source, maximumTrackImage: Image.propTypes.source,
/**
* Sets an image for the thumb. Only static images are supported.
* @platform ios
*/
thumbImage: Image.propTypes.source, thumbImage: Image.propTypes.source,
/**
* Color of the foreground switch grip.
* @platform android
*/
thumbTintColor: ColorPropType, thumbTintColor: ColorPropType,
/**
* Callback continuously called while the user is dragging the slider.
*/
onValueChange: PropTypes.func, onValueChange: PropTypes.func,
/**
* Callback that is called when the user releases the slider,
* regardless if the value has changed. The current value is passed
* as an argument to the callback handler.
*/
onSlidingComplete: PropTypes.func, onSlidingComplete: PropTypes.func,
/**
* Used to locate this view in UI automation tests.
*/
testID: PropTypes.string, testID: PropTypes.string,
}, },