Fix destruction
Some checks failed
Lint / lint (push) Failing after 8s

This commit is contained in:
Julien Valverdé
2026-01-02 00:06:41 +01:00
parent fae11b2024
commit 78c3051342
3 changed files with 39 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
import { Control } from "godot"
import { Renderer } from "react-godot-renderer"
import { TestUi2Component } from "./TestUi2Component"
export default class TestUi2 extends Control {
// Called when the node enters the scene tree for the first time.
_ready(): void {
Renderer.renderComponent(this, TestUi2Component)
}
}

View File

@@ -0,0 +1,33 @@
import Godot from "godot"
import { useState } from "react"
import { Component } from "react-godot-renderer"
const HFlowContainer = Component.make(Godot.HFlowContainer)
const VFlowContainer = Component.make(Godot.VFlowContainer)
const Label = Component.make(Godot.Label)
const CheckBox = Component.make(Godot.CheckBox)
export function TestUi2Component() {
const [show, setShow] = useState(false)
const checkBoxRef = CheckBox.useRef()
Component.useSignal(checkBoxRef, "toggled", setShow)
return (
<VFlowContainer>
<HFlowContainer>
<Label text="Show" />
<CheckBox
ref={checkBoxRef}
button_pressed={show}
/>
</HFlowContainer>
{show &&
<Label text="Shown" />
}
</VFlowContainer>
)
}

View File

@@ -160,9 +160,9 @@ export const make = () => {
// getInstanceFromScope(_scopeInstance) {
// throw new Error("Function not implemented.")
// },
// detachDeletedInstance(_node) {
// throw new Error("Function not implemented.")
// },
detachDeletedInstance(node) {
node.queue_free()
},
// supportsHydration: false,
// NotPendingTransition: undefined,