自动隐藏键盘高阶组件
作者:
剌小胥 | 来源:发表于
2017-03-31 18:41 被阅读273次/**
* Created by DB on 2017/1/16.
* 点击空白处,自动隐藏键盘高阶组件
*/
import React, { Component } from 'react'
import {TouchableWithoutFeedback, View} from 'react-native'
import dismissKeyboard from 'react-native/Libraries/Utilities/dismissKeyboard'
const Decorator = WrappedCompoent => class extends Component {
render() {
return (
<TouchableWithoutFeedback style={{flex:1}} onPress={dismissKeyboard}>
<View style={{flex:1}}>
<WrappedCompoent {...this.props}/>
</View>
</TouchableWithoutFeedback>
)
}
};
export default Decorator
本文标题:自动隐藏键盘高阶组件
本文链接:https://www.haomeiwen.com/subject/spivottx.html
网友评论