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

requestAnimationFrame error when testing #163

Closed
matthova opened this issue Apr 8, 2017 · 2 comments
Closed

requestAnimationFrame error when testing #163

matthova opened this issue Apr 8, 2017 · 2 comments
Labels

Comments

@matthova
Copy link

matthova commented Apr 8, 2017

When used with create-react-app, requestAnimationFrame throws an error.

Note basic coverage test "it('renders without crashing')" will fail as of react-three-renderer v3.1.0.
Proposed solution is to wrap 'react-three-renderer/lib/React3Instance.js' line 262 in the following code:

if (typeof requestAnimationFrame === 'function') {
  this._renderRequest = requestAnimationFrame(this._render); // Line 262
}

Note, this might not be the right solution, but it did make the errors go away. @toxicFork would love to get your take on the error.

Here are the steps to recreate the error:

git clone https://github.com/matthova/React-threeJS-UI-boilerplate.git
cd React-threeJS-UI-boilerplate/
npm install
npm test
@toxicFork
Copy link
Collaborator

Thanks for the report :) I'm guessing the test fails because it doesn't use a browser with a 3d context... but it would make sense to suppress this anyway, or at least use a shim for RAF.

@toxicFork toxicFork added the bug label Apr 15, 2017
@toxicFork
Copy link
Collaborator

toxicFork commented Apr 15, 2017

Linking #164 to it to which I have added some more comments :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants