Skip to content
This repository was archived by the owner on Jul 20, 2020. It is now read-only.
This repository was archived by the owner on Jul 20, 2020. It is now read-only.

using Viewport onBeforeRender prop produces warning #224

@Danathus

Description

@Danathus

When using @AndrewRayCode 's technique described in #43 (comment) re: using two <viewport>s to render a secondary subscene (potentially with different cameras), and leveraging use of the Viewport's onBeforeRender member, react-three-renderer issues the following warning in the console:

warning.js?da67:33 Warning: Foreign prop onBeforeRender found in viewport. Check the render method of 'ClassWithRenderFunction'.

Note that the behavior is as expected otherwise -- the Viewports are rendered in the order listed, each using whatever camera is referenced, and each calling any specified onBeforeRender call as listed before rendering.

I believe this shouldn't be a warning, and have an idea towards the solution. I had noticed that in the react-three-renderer source, in Viewport.js, onBeforeRender is initialized from props. However, in ViewportDescriptor.js, onBeforeRender is not referenced as a property in the code. I think that by adding this property here properly can resolve this issue so use of the property is not mistakenly flagged as a warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions