开发者社区> 问答> 正文

TextInput右边有个按钮,点击按钮的时候,input是不是该自动失焦

import {createElement, Component, render} from 'rax';
import {Tabbar, View,TextInput,Button,Modal} from 'nuke';
import Module from '../lib/module';

class Index extends Module {
    state = {
        searchKey: ''
    }
    searchTrade(){
      console.log(this.state.searchKey);
    }
    render() {
        return (
            <View style={{flex: 1}}>
            <TextInput
                placeholder="买家昵称/订单号"
                maxLength="50"
                style={{width:'750rem',height:'50rem',borderLeft:'1rem',borderRight:'1rem',borderTop:'1rem',borderBottom:'1rem'}}
                value={this.state.searchKey}
                onBlur={(e) => {
                    console.log('onBlur=================================');
                    this.setState({
                        searchKey: e.value
                    });
                }}
            />
            <Button onPress={() => {
                this.searchTrade();
            }}>搜索</Button>
            </View>
        );
    }
}

render(<Index />);

展开
收起
wuzhennandkj 2017-03-03 14:47:42 3288 0
1 条回答
写回答
取消 提交回答
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载