Use types.boolean() for booleans in r3f

This commit is contained in:
Aria Minaei 2021-07-02 20:47:54 +02:00
parent 001c50c13d
commit 160448ec29
3 changed files with 4 additions and 4 deletions

View file

@ -73,7 +73,7 @@ const Editor: VFC = () => {
shallow, shallow,
) )
const editorOpen = !!useVal(editorObject?.props._isOpen) const editorOpen = useVal(editorObject?.props.isOpen)
useLayoutEffect(() => { useLayoutEffect(() => {
if (editorOpen) { if (editorOpen) {
createSnapshot() createSnapshot()
@ -120,7 +120,7 @@ const Editor: VFC = () => {
className="fixed bottom-5 left-5" className="fixed bottom-5 left-5"
onClick={() => { onClick={() => {
studio.transaction(({set}) => { studio.transaction(({set}) => {
set(editorObject.props._isOpen, 1) set(editorObject.props.isOpen, true)
}) })
}} }}
> >

View file

@ -139,7 +139,7 @@ const UI: VFC = () => {
className="absolute left-0 bottom-0 pointer-events-auto" className="absolute left-0 bottom-0 pointer-events-auto"
onClick={() => onClick={() =>
studio.transaction(({set}) => { studio.transaction(({set}) => {
set(editorObject.props._isOpen, 0) set(editorObject.props.isOpen, false)
}) })
} }
> >

View file

@ -366,7 +366,7 @@ export type BindFunction = (options: {
const editorSheetObjectConfig = { const editorSheetObjectConfig = {
props: types.compound({ props: types.compound({
_isOpen: types.number(0), isOpen: types.boolean(false),
}), }),
} }