diff --git a/lib/KeyboardAwareHOC.js b/lib/KeyboardAwareHOC.js index 4bf0ed0..10b7106 100644 --- a/lib/KeyboardAwareHOC.js +++ b/lib/KeyboardAwareHOC.js @@ -545,8 +545,11 @@ 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') { +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)