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

This commit is contained in:
Julien Valverdé
2026-01-01 20:18:09 +01:00
parent 45f84810b5
commit 84c83c1bef
3 changed files with 64 additions and 13 deletions

View File

@@ -1,13 +1,37 @@
import Godot from "godot"
import Godot, { Vector2 } from "godot"
import { useEffect } from "react"
import { Component } from "react-godot-renderer"
const Control = Component.make(Godot.Control)
const HFlowContainer = Component.make(Godot.HFlowContainer)
const Label = Component.make(Godot.Label)
const TextEdit = Component.make(Godot.TextEdit)
const Button = Component.make(Godot.Button)
export function TestUi1Component() {
const textEditRef = TextEdit.useUnsafeRef()
const buttonRef = Button.useUnsafeRef()
useEffect(() => {
const onTextChanged = Godot.Callable.create(() => {
console.log(textEditRef.current.text)
})
textEditRef.current.text_changed.connect(onTextChanged)
return () => { textEditRef.current.text_changed.disconnect(onTextChanged) }
}, [textEditRef.current])
useEffect(() => {
const onPressed = Godot.Callable.create(() => {
console.log("Pressed!")
})
buttonRef.current.pressed.connect(onPressed)
return () => { buttonRef.current.pressed.disconnect(onPressed) }
}, [buttonRef.current])
return (
<Control
<HFlowContainer
name="Root"
anchor_left={0}
anchor_top={0}
@@ -19,7 +43,18 @@ export function TestUi1Component() {
text="This is a label"
/>
<Control name="Control" />
</Control>
<TextEdit
ref={textEditRef}
name="TextEdit"
text=""
custom_minimum_size={new Vector2(200, 35)}
/>
<Button
ref={buttonRef}
name="Button"
text="Ok"
/>
</HFlowContainer>
)
}