question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Native] TextInput flex/height issue

See original GitHub issue

Current 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.

image

Preview

👉 Snack

image

With flexGrow commented:

image

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:closed
  • Created 9 months ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bombillazocommented, Dec 15, 2022

Ok as a temporary fix sure, looking forward to that confirmation, and that PR as well!

1reaction
lukewalczakcommented, Dec 15, 2022

Is this a good pattern though?

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 override flexGrow.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found