Skip to content

Crash: removedChildren count (0) was not what we expected (56) #258

@SudoPlz

Description

@SudoPlz

I get the error above which results in a crash.

This error happens when I try to remove the view that contains lot's of lines rendered like so:

const linesArray = [];
for (let i = 0, lineCnt = Math.ceil(realLineCnt); i <= lineCnt; i += 1) {
    // top left pivot
    linesArray.push(
      <Line
        key={i}
        x1={i * (props.strokeWidth * 2.83333333)}
        y1={-5}

        x2={(i * (props.strokeWidth * 2.83333333)) - ((props.width * props.height) / props.width)}
        y2={props.height + 5}

        stroke={props.strokeColor}
        strokeWidth={props.strokeWidth}
      />);
  }

which are later rendered like so:

<SvgRender
        height={props.height}
        width={props.width}
        style={styles.svgContainer}
      >
        {linesArray}
 </SvgRender>

I see the error in a react-native red box, but the error originates from this react-native line of code.

I assume that the number 56 is the number of my lines.
Could it be that react-native-svg makes it hard for react-native to remove it's children and deallocate their memory?

Please advise!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions