nuke-input
Advanced tools
Comparing version 1.0.52 to 1.0.53
# Input Demo | ||
- order: 4 | ||
* order: 4 | ||
单行 非 md 模式 | ||
@@ -10,6 +9,5 @@ | ||
````js | ||
```js | ||
/** @jsx createElement */ | ||
import {createElement, Component,render } from 'rax'; | ||
import { createElement, Component, render } from 'rax'; | ||
import View from 'nuke-view'; | ||
@@ -20,3 +18,3 @@ import Text from 'nuke-text'; | ||
import Button from 'nuke-button'; | ||
import { isWeb ,appInfo} from 'nuke-env'; | ||
import { isWeb, appInfo } from 'nuke-env'; | ||
import { StyleProvider } from 'nuke-theme-provider'; | ||
@@ -27,12 +25,12 @@ | ||
let md = { | ||
Core:{ | ||
Core: { | ||
'color-brand1-1': '#00BBD3', | ||
'color-brand1-6': '#1A9CB7', | ||
'color-brand1-9': '#0096A6', | ||
'color-error-3': '#D50000', | ||
'color-error-3': '#D50000', | ||
'color-line1-1': '#DADADA', | ||
'color-line1-2': '#E0E0E0', | ||
'color-text1-1': '#9E9E9E', | ||
['font-size-title'] : 40, | ||
['font-size-subhead'] : 32, | ||
['font-size-title']: 40, | ||
['font-size-subhead']: 32, | ||
['font-size-body-3']: 28, | ||
@@ -42,81 +40,112 @@ ['font-size-body-2']: 28, | ||
['font-size-caption']: 24, | ||
['font-size-footnote']: 20, | ||
['font-size-footnote']: 20 | ||
} | ||
}; | ||
let App = class NukeDemoIndex extends Component { | ||
constructor() { | ||
super(); | ||
this.state={ | ||
status1:'error', | ||
status2:'error', | ||
status3:'error', | ||
value:'111' | ||
} | ||
this.checkLength = this.checkLength.bind(this); | ||
this.checkLengthOnInput = this.checkLengthOnInput.bind(this); | ||
this.change = this.change.bind(this); | ||
this.onIconPress = this.onIconPress.bind(this); | ||
constructor() { | ||
super(); | ||
this.state = { | ||
status1: 'error', | ||
status2: 'error', | ||
status3: 'error', | ||
value: '111' | ||
}; | ||
this.checkLength = this.checkLength.bind(this); | ||
this.checkLengthOnInput = this.checkLengthOnInput.bind(this); | ||
this.change = this.change.bind(this); | ||
this.onIconPress = this.onIconPress.bind(this); | ||
} | ||
change() { | ||
this.setState({ | ||
status1: 'success' | ||
}); | ||
} | ||
onIconPress() { | ||
alert('icon pressed'); | ||
} | ||
checkLength(text) { | ||
let length = text.length; | ||
// this.setState({value:text}); | ||
} | ||
checkLengthOnInput(e) { | ||
let text = e.value; | ||
let length = text.length; | ||
if (length > 10) { | ||
this.setState({ status3: 'success' }); | ||
console.log('success'); | ||
} | ||
change(){ | ||
this.setState({ | ||
status1:'success' | ||
}) | ||
} | ||
} | ||
onIconPress(){ | ||
alert('icon pressed'); | ||
} | ||
checkLength(text){ | ||
let length = text.length; | ||
// this.setState({value:text}); | ||
render() { | ||
return ( | ||
<StyleProvider | ||
style={md} | ||
commonConfigs={{ fixedFont: true }} | ||
androidConfigs={{ materialDesign: true }} | ||
> | ||
<Page title="single"> | ||
<Page.Intro main="Enter Voucher" /> | ||
<View style={styles.demoBlock}> | ||
<Input | ||
materialDesign={false} | ||
hasClear={true} | ||
type="text" | ||
placeholder="Ender Voucher Code" | ||
/> | ||
</View> | ||
} | ||
checkLengthOnInput(e){ | ||
let text = e.value; | ||
let length = text.length; | ||
if(length > 10){ | ||
this.setState({status3:'success'}); | ||
console.log('success'); | ||
} | ||
} | ||
render() { | ||
return ( | ||
<StyleProvider style={md} commonConfigs={{fixedFont:true}} androidConfigs={{materialDesign:true}}> | ||
<Page title="single"> | ||
<Page.Intro main="Enter Voucher"></Page.Intro> | ||
<View style={styles.demoBlock}> | ||
<Input materialDesign={false} hasClear={true} type="text" placeholder="Ender Voucher Code" /> | ||
</View> | ||
<Page.Intro main="blur ,show error"></Page.Intro> | ||
<View style={styles.demoBlock}> | ||
<Input materialDesign={false} hasClear={true} defaultValue={'WATSON$7189833'} onInput={this.checkLength} status={this.state.status1} type="text" onChange={this.change} placeholder="Enter Voucher Code" errorMessage={'Voucher code error'} /> | ||
</View> | ||
<Page.Intro main="maxLength,keep error when input,until success"></Page.Intro> | ||
<View style={styles.demoBlock}> | ||
<Input materialDesign={false} renderCount={true} maxLength={10} hasClear={true} defaultValue={'WATSON833'} onInput={this.checkLength} type="text" placeholder="Enter Voucher Code" /> | ||
</View> | ||
</Page> | ||
</StyleProvider> | ||
); | ||
} | ||
} | ||
<Page.Intro main="blur ,show error" /> | ||
<View style={styles.demoBlock}> | ||
<Input | ||
materialDesign={false} | ||
hasClear={true} | ||
defaultValue={'WATSON$7189833'} | ||
onInput={this.checkLength} | ||
status={this.state.status1} | ||
type="text" | ||
onChange={this.change} | ||
placeholder="Enter Voucher Code" | ||
errorMessage={'Voucher code error'} | ||
/> | ||
</View> | ||
<Page.Intro main="maxLength,keep error when input,until success" /> | ||
<View style={styles.demoBlock}> | ||
<Input | ||
materialDesign={false} | ||
renderCount={true} | ||
maxLength={10} | ||
hasClear={true} | ||
defaultValue={'WATSON833'} | ||
onInput={this.checkLength} | ||
type="text" | ||
placeholder="Enter Voucher Code" | ||
/> | ||
</View> | ||
<Page.Intro main="add style" /> | ||
<View style={styles.demoBlock}> | ||
<Input | ||
style={{ width: 300 }} | ||
materialDesign={false} | ||
renderCount={true} | ||
maxLength={10} | ||
hasClear={true} | ||
defaultValue={'WATSON833'} | ||
onInput={this.checkLength} | ||
type="text" | ||
placeholder="Enter Voucher Code" | ||
/> | ||
</View> | ||
</Page> | ||
</StyleProvider> | ||
); | ||
} | ||
}; | ||
const styles = { | ||
demoBlock:{ | ||
marginLeft:40, | ||
marginRight:40 | ||
demoBlock: { | ||
marginLeft: 40, | ||
marginRight: 40 | ||
} | ||
} | ||
render(<App/>); | ||
```` | ||
}; | ||
render(<App />); | ||
``` |
# Changelog | ||
## 1.0.53 / 2018-02-22 | ||
* [[0c63d7e](http://gitlab.alibaba-inc.com/nuke/input/commit/0c63d7ece40dc3277d06c0bf0d531590f0b502a9)] - `fix` fix style width not supported bug | ||
## 1.0.52 / 2018-02-13 | ||
@@ -5,0 +9,0 @@ |
@@ -344,3 +344,3 @@ 'use strict'; | ||
var inputWrapperStyle = Object.assign({ flex: 1 }, styles['input-wrap'], styles['' + (multiple ? 'multiple-wrap' : 'single-wrap')], readOnly ? styles.readonly : {}, status === 'error' ? styles['error-input-wrap'] : {}, focus ? styles['focus-input-wrap'] : {}, disabled ? styles[(multiple ? 'multiple' : 'single') + '-disabled'] : {}, style); | ||
var inputWrapperStyle = Object.assign({}, styles['input-wrap'], styles['' + (multiple ? 'multiple-wrap' : 'single-wrap')], readOnly ? styles.readonly : {}, status === 'error' ? styles['error-input-wrap'] : {}, focus ? styles['focus-input-wrap'] : {}, disabled ? styles[(multiple ? 'multiple' : 'single') + '-disabled'] : {}, style); | ||
// debugger; | ||
@@ -347,0 +347,0 @@ if (status === 'error' && !hideErrorWhenFocus || maxLengthError) { |
{ | ||
"name": "nuke-input", | ||
"version": "1.0.52", | ||
"version": "1.0.53", | ||
"description": "输入框", | ||
@@ -5,0 +5,0 @@ "main": "lib/index", |
181418