You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ts: Type '{ children: Element; behavior: "padding"; contentContainerStyle: { flex: number; borderColor: string; borderWidth: number; }; keyboardVerticalOffset: number; style: { flex: number; borderColor: string; borderWidth: number; }; }' is not assignable to type 'IntrinsicAttributes & (PropsWithChildren<KeyboardAvoidingViewProps> & RefAttributes<View>)'.
Types of property 'contentContainerStyle' are incompatible.
Type '{ flex: number; borderColor: string; borderWidth: number; }' is not assignable to type 'undefined'.
Sorry, I haven't created a separate repo for this yet, but can if needed.
To Reproduce
Steps to reproduce the behavior:
Create a new Expo app using the default template
Drop the code above into the app as a new screen
Notice TypeScript error in your IDE
Expected behavior
No red squiggle in my IDE
Screenshots
See above
Smartphone (please complete the following information):
Desktop OS: MacOS 15.1.1
Device: N/A
OS: N/A
RN version: 0.76.5
RN architecture: "newArchEnabled": false
JS engine: I don't know
Library version: 1.15.0
Additional context
Diving into the generated types for the library I see this
exporttypeKeyboardAvoidingViewProps=KeyboardAvoidingViewBaseProps&({/** * Specify how to react to the presence of the keyboard. */behavior?: "position";/** * Style of the content container when `behavior` is 'position'. */contentContainerStyle?: ViewProps["style"];}|{/** * Specify how to react to the presence of the keyboard. */behavior?: "height"|"padding";/** * `contentContainerStyle` is not allowed for these behaviors. */contentContainerStyle?: never;});
And, indeed, if I change to behavior="position" the type error goes away. So there seems to be some kind of missmatch between the documentation and the actual code 🙂
The text was updated successfully, but these errors were encountered:
I think I introduced that bug here: #711 and forgot to update a documentation 😬
contentContainerStyle is needed only if behavior="position", so it's expected beavaior to see a TS error here (in this case we tel ldevs that this property will not do anything meaningful).
I'll fix it in documentation straight away! Thanks for noticing this!
Describe the bug
Getting red squiggle with the
<KeyboardAvoidingView>
example code from the documentation here https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-avoiding-view#exampleThis is the error I get:
Code snippet
Repo for reproducing
Sorry, I haven't created a separate repo for this yet, but can if needed.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No red squiggle in my IDE
Screenshots
See above
Smartphone (please complete the following information):
"newArchEnabled": false
Additional context
Diving into the generated types for the library I see this
And, indeed, if I change to
behavior="position"
the type error goes away. So there seems to be some kind of missmatch between the documentation and the actual code 🙂The text was updated successfully, but these errors were encountered: