Skip to content
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

New in RN 0.54, Android only: using display: none and position: absolute together doesn't work right #18415

Closed
aarondail opened this issue Mar 16, 2018 · 39 comments
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@aarondail
Copy link

Basically, if you use the styles display: none and position: absolute on a component the component will still be rendered. On Android. iOS works ok. This used to be fine (at least as of 0.52.2).

Environment

Environment:
  OS: macOS Sierra 10.12.6
  Node: 9.8.0
  Yarn: 1.5.1
  npm: 5.6.0
  Watchman: 4.5.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 2.3 AI-162.3934792

Packages: (wanted => installed)
  react: ^16.3.0-alpha.1 => 16.3.0-alpha.2
  react-native: 0.54.2 => 0.54.2

Expected Behavior

A component with style display: none should never be rendered.

Here is an example of a component using both styles:

        <View style={{
          position: 'absolute',
          display: 'none',
          bottom: 100,
          left: -30,
          backgroundColor: 'blue',
          borderColor: 'red',
          borderWidth: 9,
        }}>
          <Text> Hey Hey Hey Hey Hey </Text>
        </View>

If I add that to my App.js, and run it, this is what it looks like on iOS:
ios_display_none

I.e. its not rendered, as expected :)

Actual Behavior

This is the same code as above, just running on Android. Note that the element is visible (and actually left: -30 is also not working)

android_display_none

Steps to Reproduce

Create a sample app using react-native init

Paste this into the App.js file, inside the render() method, before the final </View> (for me between lines 35 and 36):

        <View style={{
          position: 'absolute',
          display: 'none',
          bottom: 100,
          left: -30,
          backgroundColor: 'blue',
          borderColor: 'red',
          borderWidth: 9,
        }}>
          <Text> Hey Hey Hey Hey Hey </Text>
        </View>

Run it on iOS. Observe the View is not rendered. Run it on Android. Observe that it is.

@react-native-bot react-native-bot added Android Ran Commands One of our bots successfully processed a command. labels Mar 16, 2018
@hramos hramos added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. labels Mar 16, 2018
@react-native-bot react-native-bot added the Missing Test Plan This PR appears to be missing a test plan. label Mar 16, 2018
@hramos hramos removed the Missing Test Plan This PR appears to be missing a test plan. label Mar 16, 2018
@react-native-bot react-native-bot added Android Ran Commands One of our bots successfully processed a command. labels Mar 18, 2018
@react-native-bot react-native-bot added Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. labels Mar 18, 2018
@react-native-bot react-native-bot added the Platform: macOS Building on macOS. label Mar 20, 2018
@tsaohucn

This comment has been minimized.

@henrikland
Copy link

Same issue here, completely breaks the app I am working on. Will have to find a workaround until this is fixed.

@hramos hramos removed the Platform: macOS Building on macOS. label Mar 29, 2018
@fallenner

This comment has been minimized.

@VijayLogitech
Copy link

display:none, and position:absolute, occupies the corners of the device screen, instead of hiding the native controls. RN 0.54

@forkbomb
Copy link

<View style={{position: 'absolute'}}> <View style={{display: 'none'}}> </View> </View>

works for me.

@njacobs5074
Copy link

On our app, we use style overlays for different devices (phones vs tablets) and so was able to implement a workaround by using position: 'relative' for our phone style. Not 100% ideal but it works in our limited circumstance.

@react-native-bot

This comment has been minimized.

@bisht2ankit
Copy link

@forkbomb Thanks.. Worked for me.. But can you explain why its not working if we put position absolute and display none in a single view?

@njacobs5074
Copy link

We see this issue on v0.55.4, btw. But the workaround I posted above addresses the issue for us on that release.

@Yibay

This comment has been minimized.

@neilzhengzx

This comment has been minimized.

@pdkn
Copy link

pdkn commented Jul 6, 2018

me too. 0.55.4 any idea if it's fixed in 0.56?

@z-zp
Copy link

z-zp commented Jul 11, 2018

<View style={{
          position: 'absolute',
          bottom: 100,
          left: -30,
          backgroundColor: 'blue',
          borderColor: 'red',
          borderWidth: 9,
        }}>
       <View  style={{
          position: 'relative',
          display: 'none',
        }}>
          <Text> Hey Hey Hey Hey Hey </Text>
        </View>
</View>

@verybluebot

This comment has been minimized.

@xdajay
Copy link

xdajay commented May 10, 2020

Facing a similar issue with Android, Plus its a tooltip really can't get rid of position absolute.
Opacity creates touches and visibility, Zindex isn't working either.

Any update on this issue?

Update: Wrapping around other View works!

@fabOnReact
Copy link
Contributor

I gave it a quick look

maybe this is not connected to react native but to https://github.com/facebook/yoga

setPosition uses Yoga to set each position

@Override
public void setPosition(int spacingType, float position) {
mYogaNode.setPosition(YogaEdge.fromInt(spacingType), position);
}

setDisplay uses Yoga to set display: none

@Override
public void setDisplay(YogaDisplay display) {
mYogaNode.setDisplay(display);
}

The two logic seems to conflict, so an Idea would be to create a reproducible example using android and yoga and open an issue at https://github.com/facebook/yoga/issues

I don't think that it is easy to troubleshoot this without building Yoga from source but I did not try extensively, because I would like to debug the Yoga code

https://github.com/facebook/yoga#building

I just judge this issues as very hard to solve for react-native contributor

@rptoma
Copy link

rptoma commented Jun 7, 2020

Still happening in RN 0.61.5

@xaiamov
Copy link

xaiamov commented Jun 9, 2020

The same story in RN 0.62.2

@younes200
Copy link

same on RN 0.63.0

@thomasDelaporte
Copy link

Same issue on React native expo sdk-40.0.1.

@fabOnReact
Copy link
Contributor

fabOnReact commented Feb 26, 2021

#30338 (comment)
Can you reproduce this without react-native using https://github.com/facebook/yoga as a dependency?
Maybe it is an issue with facebook/yoga dependency and not react-native

We need to reproduce this without react-native, by building from source https://github.com/facebook/yoga and then debug the sourcecode, as I believe the relevant sourcecode for this problem is not included in react-native.

If we can reproduce the problem without react-native, you can open an issue in https://github.com/facebook/yoga, this problem will get fixed.. otherwise we may never find a solution

The functionality seems to be part of yoga, was developed with pr facebook/yoga#369 to close facebook/yoga#241 and facebook/yoga#302

https://github.com/woehrl01/yoga/blob/29c60b81c361edb5861168e7085144f6bb80e5c2/yoga/Yoga.c#L1934-L1939

    if (child->style.display == YGDisplayNone) {
      YGZeroOutLayoutRecursivly(child);
      child->hasNewLayout = true;
      child->isDirty = false;
      continue;
    }

Thanks ☮️ 😃

@rnike
Copy link
Contributor

rnike commented Feb 26, 2021

Still an issue on 0.64.0-rc.3

rozele added a commit to rozele/yoga that referenced this issue Mar 5, 2021
Summary:
There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

Differential Revision: D26849307

fbshipit-source-id: 53e4971903654952970daf53fd0a971c0ab1ebc2
rozele added a commit to rozele/yoga that referenced this issue Mar 9, 2021
…acebook#1068)

Summary:
Pull Request resolved: facebook#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 1ab7caa1894fd98051958aa55def72d8865befb8
facebook-github-bot pushed a commit to facebook/yoga that referenced this issue Mar 10, 2021
…1068)

Summary:
Pull Request resolved: #1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
facebook-github-bot pushed a commit to facebook/litho that referenced this issue Mar 10, 2021
…#1068)

Summary:
Pull Request resolved: facebook/yoga#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
facebook-github-bot pushed a commit that referenced this issue Mar 10, 2021
…1068)

Summary:
Pull Request resolved: facebook/yoga#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
dantes-git pushed a commit to ZupIT/yoga that referenced this issue Apr 15, 2021
…acebook#1068)

Summary:
Pull Request resolved: facebook#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
dantes-git pushed a commit to ZupIT/yoga that referenced this issue Apr 15, 2021
…acebook#1068)

Summary:
Pull Request resolved: facebook#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
@maki3000
Copy link

maki3000 commented May 25, 2021

Another workaround which might help. We apply a black overlay with just one button inside (we make our own power save mode for OLED devices :) because our app can't go into background...). The button is visible all the time.

<View style={styles.container}>
      <StatusBar
        animated={true}
        showHideTransition={"fade"}
        barStyle={"dark-content"}
        hidden={savePower}
      />
      <View style={styles.powerSaveContainer}>
        <TouchableOpacity style={styles.powerSaveButton} onPress={setPowerSaveMode}>
          <Text style={styles.powerSaveButtonText}>{savePowerText}</Text>
        </TouchableOpacity>
      </View>
      <View style={[
        savePower ? {
          backgroundColor: "#000000",
          zIndex: 100,
        } : {
          backgroundColor: Colors.defaultBackground,
          zIndex: -10,
        },
        styles.powerSaveOverlayContainer
      ]}>
      </View>
      <View style={styles.innerContainer}>
          {/* other content */}
     </View>
</View>

And the styles:

const styles = StyleSheet.create({
  container: {
    alignItems: 'center',
    backgroundColor: Colors.defaultBackground,
    flex: 1,
    justifyContent: 'center',
    paddingHorizontal: 16,
    paddingTop: 32,
  },
  powerSaveOverlayContainer: {
    bottom: 0,
    left: 0,
    position: "absolute",
    right: 0,
    top: 0,
  },
  innerContainer: {
    alignItems: 'center',
    flex: 1,
    justifyContent: 'center',
  },
  powerSaveContainer: {
    flexDirection: "row",
    justifyContent: "space-between",
    paddingTop: 18,
    zIndex: 1000,
  },
  powerSaveButton: {
    backgroundColor: "#8C8989",
    borderColor: "#999999",
    borderRadius: 120,
    borderWidth: 1,
    margin: 8,
  },
  powerSaveButtonText: {
    color: "#ffffff",
    padding: 12,
  },
});

We toggle savePower in setPowerSaveMode method and work with same backgroundColor as the container when not visible and black backgroundColor when visible and apply different zIndex.

cntrump added a commit to cntrump/yoga that referenced this issue Jun 29, 2021
commit 578d197
Author: Lauren Bentley <lebentle@fb.com>
Date:   Fri Jun 18 12:19:40 2021 -0700

    remove .buckversion files from fbsource/xplat

    Summary: Buck has not relied on the .buckversion file for a while now. I am trying to clean up the number of configs at the root of the cell for buck. This diff attempts to remove .buckversion code referecnes from fbsource/xplat Instead of calling cat .buckversion to get the buckversion hash, you can call buck --fast-version which parses the buck-java11 file without downloading buck. Alternatively, you can also do something like cat .buck-java11 | grep -o -E -e "[0-9a-f]{40}" | head -1  to get the buckversion hash.

    Reviewed By: stepancheg

    Differential Revision: D28579639

    fbshipit-source-id: 6231e16df41f3e403098576e4bfd5d5a2fd38a14

commit e5acf77
Author: Amir Shalem <amirshalem@fb.com>
Date:   Thu Jun 3 07:02:49 2021 -0700

    Don't allocate large arrays on stack when copying native pointers, use heap based array

    Summary:
    Don't allocate large arrays on stack when copying native pointers, use heap based array.

    Today the code copies the native pointers on the stack, since it may be too big, lets make sure to use heap based allocating using std::vector.

    This array is afterwards converted into a reversed map from index to pointer, so it is heap based anyhow.

    Changelog: [Internal] Don't allocate large arrays on stack when copying native pointers, use heap based array

    Reviewed By: Andrey-Mishanin

    Differential Revision: D28747213

    fbshipit-source-id: da69b4b2d0960fdade9f07f44654b30d6dacc43a

commit f031297
Author: Pascal Hartig <realpassy@fb.com>
Date:   Sun May 23 11:37:42 2021 -0700

    Disable snapshot publishing (facebook#1089)

    Summary:
    Currently broken. Will reenable this separately.

    Pull Request resolved: facebook#1089

    Reviewed By: mweststrate

    Differential Revision: D28609885

    Pulled By: passy

    fbshipit-source-id: 380359d09ee96d321d49c6440bde358c3e791c1a

commit 8a65d8b
Author: Pascal Hartig <phartig@rdrei.net>
Date:   Fri May 21 11:40:17 2021 -0700

    Release GitHub actions workflow (facebook#1088)

    Summary: Pull Request resolved: facebook#1088

    Reviewed By: mweststrate

    Differential Revision: D28604872

    Pulled By: passy

    fbshipit-source-id: e77578d44557420be9b782dc90f047af697b7cb9

commit 0fcef77
Author: Pascal Hartig <phartig@rdrei.net>
Date:   Fri May 21 11:40:17 2021 -0700

    Maven release docs (facebook#1087)

    Summary:
    *Context: The Yoga OSS build has not been given a lot of attention over the past couple of years and is in serious disrepair. I'll try to get the release pipeline going again to publish to Maven Central as JCenter is shutting down. A bunch of intermediate commits may still have broken builds but will be inching closer to a working one.*

    Adds some docs on how to use the release workflow.

    Pull Request resolved: facebook#1087

    Reviewed By: priteshrnandgaonkar

    Differential Revision: D28604686

    Pulled By: passy

    fbshipit-source-id: 44cac2cd0593a4f71d80df1ec5324c3c27fbe888

commit e3a59aa
Author: Pascal Hartig <phartig@rdrei.net>
Date:   Fri May 21 11:40:17 2021 -0700

    Maven central publish (facebook#1086)

    Summary:
    Sets up the plugins necessary to publish to Maven Central.

    Pull Request resolved: facebook#1086

    Test Plan: ./gradlew publishToMavenLocal -PRELEASE_SIGNING_ENABLED=false

    Reviewed By: mweststrate

    Differential Revision: D28604529

    Pulled By: passy

    fbshipit-source-id: 2c35b94ce0e254bc7a8bc80e449ac5dadb5def38

commit 13e079e
Author: Pascal Hartig <phartig@rdrei.net>
Date:   Fri May 21 11:14:07 2021 -0700

    Upgrade Gradle setup (facebook#1084)

    Summary:
    Trying to dust off the build setup and make it work again with a modern Android Studio / JVM.

    Removing all JCenter setup, too, as this is no longer supported.

    Pull Request resolved: facebook#1084

    Test Plan:
    `./gradlew :yoga-layout:assembleDebug` works already.
    Looking if CI here likes this.

    Reviewed By: mweststrate

    Differential Revision: D28602272

    Pulled By: passy

    fbshipit-source-id: 0cb86f548cc6366ccefcc92c185d6e7772e75547

commit 508f4ea
Author: Pascal Hartig <phartig@rdrei.net>
Date:   Fri May 21 10:10:34 2021 -0700

    Fix env setting and Android setup (facebook#1085)

    Summary:
    *Context: The Yoga OSS build has not been given a lot of attention over the past couple of years and is in serious disrepair. I'll try to get the release pipeline going again to publish to Maven Central as JCenter is shutting down. A bunch of intermediate commits may still have broken builds but will be inching closer to a working one.*

    The current way env variables are set is no longer supported for security reasons: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/. The manual Android setup is also quite tricky to maintain and can mostly be done through GitHub Actions itself.

    Please note that the actual build is still failing but that's because we're so far behind with the setup here that the Gradle version no longer works on a modern JVM. I'll fix that in subsequent diffs.

    Pull Request resolved: facebook#1085

    Test Plan: CI

    Reviewed By: mweststrate

    Differential Revision: D28602084

    Pulled By: passy

    fbshipit-source-id: e334ed92d16a9baa185a84b23bb62801399e5650

commit a999150
Author: Andres Suarez <asuarez@fb.com>
Date:   Thu May 20 21:22:47 2021 -0700

    Apply clang-format

    Reviewed By: igorsugak

    Differential Revision: D28477074

    fbshipit-source-id: f15dfc45b9fb30c661ebe2899cd882676d0fdf2a

commit cbf6495
Author: Aditya Sharat <adityasharat@fb.com>
Date:   Tue Mar 30 05:41:22 2021 -0700

    Refactor YogaNode.Inputs freeze API

    Summary:
    `InternalNode` will eventually not have a pointer to its parent. This diff removes one of the usages of the `InternalNode#getParent()` API. `InternalNode` will also not host the `YogaNode` eventually; so this diff also removes one of the usages of the `InternalNode#getYogaNode()` api.

    Now the `Inputs#freeze` api will pass the parent's `YogaNode` and the `YogaNode` of the node (this) being measured.

    Changelog: [Internal] Passes The YogaNode and parent YogaNode in the Inputs.freeze API

    Reviewed By: SidharthGuglani

    Differential Revision: D27240229

    fbshipit-source-id: efc4ec3249a963c3181111f9b989d8ed9e17feb4

commit 07eaeea
Author: Aditya Sharat <adityasharat@fb.com>
Date:   Fri Mar 26 10:04:04 2021 -0700

    Create YogaProps Interface

    Summary:
    Create YogaProps Interface; this interface represents the inputs to YogaNode for layout calculation.

    Changelog: [Internal] Create YogaProps Interface; this interface represents the inputs to YogaNode for layout calculation.

    Reviewed By: mihaelao

    Differential Revision: D27229274

    fbshipit-source-id: 5205caf2384661369d7a2d7e7f3e49ff831a1c92

commit 6386902
Author: Altaibayar Tseveenbayar <altaibayar@fb.com>
Date:   Mon Mar 22 07:41:16 2021 -0700

    Yoga set as a static library also for debug+release builds in x64

    Summary: Yoga set as a static library also for debug+release builds in x64

    Reviewed By: SidharthGuglani

    Differential Revision: D27230019

    fbshipit-source-id: d77e2c4130cd8303d1585723bfad927b9ddba23e

commit 6c2ba94
Author: Altaibayar Tseveenbayar <altaibayar@fb.com>
Date:   Mon Mar 22 04:31:18 2021 -0700

    Making yoga by default a static library

    Summary: We are linking yoga as a static library in most of the places

    Reviewed By: SidharthGuglani

    Differential Revision: D27228933

    fbshipit-source-id: 725d6551198c96925ae80b3a62ef9737ee7e3052

commit db6be52
Author: Altaibayar Tseveenbayar <altaibayar@fb.com>
Date:   Fri Mar 19 19:22:49 2021 -0700

    C4244 possible precision loss warning fix

    Summary:
    Fixing `warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data`

    Changelog: [Internal]

    Reviewed By: SidharthGuglani

    Differential Revision: D27132355

    fbshipit-source-id: 55ff35be368ef4f6093865eb88c17e753250d179

commit 67b6c24
Author: Altaibayar Tseveenbayar <altaibayar@fb.com>
Date:   Thu Mar 18 03:42:31 2021 -0700

    Yoga Visual Studio project file fix

    Summary: Yoga Visual Studio project file was outdated. Made it back working/compilable

    Reviewed By: Andrey-Mishanin

    Differential Revision: D27138942

    fbshipit-source-id: 5d57e61dbb415db54e255e148739c2e670f3bd23

commit b209580
Author: Pieter De Baets <pieterdb@fb.com>
Date:   Mon Mar 15 16:53:05 2021 -0700

    Simplify YGNodeEmptyContainer / YGNodeWithMeasureFunc / YGNodeFixedSize

    Summary:
    These methods are only ever called just after setting the various YGStyle props. Therefore we can read any padding / margin / border state from there rather than recalculating it.

    Changelog: [Internal]

    Reviewed By: SidharthGuglani

    Differential Revision: D27010098

    fbshipit-source-id: a33f879b25c54cfdb0ffc724b6aa325858e97df5

commit e87f429
Author: Pieter De Baets <pieterdb@fb.com>
Date:   Mon Mar 15 16:53:05 2021 -0700

    Simplify YGNodeCalculateAvailableInnerDim

    Summary:
    Avoid recalculating margin and padding by pre-subtracting the margin from `availableWidth` and inlining the calculation of `paddingAndBorderAxisCross`.

    Changelog: [Internal]

    Reviewed By: SidharthGuglani

    Differential Revision: D27010094

    fbshipit-source-id: afc3cf251a0306b9e5d7f0dc6856feee8d1dca6e

commit 41384fa
Author: Pieter De Baets <pieterdb@fb.com>
Date:   Mon Mar 15 16:53:05 2021 -0700

    Optimize edge value resolution

    Summary:
    Noticed in simpleperf this was a very hot method, showing 8ms spent in these methods in our sample application. By splitting the method out in a horizontal and vertical variant we can simplify cases enormously and check for begin/end in one go.

    Changelog: [Internal]

    Reviewed By: SidharthGuglani

    Differential Revision: D27010008

    fbshipit-source-id: 22fed58c7476e1d716b0191b55997c7a06e63223

commit 342aebe
Author: Eric Rozell <ericroz@fb.com>
Date:   Wed Mar 10 13:08:48 2021 -0800

    Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute (facebook#1068)

    Summary:
    Pull Request resolved: facebook#1068

    There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

    Here are some OSS issues tracking this:
    facebook/react-native#18415
    microsoft/react-native-windows#7289

    ## Changelog

    [General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

    Reviewed By: Andrey-Mishanin

    Differential Revision: D26849307

    fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d

commit 1745c23
Author: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Date:   Wed Mar 10 12:36:47 2021 -0800

    Fix various C++ warnings (#31002)

    Summary:
    Fix warnings about implicit type truncation.

    ## Changelog

    [Internal] [Fixed] - Fix various C++ warnings

    Pull Request resolved: facebook/react-native#31002

    Test Plan:
    Almost all the changes here are simply making explicit conversions which are already occurring.  With the exception of a couple of constants being changed from doubles to floats.

    With these changes I am able to remove a bunch of warning suppressions in react-native-windows.

    Reviewed By: shergin

    Differential Revision: D26900502

    Pulled By: rozele

    fbshipit-source-id: d5e415282815c2212a840a863713287bbf118c10

commit ccdea0f
Author: Stiopa Koltsov <nga@fb.com>
Date:   Mon Mar 1 13:13:44 2021 -0800

    xplat: switch random files to Starlark

    Summary:
    We need to get rid of all `# BUILD FILE SYNTAX: PYTHON_DSL` to disable hybrid parser after we make Starlark default everywhere.

    This is first bunch of changes.

    Reviewed By: mzlee

    Differential Revision: D26727784

    fbshipit-source-id: 05c5f4d039feb4ce06169ac6d2fc5c49711125cd

commit c1a28f3
Author: Sidharth Guglani <sidharthguglani@fb.com>
Date:   Thu Feb 25 06:34:24 2021 -0800

    Add back snapshot in version for next release

    Summary: Changelog: [Internal][Yoga] version bump

    Reviewed By: pasqualeanatriello

    Differential Revision: D26664063

    fbshipit-source-id: ceb8d31a99f85db7d1fde20bd77584a537d356c6

commit 0429704
Author: Sidharth Guglani <sidharthguglani@fb.com>
Date:   Thu Feb 25 06:34:24 2021 -0800

    version bump

    Reviewed By: pasqualeanatriello

    Differential Revision: D26664041

    fbshipit-source-id: 5a4d0d176074c8831dd18681993463fe25e2642f

commit 36e70c9
Author: Sidharth Guglani <sidharthguglani@fb.com>
Date:   Thu Feb 25 06:34:24 2021 -0800

    Fix Yoga test

    Summary: Changelog: [Internal][Yoga] Fixed unit test for default yoga style property

    Reviewed By: pasqualeanatriello

    Differential Revision: D26664040

    fbshipit-source-id: 9c0af4e846ead3d90c75753e836570ccac760178

commit de36e85
Author: Aditya Sharat <adityasharat@fb.com>
Date:   Tue Feb 16 10:17:36 2021 -0800

    Adds InternalNode#freeze() API

    Summary:
    Litho needs a new API which is called immediately before yoga begins layout calculations so that the InternalNode gets the opportunity to finalise itself; i.e. perform the last mutations and in effect avoid any more mutations to the hierarchy.

    See D26373731 where the mutations from `Layout#collectResults` is moved back into the InternalNode.

    Changelog: [Internal]  Adds new API to YogaNodeJNIBase

    Reviewed By: SidharthGuglani

    Differential Revision: D26373730

    fbshipit-source-id: 471346d3444986ada91e86c95f5f9fb98bcd2fa6

commit 651c527
Author: Ruslan Serebriakov <rsrbk@fb.com>
Date:   Thu Feb 11 10:37:41 2021 -0800

    CKDimension

    Summary:
    [rsrbk@devvm3461.lla0 /data/users/rsrbk/fbsource/fbobjc] fastmod --accept-all CKRelativeDimension RCRelativeDimension
    [rsrbk@devvm3461.lla0 /data/users/rsrbk/fbsource/fbobjc] fastmod --accept-all CKRelativeSize RCRelativeSize
    [rsrbk@devvm3461.lla0 /data/users/rsrbk/fbsource/fbobjc] fastmod --accept-all ComponentKit/RCDimension.h RenderCore/RCDimension.h

    Reviewed By: kfirapps

    Differential Revision: D26228615

    fbshipit-source-id: 9c06128b324e1c6ece6fc21fbab1c041e5f5825a

commit 2cb46cf
Author: Sidharth Guglani <sidharthguglani@fb.com>
Date:   Fri Feb 5 03:39:55 2021 -0800

    instance of checks for YogaNodeJniBase

    Summary:
    Changelog:
    [Internal][Yoga] - Added instance of checks in `YogaNodeJNIBase` class to prevent `ClassCastException`s. This was happening for some NT android tests - Mocked Yoga Node object was being passed in the `addChildAt` api

    Stack Trace of exception
        java.lang.ClassCastException: com.facebook.yoga.YogaNode$MockitoMock$1408896622 cannot be cast to com.facebook.yoga.YogaNodeJNIBase
    	at com.facebook.yoga.YogaNodeJNIBase.addChildAt(YogaNodeJNIBase.java:86)
    	at com.facebook.litho.DefaultInternalNode.addChildAt(DefaultInternalNode.java:220)
    	at com.facebook.litho.DefaultInternalNode.child(DefaultInternalNode.java:377)
    	at com.facebook.litho.DefaultInternalNode.child(DefaultInternalNode.java:360)
    	at com.facebook.litho.Column.resolve(Column.java:118)
    	at com.facebook.litho.Layout.create(Layout.java:172)

    Reviewed By: Andrey-Mishanin

    Differential Revision: D26114992

    fbshipit-source-id: 774a689609e67f9244b81c6788b62cd61cd96d14

commit 584dfe9
Author: Andres Suarez <asuarez@fb.com>
Date:   Sun Jan 10 10:03:53 2021 -0800

    Apply clang-format update fixes

    Reviewed By: igorsugak

    Differential Revision: D25861849

    fbshipit-source-id: 840dc1061e557717c7f9ffcccbc09c24b96b78e0

commit a38ec3d
Author: Panagiotis Vekris <pvekris@fb.com>
Date:   Mon Jan 4 21:05:07 2021 -0800

    pin "classic" roots to v0.140

    Summary:
    In Flow v0.143 types-first will become the only supported mode in Flow.
    As such the `types_first` configuration option will become invalid. To
    prevent breaking roots that have `types_first=false` set and are **unversioned**,
    this diff pins their version to v0.140, which is the last released version in fbsource.

    ## Repro

    First compute the list of all `.flowconfig`s:
    ```
    zbgf '.flowconfig$' | grep -v '^fbsource/fbcode/flow' | grep -v 'Binary file' | awk -F':' '{ print $1 }' | sort -u > all-flowconfigs.txt
    ```
    Compute `.flowconfig`s that don’t have a version:
    ```
    zbgs -f '\.flowconfig' '[version]' |  grep -v '^fbsource/fbcode/flow'  | grep -v 'Binary file' | awk -F':' '{ print $1 }' | sort -u > versioned-flowconfigs.txt
    comm -23 all-flowconfigs.txt versioned-flowconfigs.txt > unversioned-flowconfigs.txt
    ```
    Compute `.flowconfig`s that have `types_first=false`:
    ```
    zbgr -f '\.flowconfig' '^types_first=false$' |  grep -v '^fbsource/fbcode/flow'  | grep -v 'Binary file' | awk -F':' '{ print $1 }' | sort -u > types_first-false-flowconfigs.txt
    ```
    **and** no pinned version:
    ```
    comm -12 unversioned-flowconfigs.txt types_first-false-flowconfigs.txt | grep 'fbsource' > pin-version-flowconfigs.txt
    ```
    Update the `.flowconfig`s:
    ```
    cat ~/scratch/flowconfigs/pin-version-flowconfigs-fbsource.txt | xargs -I{} bash -c 'printf "\n[version]\n^0.140.0\n" >> {}'
    ```

    Reviewed By: mroch

    Differential Revision: D25771452

    fbshipit-source-id: 876d6310e4e1aafb81d3ef3051f4e9e9e838a633

commit b043669
Author: Ron Edelstein <rone@fb.com>
Date:   Thu Dec 17 19:33:39 2020 -0800

    Explicitly set autoglob (long tail)

    Reviewed By: fbanurag, strulovich

    Differential Revision: D25620908

    fbshipit-source-id: 1dd737d451ddfd07baa427902bdf1c96d7e67e64

commit e65b1ef
Author: Kris Georges <krisg@fb.com>
Date:   Tue Nov 10 08:21:19 2020 -0800

    Fix Yoga Playground website Litho codegen bugs

    Summary:
    Yoga Playground website

    changing direction results in no change to Litho code because of this typo

    Reviewed By: SidharthGuglani

    Differential Revision: D24818769

    fbshipit-source-id: 1633513d4a25aead2008b59d52f669293214c598

commit 07eac0c
Author: Pasquale Anatriello <pasqualea@fb.com>
Date:   Thu Oct 29 09:23:02 2020 -0700

    Fix clone issue in YogaNodeJNIBase

    Summary:
    Changelog:
    Fix the cloneWithChildren implementation that was not copying the list of children on the java object.

    We were missing on copying the list of children when cloning. This is pretty bad as it means that the clone operation was mutating the old node as well as the new. When multiple threads were involved this could cause crashes.

    Reviewed By: SidharthGuglani

    Differential Revision: D24565307

    fbshipit-source-id: 4e2e111db389e25c315ce7603b4018ac695bb0f1

commit 64e2459
Author: simek <gosimek@gmail.com>
Date:   Mon Sep 28 21:24:45 2020 -0700

    remove most of tvOS remnants from the code (#29407)

    Summary:
    Refs: [0.62 release](https://reactnative.dev/blog/#moving-apple-tv-to-react-native-tvos), facebook/react-native#28706, facebook/react-native#28743, facebook/react-native#29018

    This PR removes most of the tvOS remnants in the code. Most of the changes are related to the tvOS platform removal from `.podspec` files, tvOS specific conditionals removal (Obj-C + JS) or tvOS CI/testing pipeline related code.

    In addition to the changes listed above I have removed the deprecated `Platform.isTVOS` method. I'm not sure how `Platform.isTV` method is correlated with Android TV devices support which is technically not deprecated in the core so I left this method untouched for now.

    ## Changelog

    <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
    https://github.com/facebook/react-native/wiki/Changelog
    -->

    * **[Internal] [Removed]** - remove most of tvOS remnants from the code:
      * `TVEventHandler`, `TVTouchable`, `RCTTVView`, `RCTTVRemoteHandler` and `RCTTVNavigationEventEmitter`
    * **[Internal] [Removed]** - remove `TARGET_TV_OS` flag and all the usages
    * **[iOS] [Removed]** - remove deprecated `Platform.isTVOS` method
    * **[iOS] [Removed]** - remove deprecated and TV related props from View:
      * `isTVSelectable`, `hasTVPreferredFocus` and `tvParallaxProperties`
    * **[iOS] [Removed]** - remove `BackHandler` utility implementation

    Pull Request resolved: facebook/react-native#29407

    Test Plan: Local tests (and iOS CI run) do not yield any errors, but I'm not sure how the CI pipeline would react to those changes. That is the reason why this PR is being posted as Draft. Some tweaks and code adjustment could be required.

    Reviewed By: PeteTheHeat

    Differential Revision: D22619441

    Pulled By: shergin

    fbshipit-source-id: 9aaf3840c5e8bd469c2cfcfa7c5b441ef71b30b6
zcbenz pushed a commit to yue/yoga that referenced this issue Aug 14, 2021
…#1068)

Summary:
Pull Request resolved: facebook/yoga#1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
facebook/react-native#18415
microsoft/react-native-windows#7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
grahammendick added a commit to grahammendick/navigation that referenced this issue Nov 3, 2021
Was freezing immediately on the javascript side, as soon as the navigation happened. This worked but think only because of React Native bug with display none not working if position absolute, facebook/react-native#18415. When suspended React Native sets display none on the scene, so it should be hidden during the animation - but it wasn't because of this bug. Can see there's a Yoga fix for it so can't leave it like this. Instead have to wait for the animation to complete before freezing. Wanted to avoid this because it's harder but it's the right thing to do. Also gives the unloading and unloaded time to do a setState because should fire fast enough, before animation completes.
Navigate A --> B --> C so that A and B are frozen. When navigating back to B the freeze is disabled during the navigation - but interestingly A stays frozen! Was surprised but think that's because the shouldComponentUpdate returns false - the old way of preventing a setState!! so it correctly doesn't unfreeze!! Nice that the old setState prevention comes into play for the new freeze way during the animation!!
Only fired the onRest for the entering scene. Even in odd case where leaving animation is longer than entering, as soon as entering completes it's ok to hide the leaving because can't see it anymore.
Called it onRest to match the NavigationMotion - it also tracks the animation complete, also only on the mounted/entered scene.
grahammendick added a commit to grahammendick/navigation that referenced this issue Nov 6, 2021
Navigate A --> B --> C then A and B are both frozen. Then press back on iOS twice quickly and screen A will be black because the scene is hidden. When scenes are frozen/suspended then React Native hides them by setting display to none. Pressing back fast to A will unsuspend A in javascript but not immediately - the navigation has to happen in javascript with a setState etc. In the meantime A is shown and it's still hidden!!
Tried so many ways around this and almost ran out of options. One thing that did work was to override setHidden on SceneView and ignore true value. But this is taking advantage of a Yoga bug where display none doesn't work properly with position absolute facebook/react-native#18415 - can see that it's been fixed in Yoga and then overriding setHidden won't work because the frame of the children is set to 0 (I think?!). Tried it without position absolute and it didn't work.
So have to stop React Native setting display to none, https://github.com/facebook/react-native/blob/1465c8f3874cdee8c325ab4a4916fda0b3e43bdb/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js#L5480. Only way I found is to make display an invalid style attribute. That way the display none is ignored!!! Got lucky with but think it's robust enough to merge. Think when fabric lands the valid attributes will get overhaul - might make it easier to define own list of valid attributes?! but might break this workaround. Who knows?!
Tested this doesn't break display attribute for other non-Scene components
elddc added a commit to elddc/nchapp that referenced this issue Dec 10, 2021
Fixed bug where option list screen was always visible; this problem was caused by using position: absolute and display: none, which React Native does not like (see facebook/react-native#18415)

Added solid black background to header in OptionList, preventing overlay with list items
@github-actions
Copy link

github-actions bot commented Mar 2, 2023

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.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 2, 2023
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as completed Mar 9, 2023
@facebook facebook locked as resolved and limited conversation to collaborators Mar 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Platform: Android Android applications. Ran Commands One of our bots successfully processed a command. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests