react-native-ui-lib
Version:
[](https://stand-with-ukraine.pp.ua)
28 lines • 1.07 kB
JavaScript
import React from 'react';
import { requireNativeComponent } from 'react-native';
import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.android";
import KeyboardRegistry from "../KeyboardRegistry";
import CustomKeyboardViewBase from "../CustomKeyboardViewBase";
const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
export default class CustomKeyboardView extends CustomKeyboardViewBase {
static displayName = 'IGNORE';
async componentDidUpdate(prevProps) {
const {
component
} = this.props;
if (prevProps.component !== component && !component) {
await TextInputKeyboardManager.reset();
}
super.componentDidUpdate(prevProps);
}
render() {
const {
component,
initialProps
} = this.props;
const KeyboardComponent = component && KeyboardRegistry.getKeyboard(component);
return <CustomKeyboardViewNativeAndroid>
{KeyboardComponent && <KeyboardComponent {...initialProps} />}
</CustomKeyboardViewNativeAndroid>;
}
}