[Native] TextInput flex/height issue
See original GitHub issueCurrent behaviour
The default TextInput component height is stretched to occupy the space it is inside of.
Expected behaviour
The TextInput height is set to the default calculated height
How to reproduce?
Import the TextInput component from RNP. The component is unclickable and occupies full height. By commenting theflexGrow
property in the styles.input
style inside the RNP TextInput component, the issue is fixed.
Preview
👉 Snack
With flexGrow
commented:
What have you tried so far?
I tried overriding flexGrow with props but that particular internal component does not accept any styling from props. At the moment, we’re using patch-package to fix the issue.
Your Environment
software | version |
---|---|
ios | x |
android | x |
react-native | 0.70.8 |
react-native-paper | 5.0.2 |
node | x.x.x |
npm or yarn | x.x.x |
expo sdk | x.x.x |
Issue Analytics
- State:
- Created 9 months ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
React Native: How to set <TextInput/>'s height and width to ...
Try setting the styling of TextInput to flex: 1 instead of getting the width. The Flex style will automatically fill your view and...
Read more >Textinput flex to full height and shrink to avoid keyboard?
I want the multiline textinput to flex to fill the available screen space. Then, when the on screen keyboard pops up I want...
Read more >KeyboardAvoidingView - React Native
KeyboardAvoidingView. This component will automatically adjust its height, position, or bottom padding based on the keyboard height to ...
Read more >flex-grow - CSS: Cascading Style Sheets - MDN Web Docs
The main size is either width or height of the item which is dependent on the flex-direction value. The remaining space is the...
Read more >react height 100 percent not working with flex - You.com
I thought that React Native flex default was to do this but for whatever reason my container is not fitting the images inside...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok as a temporary fix sure, looking forward to that confirmation, and that PR as well!
I think it’s ok, until I investigate the component behaviour and confirm whether we can remove mentioned
flexGrow: 1
. Also once that PR https://github.com/callstack/react-native-paper/pull/3509 is merged, you will be able to overrideflexGrow
.