react-native-wheel
Advanced tools
Comparing version 1.0.7 to 1.0.8
{ | ||
"name": "react-native-wheel", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "android wheel view for react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
115
README.md
@@ -73,41 +73,91 @@ # react-native-wheel | ||
// file: index.android.js | ||
'use strict'; | ||
var React = require('react-native'); | ||
var { | ||
AppRegistry, | ||
StyleSheet, | ||
Text, | ||
ToastAndroid, | ||
View, | ||
} = React; | ||
var WheelView = require('react-native-wheel'); | ||
var { AppRegistry,StyleSheet,Text,View,ToastAndroid } = React; | ||
var Dimensions = require('Dimensions'); | ||
var SCREEN_WIDTH = Dimensions.get('window').width; | ||
var SCREEN_HEIGHT = Dimensions.get('window').height; | ||
var wheelData = ['one','two','three','four','five','six','seven','eight','nine','ten']; | ||
var currentIndex; | ||
var AwesomeProject = React.createClass({ | ||
onItemChange(index){ | ||
ToastAndroid.show('select item : ' + wheelData[index],ToastAndroid.SHORT); | ||
}, | ||
render: function() { | ||
return ( | ||
<View style={styles.container}> | ||
<WheelView | ||
style={styles.wheelview} | ||
onItemChange={this.onItemChange} | ||
values={wheelData} | ||
isLoop={true} | ||
selectedIndex={0} | ||
textSize={17} | ||
/> | ||
</View> | ||
); | ||
} | ||
previous(){ | ||
this.refs.wheel.previous(); | ||
}, | ||
next(){ | ||
this.refs.wheel.next(); | ||
}, | ||
finish(){ | ||
ToastAndroid.show('select item : ' + wheelData[currentIndex] ,ToastAndroid.LONG); | ||
}, | ||
onItemChange(index){ | ||
currentIndex = index; | ||
}, | ||
render: function() { | ||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.welcome} onPress={this.previous} > | ||
上一个 | ||
</Text> | ||
<Text style={styles.instructions} onPress={this.next} > | ||
下一个 | ||
</Text> | ||
<Text style={styles.instructions} onPress={this.finish} > | ||
完成 | ||
</Text> | ||
<WheelView | ||
style={styles.wheelview} | ||
onItemChange={this.onItemChange} | ||
values={wheelData} | ||
isLoop={false} | ||
selectedIndex={0} | ||
textSize={20} | ||
ref='wheel' | ||
/> | ||
</View> | ||
); | ||
} | ||
}); | ||
var styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
justifyContent: 'flex-end', | ||
alignItems: 'center', | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
previous: { | ||
margin: 20, | ||
fontSize: 22, | ||
color: '#000000', | ||
}, | ||
next: { | ||
margin: 20, | ||
color: '#000000', | ||
fontSize: 22, | ||
}, | ||
finish: { | ||
margin: 20, | ||
color: '#000000', | ||
fontSize: 22, | ||
}, | ||
wheelview: { | ||
width: 120, | ||
height: 300 | ||
width: SCREEN_WIDTH, | ||
height: SCREEN_HEIGHT/5*2, | ||
}, | ||
@@ -122,5 +172,6 @@ }); | ||
## Notes | ||
- if has error , please check build.gradle config | ||
- you can modify this library (react-native-wheel/build.gradle) | ||
- Only in the following versions tested , other versions do not guarantee success | ||
```gradle | ||
// file: react-native-wheel/build.gradle | ||
@@ -133,3 +184,3 @@ android { | ||
minSdkVersion 16 | ||
targetSdkVersion 23 //@ | ||
targetSdkVersion 22 //@ | ||
} | ||
@@ -139,16 +190,6 @@ } | ||
dependencies { | ||
compile 'com.facebook.react:react-native:0.15.+' //@ | ||
compile 'com.facebook.react:react-native:0.16.1' //@ | ||
} | ||
// modify the above @ value not higher than you project value | ||
``` | ||
##Reference | ||
https://github.com/weidongjian/androidWheelView | ||
## Run Renderings | ||
<center> | ||
<img src="https://github.com/shexiaoheng/react-native-wheel/blob/master/Screenshot/result.png" | ||
width="300" height="450"/> | ||
</center> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
162455
18
192
1