1- import React , { Component , PropTypes } from 'react' ;
1+ import React , { Component } from 'react' ;
2+ import PropTypes from 'prop-types' ;
23import { View , NativeModules , DeviceEventEmitter , Slider , requireNativeComponent , Image , Platform , Dimensions , Text , StyleSheet } from 'react-native' ;
34
45const ReactNativeVolumeController = NativeModules . ReactNativeVolumeController ;
56
67type Event = Object ;
78
89export default class SliderVolumeController extends Component {
9-
10+
1011 static propTypes = {
1112 /**
1213 * The color used for the thumb.
1314 */
1415 thumbTintColor : PropTypes . string ,
15-
16+
1617 /**
1718 * The image for the thumb
1819 */
1920 thumbImage : Image . propTypes . source ,
20-
21+
2122 /**
2223 * The size of the thumb area that allows moving the thumb.
2324 * The default is {width: 23, height: 23}.
@@ -26,35 +27,35 @@ export default class SliderVolumeController extends Component {
2627 width : PropTypes . number ,
2728 height : PropTypes . number
2829 } ) ,
29-
30+
3031 /**
3132 * The color used for the track to the left of the button. Overrides the
3233 * default blue gradient image.
3334 */
3435 minimumTrackTintColor : PropTypes . string ,
35-
36+
3637 /**
3738 * The color used for the track to the right of the button. Overrides the
3839 * default blue gradient image.
3940 */
4041 maximumTrackTintColor : PropTypes . string ,
41-
42+
4243 /**
4344 * Specifies whether or not to show the route button for airplay
4445 */
4546 showsRouteButton : PropTypes . bool ,
46-
47+
4748 /**
4849 * Callback continuously called while the user is dragging the slider.
4950 */
5051 onValueChange : PropTypes . func
5152 } ;
52-
53+
5354 static defaultProps = {
5455 thumbSize : { width : 23 , height : 23 } ,
5556 showsRouteButton : true
5657 } ;
57-
58+
5859 constructor ( props ) {
5960 super ( props ) ;
6061 this . state = { volume_value :0.8 , has_button_route :false } ;
@@ -79,9 +80,9 @@ export default class SliderVolumeController extends Component {
7980 this . props . onValueChange &&
8081 this . props . onValueChange ( event . nativeEvent . value ) ;
8182 } ) ;
82-
83+
8384 const { style, ...rest } = this . props ;
84-
85+
8586 slider = < ReactNativeVolumeControllerSlider { ...rest }
8687 onValueChange = { onValueChange }
8788 style = { [ styles . slider , style , { width :sliderWidth } ] } />
@@ -90,7 +91,7 @@ export default class SliderVolumeController extends Component {
9091 return ( < View style = { [ this . props . style , { marginLeft :10 , marginRight :10 , flex :1 , flexDirection :"row" , width :viewWidth ,
9192 alignItems :'center' ,
9293 justifyContent :'center' } ] } >
93-
94+
9495 { slider }
9596
9697 </ View >
0 commit comments