Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Mar 9, 2023
1 parent 1520a62 commit e33795e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 26 deletions.
36 changes: 15 additions & 21 deletions demo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render } from 'preact'
import { useState, useEffect } from 'react'
import { usePlane, useBox, Physics } from '@react-three/cannon'
import { OrbitControls } from '@react-three/drei'
import { Canvas } from '@react-three/fiber'
Expand All @@ -24,23 +23,18 @@ function Cube(props) {
)
}

function App() {
const [ready, set] = useState(false)
useEffect(() => void setTimeout(() => set(true), 1000), [])
return (
<Canvas shadows camera={{ fov: 50, position: [-5, 5, 5] }}>
<ambientLight />
<spotLight castShadow angle={0.25} penumbra={0.5} position={[10, 10, 5]} />
<OrbitControls />
<Physics>
<Plane />
<Cube position={[0, 5, 0]} />
<Cube position={[0.45, 7, -0.25]} />
<Cube position={[-0.45, 9, 0.25]} />
{ready && <Cube position={[-0.45, 10, 0.25]} />}
</Physics>
</Canvas>
)
}

render(<App />, root)
render(
<Canvas shadows camera={{ fov: 50, position: [-5, 5, 5] }}>
<ambientLight />
<spotLight castShadow angle={0.25} penumbra={0.5} position={[10, 10, 5]} />
<OrbitControls />
<Physics>
<Plane />
<Cube position={[0, 5, 0]} />
<Cube position={[0.45, 7, -0.25]} />
<Cube position={[-0.45, 9, 0.25]} />
<Cube position={[-0.45, 16, 0.25]} />
</Physics>
</Canvas>,
root,
)
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ class FiberNode extends HTMLElement {
} else {
// Cleanup overrides
this.ownerSVGElement = null
// @ts-ignore
fiber.type = typeof IS_REACT_ACT_ENVIRONMENT === 'undefined' ? fiber.__type : 'svg'
delete fiber.props.fiber

// Create Fiber instance
Expand Down Expand Up @@ -260,9 +258,7 @@ export default (hostConfig: HostConfig): Reconciler => {
container.hostConfig = hostConfig
return container
},
updateContainer(element, container): void {
render(element, container)
},
updateContainer: render,
createPortal() {},
injectIntoDevTools() {},
}
Expand Down

0 comments on commit e33795e

Please # to comment.