Open AmauryLiet opened 4 years ago
I'm facing same issue, do you solve it @AmauryLiet ?
This is my "solution":
// FIXME https://github.com/APSL/react-native-keyboard-aware-scroll-view/issues/438
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { listenToKeyboardEvents } from "react-native-keyboard-aware-scroll-view";
import { ScrollView } from "react-native-gesture-handler";
const KeyboardAwareScrollView: typeof ScrollView = listenToKeyboardEvents(
ScrollView
);
hey @neiker! I eventually went for a more appropriate solution to my specific issue
Your solution is the most convenient and will indeed resolve TS error but you won't have any autocomplete or type checking
Anyway, thanks for sharing it for future readers ;)
also having this issue, took me about an hour before figuring out the method was added in the index.js file but wasn't add in the declaration file. Had to create my own declaration file
Not really sure why I can not get a RNGH KeyboardAwareScrollView
to work as a regular KeyboardAwareScrollView
(nothing shows up). I have the versions below. Wondering if anyone is facing the same issue.
"react-native-gesture-handler": "^2.17.1"
"react-native-keyboard-aware-scroll-view": "^0.9.5",
Ended up with an alternative solution:
import { createNativeWrapper } from 'react-native-gesture-handler';
import { KeyboardAwareScrollView as BaseKeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
type KeyboardAwareScrollViewProps = ComponentProps<
typeof BaseKeyboardAwareScrollView
>;
const KeyboardAwareScrollView =
createNativeWrapper<KeyboardAwareScrollViewProps>(
BaseKeyboardAwareScrollView,
{
disallowInterruption: true,
shouldCancelWhenOutside: false,
},
);
Hey!
First of all thanks for the great lib, solving painful issues on my projects
I wanted to use the listenToKeyboardEvents HOC to apply it on other components (such as Scrollview from 'react-native-gesture-handler'), but unfortunately the HOC isn't mentionned in index.d.ts, resulting in TS errors
Happy to provide more info if necessary, Thanks!