Commit 3efbab54 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

Add setNativeProps method

Usage: setNativeProps({data}) more efficiently for animation purpose
parent 849713f5
...@@ -30,7 +30,11 @@ class GLCanvas extends Component { ...@@ -30,7 +30,11 @@ class GLCanvas extends Component {
this._pendingCaptureFrame = null; this._pendingCaptureFrame = null;
} }
addPendingCaptureFrame (config) { setNativeProps (props) {
this.refs.native.setNativeProps(props);
}
_addPendingCaptureFrame (config) {
const key = serializeOption(config); const key = serializeOption(config);
return this._pendingCaptureFrame[key] || ( return this._pendingCaptureFrame[key] || (
(captureFrame(React.findNodeHandle(this.refs.native), config), (captureFrame(React.findNodeHandle(this.refs.native), config),
...@@ -77,7 +81,7 @@ class GLCanvas extends Component { ...@@ -77,7 +81,7 @@ class GLCanvas extends Component {
invariant(keys.length === nb, "captureFrame(config): config must be an object with {format, type, quality, filePath}, found some invalid keys in '%s'", keys); invariant(keys.length === nb, "captureFrame(config): config must be an object with {format, type, quality, filePath}, found some invalid keys in '%s'", keys);
config = configArg; config = configArg;
} }
return this.addPendingCaptureFrame({ return this._addPendingCaptureFrame({
format: "base64", format: "base64",
type: "png", type: "png",
quality: 1, quality: 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment