react-native-picker-actionsheet
Advanced tools
Comparing version 1.1.4 to 1.1.5
{ | ||
"name": "react-native-picker-actionsheet", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "A picker like ActionSheet component which can be used in iOS & Android . Use Animated . ", | ||
@@ -23,3 +23,3 @@ "main": "src/index.js", | ||
"homepage": "https://github.com/BooYeu/react-native-picker-actionsheet#readme", | ||
"devDependencies": { | ||
"devDependencies": { | ||
"pre-commit": "^1.1.3", | ||
@@ -26,0 +26,0 @@ "react": "^16.0.0-beta.5", |
import React from 'react'; | ||
import {StyleSheet,Animated,View,Text,TouchableWithoutFeedback} from 'react-native'; | ||
import {StyleSheet,Animated,Modal,View,ScrollView,Text,TouchableWithoutFeedback,Dimensions} from 'react-native'; | ||
@@ -14,4 +14,5 @@ export default class extends React.Component{ | ||
submitText:'submit', | ||
onSubmit:()=>{}, | ||
onCancel:()=>{}, | ||
onSubmit:()=>{} | ||
shadowClick:'submit' | ||
}; | ||
@@ -21,2 +22,6 @@ constructor(props){ | ||
this.state={maskerOpacity:new Animated.Value(this.props.show?.5:0),bottomPosition:new Animated.Value(this.props.show?1:0),show:!this.props.show}; | ||
this.showF=()=>this.setState({show:this.props.show}); | ||
this.cancelF=()=>this.props.onCancel(); | ||
this.shadowF=()=>this.props.shadowClick==='submit'?this.props.onSubmit():this.props.onCancel(); | ||
this.submitF=()=>this.props.onSubmit(); | ||
} | ||
@@ -43,6 +48,6 @@ render(){ | ||
) | ||
]).start(()=>this.setState({show:this.props.show})); | ||
]).start(this.showF); | ||
return( | ||
<View style={[styles.container,{zIndex:this.state.show||this.props.show?100:-100}]}> | ||
<TouchableWithoutFeedback onPress={()=>this.props.onSubmit()}> | ||
this.state.show||this.props.show?<Modal transparent={true} onRequestClose={this.cancelF}> | ||
<TouchableWithoutFeedback onPress={this.shadowF}> | ||
<Animated.View style={[styles.masker,{opacity:this.state.maskerOpacity}]} /> | ||
@@ -60,3 +65,3 @@ </TouchableWithoutFeedback> | ||
<View style={styles.item_top}> | ||
<Text style={styles.item_top_btn} onPress={()=>this.props.onCancel()}>{this.props.cancelText}</Text> | ||
<Text style={styles.item_top_btn} onPress={this.cancelF}>{this.props.cancelText}</Text> | ||
<View style={styles.item_top_title_container}> | ||
@@ -66,9 +71,13 @@ <Text style={styles.item_top_title}>{this.props.title}</Text> | ||
</View> | ||
<Text style={styles.item_top_btn} onPress={()=>this.props.onSubmit()}>{this.props.submitText}</Text> | ||
<Text style={styles.item_top_btn} onPress={this.submitF}>{this.props.submitText}</Text> | ||
</View> | ||
<View style={styles.items}> | ||
{item} | ||
</View> | ||
{item.length>0?this.props.scrollEnabled? | ||
<ScrollView style={styles.items_scroll}> | ||
{item} | ||
</ScrollView>: | ||
<View style={styles.items}> | ||
{item} | ||
</View>:this.props.ListEmptyComponent} | ||
</Animated.View> | ||
</View> | ||
</Modal>:null | ||
); | ||
@@ -79,11 +88,2 @@ } | ||
const styles=StyleSheet.create({ | ||
container:{ | ||
flex:1, | ||
position:'absolute', | ||
top:0, | ||
bottom:0, | ||
left:0, | ||
right:0, | ||
zIndex:100 | ||
}, | ||
masker:{ | ||
@@ -125,7 +125,11 @@ backgroundColor:'#000', | ||
flexDirection:'row', | ||
justifyContent:'center', | ||
justifyContent:'space-around', | ||
alignItems:'center', | ||
flexWrap:'wrap', | ||
backgroundColor:'#f9f9f9' | ||
} | ||
}, | ||
items_scroll:{ | ||
paddingVertical:6, | ||
backgroundColor:'#f9f9f9' | ||
} | ||
}); |
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
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
7379
125