Skip to content

Commit cc9c2f3

Browse files
authored
Merge pull request #10 from joeyfigaro/master
added prop-types; updated PropTypes import; added yarn.lock
2 parents ee737f3 + b505d80 commit cc9c2f3

File tree

3 files changed

+3634
-16
lines changed

3 files changed

+3634
-16
lines changed

index.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
import React, { Component, PropTypes } from 'react';
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
23
import { View, NativeModules, DeviceEventEmitter, Slider, requireNativeComponent, Image, Platform, Dimensions, Text, StyleSheet } from 'react-native';
34

45
const ReactNativeVolumeController = NativeModules.ReactNativeVolumeController;
56

67
type Event = Object;
78

89
export 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>

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,24 @@
1010
"type": "git",
1111
"url": "git+https://github.com/parinha/react-native-volume-controller.git"
1212
},
13-
"keywords": ["volume", "control", "sound"],
13+
"keywords": [
14+
"volume",
15+
"control",
16+
"sound"
17+
],
1418
"author": "Victor Carvalho Tavernari",
1519
"license": "ISC",
1620
"bugs": {
1721
"url": "https://github.com/Tavernari/react-native-volume-controller/issues"
1822
},
19-
"homepage":
20-
"https://github.com/Tavernari/react-native-volume-controller#readme",
23+
"homepage": "https://github.com/Tavernari/react-native-volume-controller#readme",
2124
"peerDependencies": {
2225
"react-native": ">=0.31.0"
2326
},
2427
"devDependencies": {
2528
"react-native": ">=0.31.0"
29+
},
30+
"dependencies": {
31+
"prop-types": "^15.6.0"
2632
}
2733
}

0 commit comments

Comments
 (0)