Skip to content

Commit 615daeb

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Slider move prop comments to flow types
Reviewed By: yungsters Differential Revision: D8246378 fbshipit-source-id: f62a77d64016f6502b3445ab6d0d1558034333e6
1 parent 1615f9d commit 615daeb

File tree

1 file changed

+79
-85
lines changed

1 file changed

+79
-85
lines changed

Diff for: Libraries/Components/Slider/Slider.js

+79-85
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,109 @@ const RCTSlider = requireNativeComponent('RCTSlider');
3434
type Event = Object;
3535

3636
type IOSProps = $ReadOnly<{|
37+
/**
38+
* Assigns a single image for the track. Only static images are supported.
39+
* The center pixel of the image will be stretched to fill the track.
40+
*/
3741
trackImage?: ?ImageSource,
42+
43+
/**
44+
* Assigns a minimum track image. Only static images are supported. The
45+
* rightmost pixel of the image will be stretched to fill the track.
46+
*/
3847
minimumTrackImage?: ?ImageSource,
48+
49+
/**
50+
* Assigns a maximum track image. Only static images are supported. The
51+
* leftmost pixel of the image will be stretched to fill the track.
52+
*/
3953
maximumTrackImage?: ?ImageSource,
54+
55+
/**
56+
* Sets an image for the thumb. Only static images are supported.
57+
*/
4058
thumbImage?: ?ImageSource,
4159
|}>;
4260

4361
type AndroidProps = $ReadOnly<{|
62+
/**
63+
* Color of the foreground switch grip.
64+
* @platform android
65+
*/
4466
thumbTintColor?: ?ColorValue,
4567
|}>;
4668

4769
type Props = $ReadOnly<{|
4870
...ViewProps,
4971
...IOSProps,
5072
...AndroidProps,
73+
74+
/**
75+
* Used to style and layout the `Slider`. See `StyleSheet.js` and
76+
* `ViewStylePropTypes.js` for more info.
77+
*/
5178
style?: ?ViewStyleProp,
79+
80+
/**
81+
* Initial value of the slider. The value should be between minimumValue
82+
* and maximumValue, which default to 0 and 1 respectively.
83+
* Default value is 0.
84+
*
85+
* *This is not a controlled component*, you don't need to update the
86+
* value during dragging.
87+
*/
5288
value?: ?number,
89+
90+
/**
91+
* Step value of the slider. The value should be
92+
* between 0 and (maximumValue - minimumValue).
93+
* Default value is 0.
94+
*/
5395
step?: ?number,
96+
97+
/**
98+
* Initial minimum value of the slider. Default value is 0.
99+
*/
54100
minimumValue?: ?number,
101+
102+
/**
103+
* Initial maximum value of the slider. Default value is 1.
104+
*/
55105
maximumValue?: ?number,
106+
107+
/**
108+
* The color used for the track to the left of the button.
109+
* Overrides the default blue gradient image on iOS.
110+
*/
56111
minimumTrackTintColor?: ?ColorValue,
112+
113+
/**
114+
* The color used for the track to the right of the button.
115+
* Overrides the default blue gradient image on iOS.
116+
*/
57117
maximumTrackTintColor?: ?ColorValue,
118+
119+
/**
120+
* If true the user won't be able to move the slider.
121+
* Default value is false.
122+
*/
58123
disabled?: ?boolean,
124+
125+
/**
126+
* Callback continuously called while the user is dragging the slider.
127+
*/
59128
onValueChange?: ?Function,
129+
130+
/**
131+
* Callback that is called when the user releases the slider,
132+
* regardless if the value has changed. The current value is passed
133+
* as an argument to the callback handler.
134+
*/
60135
onSlidingComplete?: ?Function,
136+
137+
/**
138+
* Used to locate this view in UI automation tests.
139+
*/
61140
testID?: ?string,
62141
|}>;
63142

@@ -127,106 +206,21 @@ const Slider = createReactClass({
127206

128207
propTypes: {
129208
...ViewPropTypes,
130-
131-
/**
132-
* Used to style and layout the `Slider`. See `StyleSheet.js` and
133-
* `ViewStylePropTypes.js` for more info.
134-
*/
135209
style: ViewPropTypes.style,
136-
137-
/**
138-
* Initial value of the slider. The value should be between minimumValue
139-
* and maximumValue, which default to 0 and 1 respectively.
140-
* Default value is 0.
141-
*
142-
* *This is not a controlled component*, you don't need to update the
143-
* value during dragging.
144-
*/
145210
value: PropTypes.number,
146-
147-
/**
148-
* Step value of the slider. The value should be
149-
* between 0 and (maximumValue - minimumValue).
150-
* Default value is 0.
151-
*/
152211
step: PropTypes.number,
153-
154-
/**
155-
* Initial minimum value of the slider. Default value is 0.
156-
*/
157212
minimumValue: PropTypes.number,
158-
159-
/**
160-
* Initial maximum value of the slider. Default value is 1.
161-
*/
162213
maximumValue: PropTypes.number,
163-
164-
/**
165-
* The color used for the track to the left of the button.
166-
* Overrides the default blue gradient image on iOS.
167-
*/
168214
minimumTrackTintColor: ColorPropType,
169-
170-
/**
171-
* The color used for the track to the right of the button.
172-
* Overrides the default blue gradient image on iOS.
173-
*/
174215
maximumTrackTintColor: ColorPropType,
175-
176-
/**
177-
* If true the user won't be able to move the slider.
178-
* Default value is false.
179-
*/
180216
disabled: PropTypes.bool,
181-
182-
/**
183-
* Assigns a single image for the track. Only static images are supported.
184-
* The center pixel of the image will be stretched to fill the track.
185-
* @platform ios
186-
*/
187217
trackImage: Image.propTypes.source,
188-
189-
/**
190-
* Assigns a minimum track image. Only static images are supported. The
191-
* rightmost pixel of the image will be stretched to fill the track.
192-
* @platform ios
193-
*/
194218
minimumTrackImage: Image.propTypes.source,
195-
196-
/**
197-
* Assigns a maximum track image. Only static images are supported. The
198-
* leftmost pixel of the image will be stretched to fill the track.
199-
* @platform ios
200-
*/
201219
maximumTrackImage: Image.propTypes.source,
202-
203-
/**
204-
* Sets an image for the thumb. Only static images are supported.
205-
* @platform ios
206-
*/
207220
thumbImage: Image.propTypes.source,
208-
209-
/**
210-
* Color of the foreground switch grip.
211-
* @platform android
212-
*/
213221
thumbTintColor: ColorPropType,
214-
215-
/**
216-
* Callback continuously called while the user is dragging the slider.
217-
*/
218222
onValueChange: PropTypes.func,
219-
220-
/**
221-
* Callback that is called when the user releases the slider,
222-
* regardless if the value has changed. The current value is passed
223-
* as an argument to the callback handler.
224-
*/
225223
onSlidingComplete: PropTypes.func,
226-
227-
/**
228-
* Used to locate this view in UI automation tests.
229-
*/
230224
testID: PropTypes.string,
231225
},
232226

0 commit comments

Comments
 (0)