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.

alignItems: 'center' in a view above TextInput causes height to be full and width to be tiny

See original GitHub issue

Current behavior

When alignItems: 'center' is used on a View above TextInput in the tree the TextInput’s rendering is wonky. It takes the full height of the screen and has a very narrow width. A css width property must be specified in the component hierarchy between the View with alignItems: 'center' and the TextInput or on the TextInput itself.

Expected behavior

alignItems: 'center' should not change the size/shape of the TextInput, just the positioning (possibly)

Code sample

Here’s a minimal snack with the problem.

Screenshots (if applicable)

Screenshot (also see #1858, a closed issue with the same problem)

What I’ve tried

I reduced the issue down to the alignItems behavior. The snack linked above has commented out css props that work around the issue as well, but ultimately width must be specified somewhere if alignItems: 'center' is used; I have not tried it with other values of alignItems.

Your Environment

software version
ios or android both
react-native 0.63.3 (latest)
react-native-paper 4.3.0 (latest)
node v12.13.1
npm 6.13.1
expo sdk N/A
react-native-vector-icons N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
caleb-harrelsoncommented, Jan 28, 2021

Why was this closed? I commented to avoid the closure like the bot said I should.

7reactions
raajnadarcommented, Jul 25, 2021

You need to wrap the element inside a View tag, that is how flex box works on react native this is not a react native paper bug. You can report that in react native repo.

Note - This is not even a bugs that can be addressed

Read more comments on GitHub >

github_iconTop Results From Across the Web

align-items - CSS: Cascading Style Sheets - MDN Web Docs
For grid items, this keyword leads to a behavior similar to the one of ... #container { height: 200px; width: 240px; align-items: center; ......
Read more >
Text vertical align in react native (using nativebase)
Case 3: There are two Texts in a line view and the two Text fonts are different, and the Text with a smaller...
Read more >
How To Use CSS Grid Properties to Justify and Align Content ...
This code will produce a grid layout with three columns that are 100px wide. Each grid item will have a width of 50px...
Read more >
4. Flexbox Examples - Flexbox in CSS [Book] - O'Reilly
Flexbox Examples You now have a complete understanding of the CSS ... label { display : inline-flex ; align-items : center ; }...
Read more >
15 ways to implement vertical alignment with CSS
Absolute positioning and margin: auto. An element with no intrinsic size can be centered by simply using equal values from the top and...
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