Fix rn 0.50 repeated calls to onMeasure.#2261
Conversation
enahum
left a comment
There was a problem hiding this comment.
I can confirm that this PR fixes the issue with RN 0.50 on android where the view was flickering all the time
|
is there anything else needed for this PR to get merged? |
|
Anything that is holding back this PR? If not, would like to see this merged as soon as possible :) |
|
Also waiting for this PR being merged to carry on with my work, thanks. |
|
Friendly Ping @guyca and/or @DanielZlotin ? :) |
|
I can also confirm that this fixes the flickering issue in our app. Would love to see this merged in soon! |
|
When do you merge this PR? @guyca |
|
it works! thanks 🥇 |
|
Is that on NPM yet? |
|
@Flavien yes, I use yarn and with |
|
Looks like this fix was released with version |
|
This fix the flickering view issue on my app 🥂 |
|
Thanks @chaitanya0bhagvan ! 👍 Is this backwards compatible? Does the new version of I really miss a change log here or at least which versions that depends on which react-native versions. Related #1551 |
|
@skovhus This is backward compatible change. As of now the docs and examples have not been updated to reflect RN 0.50 change where |
* r_master: fixed toggle tabs bug (wix#2369) Add paddingTop to android ToolBar. (wix#2266) [Android] TopTabs font family (wix#2342) Ensure correct spelling of commandType (wix#2246) Add unregisterForPreviewingWithContext (wix#2239) Fix rn 0.50 repeated calls to onMeasure. (wix#2261) [Android] Support for transparent statusbar with current screen rendered behind it (wix#2274) Fix NPE when activity is relaunched on changing font size of the phone (wix#2319) Missed comma (wix#2305) Add commandType param to props which indicates if a screen is displayed using push or modal Find textual buttons in TitleBar by text instead of content description Add a toString implementation to StyleParams Color (wix#2313)
* master: Now allowing the custom nav bar to take up the whole space on iOS (wix#2306) Fix formatting of code block in installation-ios (wix#2356) Added optional fixedWidth property to the Android side menu (wix#2380) await startApp on activity resumed (wix#2370) fixed toggle tabs bug (wix#2369) Add paddingTop to android ToolBar. (wix#2266) [Android] TopTabs font family (wix#2342) Ensure correct spelling of commandType (wix#2246) Add unregisterForPreviewingWithContext (wix#2239) Fix rn 0.50 repeated calls to onMeasure. (wix#2261) [Android] Support for transparent statusbar with current screen rendered behind it (wix#2274) Fix NPE when activity is relaunched on changing font size of the phone (wix#2319) Missed comma (wix#2305) Add commandType param to props which indicates if a screen is displayed using push or modal Find textual buttons in TitleBar by text instead of content description Add a toString implementation to StyleParams Color (wix#2313)
bringing this patch from: wix#2261
RN 0.50 introduced a new feature to dynamically measure ReactRootView. Since RNN uses RelativeLayout for Screen and BottomTabsLayout child views added to the layout may have additional rules. When the child views are measured they are measured with respect to the LayoutParams set during Screen creation and the Parent MeasureSpec. In RNN, ContentView extends ReactRootView and it calls onMeasure using the widthMeasureSpec and heightMeasureSpec passed to it. If these measureSpecs are EXACTLY then ReactRootView will measure itself to fit the exact size requested by the parent.
If ContentView was added with LayoutParams.MATCH_PARENT for height and/or width with additional rules eg. BELOW or ABOVE the effective height of this View may not be compatible with MATCH_PARENT. RelativeLayout does two passes over its children, in the first pass each child is measured as per their LayoutParams, in the second pass LayoutParam rules are applied and each child is measured. The problem occurs here, if ReactRootView was asked to measure itself with MeasureSpec.EXACTLY but the measuredHeight was less than expected it will trigger a requestLayout() causing the entire layout to be remeasured.
The fix is to call super.onMeasure() in ContentView with MeasureSpec.AT_MOST.