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.

TextInput with mode="outlined", how to use bigger height for multiline and how to remove the paddingTop

See original GitHub issue

Current behaviour

Expected behaviour

I am setting height in <TextInput multiline style={{height: 200, paddingTop: 0}} /> to have a bigger textarea field.

It seems that the padding top is forced by react native paper

Code sample

<TextInput multiline style={{height: 200, paddingTop: 0}} />

Reproduction

https://snack.expo.io/@kopax/blessed-popsicle

Screenshots (if applicable)

image

What have you tried

So far, I don’t see how to use my paddingTop preference to fix the issue

Your Environment

software version
ios or android web
react-native expo sdk 36
react-native-paper 3.6.0
node 13
npm or yarn 6.4.1
expo sdk 36

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Svartocommented, Nov 12, 2020

@OlimpiaZurek that comment does not fixed the forced paddingTop, or am I missing something? The paddingTop comes from the view that RNP have wrapped the textinput in, it is set at 8, and I can’t find a way to make it zero

1reaction
jasongaarecommented, Jun 2, 2020

I’ve hit this same issue. When using mode="outlined" the text is padding on the top, creating an undesirable user experience.

My ultimate solution has been to hack together my own outlined TextInput, by extending the styles of the flat style, as seen here (using styled components):

const OutlinedTextInput = styled(TextInput).attrs({
  dense: true,
  underlineColor: 'transparent',
})`
  margin: 8px 0px;
  border: ${StyleSheet.hairlineWidth}px solid ${colors.charcoal};
  border-radius: 4px;
  padding-bottom: 4px;
`;
Read more comments on GitHub >

github_iconTop Results From Across the Web

How would I grow <TextInput> height upon text wrapping?
My answer is to use onContentSizeChange and numberOfLines props in TextInput, of course turn on multiline , this is my solution:
Read more >
A complete guide to TextInput in React Native - LogRocket Blog
Learn how to implement React Native's TextInput component, customize it to collect user inputs, and style your fields with React Native ...
Read more >
TextInput · React Native Paper
A component to allow users to input text. ... When you apply height prop in style the dense prop affects only paddingVertical inside...
Read more >
TextInput - React Native
The most basic use case is to plop down a TextInput and subscribe to the ... input: { height: 40, margin: 12, borderWidth:...
Read more >
padding-top - CSS: Cascading Style Sheets - MDN Web Docs
The padding-top CSS property sets the height of the padding area on the top of an element.
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