react-native-tag-input
Advanced tools
Comparing version 0.0.11 to 0.0.12
32
index.js
@@ -1,2 +0,2 @@ | ||
import React, {PropTypes, Component} from 'react' | ||
import React, {PropTypes, Component} from 'react'; | ||
import { | ||
@@ -10,4 +10,5 @@ View, | ||
TouchableWithoutFeedback | ||
} from 'react-native' | ||
import _ from 'lodash' | ||
} from 'react-native'; | ||
import _ from 'lodash'; | ||
class EmailInput extends Component { | ||
@@ -50,3 +51,3 @@ constructor(props) { | ||
} else { | ||
this.setState({inputWidth: spaceLeft}) | ||
this.setState({inputWidth: spaceLeft}); | ||
} | ||
@@ -95,3 +96,3 @@ }); | ||
onKeyPress(event) { | ||
if (this.state.text == "" && event.nativeEvent && event.nativeEvent.key == "Backspace") { | ||
if (this.state.text === "" && event.nativeEvent && event.nativeEvent.key == "Backspace") { | ||
this.pop(); | ||
@@ -119,8 +120,17 @@ } | ||
let {text} = this.state; | ||
let {value} = this.props; | ||
let {value, inputProps} = this.props; | ||
let width = text.length < 4 | ||
? 100 | ||
: null; | ||
let defaultInputProps = { | ||
autoCapitalize: "none", | ||
autoCorrect: false, | ||
placeholder: this.props.placeholder || "Start typing", | ||
returnKeyType: this.props.returnKeyType || "done", | ||
keyboardType: this.props.keyboardType || "email-address", | ||
underlineColorAndroid: "rgba(0,0,0,0)" | ||
} | ||
inputProps = {...defaultInputProps, ...inputProps}; | ||
let width = text.length < 4 ? 100 : null; | ||
let tagColor = this.props.tagColor || "#dddddd"; | ||
@@ -152,3 +162,3 @@ let tagTextColor = this.props.tagTextColor || "#777777"; | ||
}}> | ||
<TextInput ref="emailInput" blurOnSubmit={false} onKeyPress={this.onKeyPress.bind(this)} value={this.state.text} style={[ | ||
<TextInput ref="emailInput" {...inputProps} blurOnSubmit={false} onKeyPress={this.onKeyPress.bind(this)} value={this.state.text} style={[ | ||
styles.textInput, { | ||
@@ -158,3 +168,3 @@ width: width, | ||
} | ||
]} autoCapitalize="none" autoCorrect={false} placeholder={this.props.placeholder} returnKeyType={this.props.returnKeyType || "done"} keyboardType={this.props.keyboardType || "email-address"} underlineColorAndroid="rgba(0,0,0,0)" onChange={this.onChange.bind(this)} onSubmitEditing={this.parseEmails}/> | ||
]} onChange={this.onChange.bind(this)} onSubmitEditing={this.parseEmails}/> | ||
</View> | ||
@@ -161,0 +171,0 @@ </View> |
{ | ||
"name": "react-native-tag-input", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "A tag input component for react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -25,1 +25,2 @@ # React Native Tag Input | ||
| inputColor | Color of text input | | ||
| inputProps | Any misc. TextInput props (autofocus, returnKeyType, etc.) | |
42956
5
198
26