-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
<View /> doesn't recalculate it's size when a descendant <Text /> changes height due to wrapping following a device rotation #23443
Comments
Experiencing the same Problem. I have a card which will wrap it's content (text) when changing from landscape <--> portrait due to space limitation. When changing back, the card is getting bigger. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
stale[bot] this is still an issue. Please don’t close this bug. |
Seeing the same thing... Text in Portrait: "bla bla bla bla bla bla..." ( 2 lines) Happens on iOS only. |
Any luck with this? Looks like poking the style prop of the view (e.g., adding a random min height each time onLayout is called) can fix the issue, but this is quite ugly and also would make every view slower. Any quick efficient work around? |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Still an issue with 0.61.5 |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
This is still an issue and hasn't been fixed. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
This is still an issue. |
Not sure if it's the same issue, but in Android when rotating the device to landscape the window scaled outside of the visible screen area. So if I position something absolutely and set |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Still an issue
El vie., 25 de diciembre de 2020 19:16, stale[bot] <[email protected]>
escribió:
… Hey there, it looks like there has been no activity on this issue
recently. Has the issue been fixed, or does it still require the
community's attention? This issue may be closed if no further activity
occurs. You may also label this issue as a "Discussion" or add it to the
"Backlog" and I will leave it open. Thank you for your contributions.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#23443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALU263ESPHT7MU7TLDBIZKLSWUFNDANCNFSM4GXJWIYA>
.
|
I have a very very similar issue ( Some how add inline <View style{{ flex ...}}>
// Children
<Text style={{display: 'none'}}>{`${Math.random()}`}</Text> // <-- super weird work around
</View> I tried
none of them can solve issue. I guess inline I REAL wonder does this workaround can solve rest of yours' issue ??? 🤔 |
I fixed it by making sure the immediate parent view has flex 0.
… El 1 oct. 2021, a la(s) 00:28, Jacky ***@***.***> escribió:
I have a very very similar issue, but @jeremywiebe 's workaround is NOT work for me.
Some how add inline Math.random() can solve my issue
<View style{{ flex ...}}>
// Children
<Text style={{display: 'none'}}>{`${Math.random()}`}</Text> // <-- super weird work around
</View>
I tried
use key to re-mount whole component
use fixed string replace Math.random
use state to store Math.random, update it after rotate
none of them can solve issue.
I guess inline Math.random() make RN re-trigger something to manipulate iOS recalculate
I REAL wonder does this workaround can solve rest of yours' issue ??? 🤔
give me a emoji if this super weird workaround help you
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Still a bug. |
For me, randomly updating the minHeight of the
|
That’s an awful work around as it means constant re renders, and hard to explain. Would you do this for every text component you use? |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Still an issue. |
🐛 Bug Report
I believe I've found a bug in the
View
size calculation logic in React Native. In certain cases, the ancestorView
fails to recalculate its size if a descendant<Text />
component changes in size due to a rotation and subsequent text (re)wrapping.The following shows three states: initial, rotated, and back to original orientation. Notice that the fuschia view "grows" after returning to the original orientation.
Initial orientation
Portrait
Back to initial orientation
Speculative Analysis and Workaround
This appears to be an issue where an ancestor view caches a layout calculation and doesn't trigger a re-calculation when a nested Text component changes in size due to orientation changes.
After some playing around, we've figured out that if you "poke" any of the style properties that affect the view's style layout, the view will recalculate and be correct. We did this by toggling a state var upon rotation and then adding/removing a style object to the view's
styles
array that contained an extrapaddingBottom
that mirrored the existingpadding
on the view (basically we changed the style but the effect had no changes to the layout).You can see a demo of the workaround by uncommenting the line of code below the
FIXME
comment in the code sample.To Reproduce
See the code, but basically if you have a
<ScrollView>
that contains a container<View>
which contains another<View>
and then have a<Text>
element inside that view... this layout bug will happen. I haven't been able to reduce this example further than that.Expected Behavior
After rotating and going back to the initial orientation, the View should be exactly the same size.
Code Example
Github repo: https://github.com/jeremywiebe/react-native-text-orientation-bug
Environment
The text was updated successfully, but these errors were encountered: