mirror of
https://github.com/zhigang1992/react-native-global-props.git
synced 2026-03-26 07:04:17 +08:00
Added setCustomKeyboardAvoidingView
This commit is contained in:
14
src/CustomFunctions/setCustomKeyboardAvoidingView.js
Normal file
14
src/CustomFunctions/setCustomKeyboardAvoidingView.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { KeyboardAvoidingView } from 'react-native';
|
||||
|
||||
export const setCustomKeyboardAvoidingView = customProps => {
|
||||
const kbvRender = KeyboardAvoidingView.prototype.render;
|
||||
Image.prototype.render = function render() {
|
||||
let oldProps = this.props;
|
||||
this.props = { ...customProps, ...this.props };
|
||||
try {
|
||||
return kbvRender.apply(this, arguments);
|
||||
} finally {
|
||||
this.props = oldProps;
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user