Skip to content

Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) #52349

Open

Description

@basitmir

Description

  • There is some sort of crash when ui is rendered

Steps to reproduce

  • Use conditional rendering for view to display ui based on condition (not sure though what is causing this)
    Note: it is working fine on 0.77 though once upgraded then facing this issue
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { t } from '../i18n';
import { ProgressBar } from '@ui-kitten/components';
import { TPhoto } from '../types';
import { Colors } from '../theme';
import AppLightButton from './AppLightButton';
import Upload from '../theme/icons/Upload.svg';
import AppText from './AppText';

type Props = {
    image: TPhoto;
    retryUpload: boolean;
    onRetryUpload: (image: TPhoto) => void;
    currentImageIndex: number;
    totalImages: number;
};

const ImageUploadProgress = ({ image, retryUpload, totalImages, currentImageIndex, onRetryUpload }: Props) => {
    return (
        <View style={styles.photoUpload}>
            <View style={styles.uploadTitle}>
                <AppText style={styles.uploadTitleText}>
                    {t('common._uploading-images', {
                        count: currentImageIndex,
                        total: totalImages,
                    })}
                </AppText>
                {image.uploadStatus === 'completed' ? (
                    <AppText style={styles.uploadTitleTextComplete}> - {t('common.complete')} </AppText>
                ) : (
                    <View />
                )}
                {image.uploadStatus === 'failed' || image.uploadStatus === 'uploading' ? (
                    <View>
                        <AppText style={styles.uploadTitleTextFailed}>
                            {image.uploadStatus === 'failed' ? `- ${t('common.failed')}` : ''}
                        </AppText>
                        {retryUpload && (
                            <AppLightButton
                                text={t('common.retry')}
                                buttonIcon={<Upload width={10} fill={Colors.warn} />}
                                onPress={() => onRetryUpload(image)}
                                style={styles.stepButton}
                                textStyle={styles.stepButtonText}
                            />
                        )}
                    </View>
                ) : (
                    <View />
                )}
            </View>
            <ProgressBar
                progress={image.uploadStatus === 'completed' ? 1 : image.progress}
                size="medium"
                style={styles.progressBarStyle}
                status={
                    image.uploadStatus === 'failed' ? 'danger' : image.uploadStatus === 'completed' ? 'success' : 'info'
                }
            />
        </View>
    );
};

export default ImageUploadProgress;

const styles = StyleSheet.create({
    photoUpload: { marginVertical: 20 },
    uploadTitle: { flexDirection: 'row', justifyContent: 'space-between' },
    uploadTitleText: {
        fontSize: 14,
        fontFamily: 'ProximaNova-Regular',
        textAlign: 'center',
        textAlignVertical: 'center',
    },
    uploadTitleTextFailed: {
        fontSize: 14,
        fontFamily: 'ProximaNova-Bold',
        textAlign: 'center',
        textAlignVertical: 'center',
        color: Colors.error,
    },
    uploadTitleTextComplete: {
        fontSize: 14,
        fontFamily: 'ProximaNova-Bold',
        textAlign: 'center',
        textAlignVertical: 'center',
        color: Colors.success,
    },
    progressBarStyle: {
        marginTop: 5,
    },
    stepButton: {
        height: 25,
        width: 70,
        backgroundColor: Colors.orangeTransparent,
        borderColor: Colors.warn,
    },
    stepButtonText: { fontSize: 10, fontFamily: 'ProximaNova-Bold', height: 10, color: Colors.warn },
});

React Native Version

0.79.4

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

- There is no output. The app closes without any error

Stacktrace or Logs

/__w/react-native/react-native/packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp:701: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_)

MANDATORY Reproducer

https://github.com/facebook/react-native

Screenshots and Videos

  • The app crashes abruptly no warning nothing. Log found in android studio

Image

Activity

  1. react-native-bot commented on Jul 1, 2025

    @react-native-bot
    Collaborator

    Warning

    Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:


    You can read more about about it on our website: How to report a bug.

  2. changed the title [-]function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_)[/-] [+]Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_)[/+] on Jul 1, 2025
  3. mahendihasan-impactguru commented on Jul 1, 2025

    @mahendihasan-impactguru

    Use optional changing to avoid crashes

  4. devanshsaini11 commented on Jul 1, 2025

    @devanshsaini11
    Collaborator

    @basitmir Can u kindly provide a valid repro using Reproducer Template

  5. basitmir commented on Jul 1, 2025

    @basitmir
    Author

    Use optional changing to avoid crashes

    Already tried that as well

  6. rohit9625 commented on Jul 4, 2025

    @rohit9625

    I am also encountering the same error. Not sure what is reason is but it is happening after upgrading RN version.

  7. rohit9625 commented on Jul 4, 2025

    @rohit9625

    Hi @mahendihasan-impactguru
    Could you please tell what is optional changing and how it can be implemented in the above example?

  8. mahendihasan-impactguru commented on Jul 4, 2025

    @mahendihasan-impactguru

    Hi @mahendihasan-impactguru Could you please tell what is optional changing and how it can be implemented in the above example?

    @rohit9625 for above code i saw the missing image.uploadStatus optional changing that’s why i suggested optional chaining.....

  9. mahendihasan-impactguru commented on Jul 4, 2025

    @mahendihasan-impactguru

    @basitmir @rohit9625 i have suggest could you please remove and add null code.
    Yoga is attempting to lay out, even though they are visually meaningless — this can lead to layout issues in newer versions of RN especially after v0.71+ where layout constraints and shadow node validation became stricter.
    if you want sample code just know me...

  10. 36 remaining items

  11. tomaszukovskij commented on Oct 3, 2025

    @tomaszukovskij

    But display: contents IS supported by React Native, since 0.77.

    I know. But in my case where this style was set, app was crashing because of
    Assertion failed: (YGNodeGetOwner(childYogaNode) == &yogaNode_), function layout, file YogaLayoutableShadowNode.cpp, line 699. > layout > YGNodeGetOwner(childYogaNode) == &yogaNode_ > YogaLayoutableShadowNode.cpp

  12. DzmitryITGlue commented on Oct 28, 2025

    @DzmitryITGlue

    After upgrade to 0.81.5 I have this issue on Android occurs much more frequently, just for context, I have no display: 'none' styles

  13. TwanLuttik commented on Nov 17, 2025

    @TwanLuttik

    I have been experiencing the same xcode error and it only seems to be happening in debug mode, production seemed to be safe. My app is multi tenant and I was noticing this crash was very persistent and after searching a while on this GH issue, the display: 'none' was effecting it and did help in fact since one of my buttons was like that and i noticed quickly the issue might be have resolved this. I keep an eye to see if this is the solution but I'm happy to finally somewhat figured it out.

  14. allessandrogomes commented on Dec 31, 2025

    @allessandrogomes

    The same thing was happening to me, crashing the app when opening the screen that contained this condition in the 'display'. Removing it from the stylesheet and adding it as a rendering condition in the tsx file solved the problem.
    Image

  15. Nader-CS commented on Jan 26, 2026

    @Nader-CS

    yes this problem still exist for some devices

  16. Kalightortaio commented on Jan 26, 2026

    @Kalightortaio

    Still having this issue.

    EDIT: Fixed it by removing display: 'none' from my code.

    cardOutline: { ... display: selectedCard === -1 || !selectedCardLayout ? 'none' : 'flex', },

    into

    {selectedCard !== -1 && selectedCardLayout && ( <View pointerEvents="none" style={hookStyles.cardOutline} /> )}

  17. oserrabassa-jcm commented on May 21, 2026

    @oserrabassa-jcm

    Also experienced this issue after upgrading to React Native 0.85.3.
    As the majority has said, not using display: none fixes the issue.

  18. 5ZYSZ3K commented on Jun 13, 2026

    @5ZYSZ3K
    Contributor

    I have an excellent reproduction repo for that:
    https://github.com/5ZYSZ3K/native-tabs-crash-repro
    It's called native-tabs, because it first occured for me after switching to expo-router/unstable-native-tabs in my expo app
    I'll open a PR in a second, I have a fix for that - I'm not 100% sure that it is fully correct, but maybe someone will have time to take a look at this issue

  19. ketosense commented on Aug 30, 2026

    @ketosense

    We hit this crash repeatedly in production (React Native, Fabric) and confirmed the exact trigger mechanism, matching the analysis already in this thread.

    Our case: a small checkmark/badge component toggled style={{ display: visible ? 'flex' : 'none' }} next to a form field. Toggling a sibling control's props (editable/hint state) immediately followed by an unrelated re-render (a background sync cascade) reliably crashed with the exact YogaLayoutableShadowNode.cpp assertion — matching the documented resize-commit-then-props-commit sequence.

    We initially fixed two different component-type-swap bugs elsewhere in the same screen (also real bugs, also worth avoiding) but the crash persisted through both — it was specifically the display:'none' toggle that was the trigger, not the other issues.

    Workaround that fully resolved it for us, verified via repeated on-device repro testing after two prior fix attempts failed: never toggle display. Instead keep the element permanently mounted with position: 'absolute' (removes it from Yoga's flex/gap layout entirely, same effect display:'none' was used for) and animate only opacity. No native rebuild needed, pure JS/style change.

    Hope this saves someone else the debugging time — happy to share more repro detail if useful for a fix upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions