-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alignItems: 'center' in a view above TextInput causes height to be full and width to be tiny #2335
Comments
Couldn't find version numbers for the following packages in the issue:
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3. The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
Couldn't find version numbers for the following packages in the issue:
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3. The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
|
I'm not sure if it's a react-native-paper problem. I think it is caused by React Native interal styling I have seen such issues more sometimes with other things as textInputs. But maybe we could fix this if we add flexDirection: 'row' to the base style of the textinput but I don't know yet if this has other implications. Result of this change applied manually |
Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue. |
This fixes the 100% height part of the problem, but not the requirement to set a width (it's still very narrow). |
Why was this closed? I commented to avoid the closure like the bot said I should. |
did you find any solution ? |
Having the same issue here. What is the recommended solution? The exact same CSS style with other UI frameworks i.e react-native-elements behaves correctly. With Papers the textInput goes crazy. |
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 |
The element is wrapped inside a View tag. This code can reproduce the behaviour. If I use a Core Native it don't behave in this manner. Arent the TextInput component supposed to grow to fit its own content?
|
I have replicated the behavior and have the same problem. I wonder if this issue could be reopened. |
Just started a new project and am running into this as well. |
I ended up setting |
I am also facing the same issue |
Hey, I set the parent view a width, and it worked fine for me. |
I am having the same issue today |
Any updates on this? Running into this on "react-native": "0.72.6" |
I have the same problem. If you set alignItems: "stretch" rather than "center", the height of its child will no grow(child has flexGrow:1). If you set alighItems: "center". The child will fill the whole height. It must be a bug as "align" shouldn't affect the height. seems a bug of style. |
Ran into this as well (for the N:th time). There's something fundamentally broken with the styling of |
Current behavior
When
alignItems: 'center'
is used on aView
aboveTextInput
in the tree theTextInput
's rendering is wonky. It takes the full height of the screen and has a very narrow width. A csswidth
property must be specified in the component hierarchy between theView
withalignItems: 'center'
and theTextInput
or on theTextInput
itself.Expected behavior
alignItems: 'center'
should not change the size/shape of theTextInput
, just the positioning (possibly)Code sample
Here's a minimal snack with the problem.
Screenshots (if applicable)
(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 ultimatelywidth
must be specified somewhere ifalignItems: 'center'
is used; I have not tried it with other values ofalignItems
.Your Environment
The text was updated successfully, but these errors were encountered: