react-native-yusha-customKeyboard
react-native-yusha-customKeyboard copied to clipboard
嵌套在Modal里将无法使用
因为键盘在Modal下层, 修改git项目的/RNDemo/App.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
StyleSheet,
Modal,
View,
Button,
Text
} from 'react-native';
require('./js/RegisterKeyboard')
import * as CustomKeyboard from 'react-native-yusha-customkeyboard'
export default class App extends Component {
constructor(props){
super(props)
this.state = {
visible: false
}
}
render() {
return (
<View>
<Modal
animationType={'none'}
transparent={true}
visible={this.state.visible}
onRequestClose={()=>{this.setState({visible: false})}}>
<CustomKeyboard.AwareCusKeyBoardScrollView style={{flex: 1}}>
<CustomKeyboard.CustomTextInput
customKeyboardType="numberKeyBoard"
placeholder="numberKeyBoard"
style={{marginTop: 20}}
/>
<CustomKeyboard.CustomTextInput
customKeyboardType="numberKeyBoardWithDot"
placeholder="numberKeyBoardWithDot"
/>
<CustomKeyboard.CustomTextInput
customKeyboardType="safeKeyBoard"
placeholder="safeKeyBoard"
/>
<CustomKeyboard.CustomTextInput
customKeyboardType="testKeyboard"
placeholder="testKeyboard"
/>
</CustomKeyboard.AwareCusKeyBoardScrollView>
<Button title={'观察'} onPress={()=>{this.setState({visible: false})}}></Button>
</Modal>
<Button title={'显示'} onPress={()=>{this.setState({visible: true})}}></Button>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
height: 700,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});