Skip to content

Bug: Application does not react to width and height props #619

@EliasWatson

Description

@EliasWatson

<Application> does not update the canvas when its width or height props change.

Example

https://codesandbox.io/p/sandbox/5jts6z

import { Application } from "@pixi/react";
import { useState } from "react";

export default function App() {
  const [width, setWidth] = useState(200);
  const [height, setHeight] = useState(200);

  return (
    <div>
      <div>
        <span>Width</span>
        <input
          type="range"
          min={0}
          max={500}
          value={width}
          onChange={(e) => setWidth(Number(e.target.value))}
        />
        <span>{width}</span>
      </div>
      <div>
        <span>Height</span>
        <input
          type="range"
          min={0}
          max={500}
          value={height}
          onChange={(e) => setHeight(Number(e.target.value))}
        />
        <span>{height}</span>
      </div>
      <Application width={width} height={height}></Application>
    </div>
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions