Skip to content

Commit

Permalink
fix: 🐛 fixed hack to use __rb_createdInstance on createPortal in rend…
Browse files Browse the repository at this point in the history
…er.ts and in storybook. portal is now outside of transformnode -> box is moved from outside into node
  • Loading branch information
dennemark authored and brianzinn committed Oct 26, 2021
1 parent ed83c48 commit 1feee2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function createPortal(children: React.ReactNode, containerInfo: any, key?
target = containerInfo.__rb_createdInstance;
}

return reconciler.createPortal(children, containerInfo, null, key);
return reconciler.createPortal(children, target, null, key);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions storybook/stories/babylonjs/Basic/portal.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ function WithCreatePortal() {

return (
<>
<transformNode name="transform-node" ref={transformNodeRef}>
{(transformNodeRef.current) &&
{(transformNodeRef.current) &&
createPortal(<box position={new Vector3(0, 1, 0)}>
<standardMaterial diffuseColor={Color3.Blue() } specularColor={Color3.Black()} />
</box>, transformNodeRef.current['__rb_createdInstance'])
</box>, transformNodeRef.current)
}
<transformNode name="transform-node" ref={transformNodeRef}>
<ground name='ground1' width={6} height={6} subdivisions={2} position={new Vector3(0, 0, 0)} />
</transformNode>
</>
Expand Down

0 comments on commit 1feee2f

Please sign in to comment.