diff --git a/lib/KeyboardAwareHOC.js b/lib/KeyboardAwareHOC.js index 51a91d7..af2cb61 100644 --- a/lib/KeyboardAwareHOC.js +++ b/lib/KeyboardAwareHOC.js @@ -545,8 +545,16 @@ function KeyboardAwareHOC( // Allow to pass options, without breaking change, and curried for composition // listenToKeyboardEvents(ScrollView); // listenToKeyboardEvents(options)(Comp); -const listenToKeyboardEvents = (configOrComp: any) => { - if (typeof configOrComp === 'object' && !configOrComp.displayName) { +//FIX referencing this issue +//https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/429#issuecomment-631299411 +// Allow to pass options, without breaking change, and curried for composition +// listenToKeyboardEvents(ScrollView); +// listenToKeyboardEvents(options)(Comp); +const listenToKeyboardEvents = (configOrComp: React.ReactElement | KeyboardAwareHOCProps) => { + if(configOrComp?.displayName === "ScrollView") { + return KeyboardAwareHOC(configOrComp) + } + else if (typeof configOrComp === 'object') { return (Comp: Function) => KeyboardAwareHOC(Comp, configOrComp) } else { return KeyboardAwareHOC(configOrComp)