mirror of
https://github.com/zhigang1992/react-native-reanimated.git
synced 2026-04-30 21:32:03 +08:00
Fix #30
This commit is contained in:
@@ -2,8 +2,6 @@ import ReanimatedModule from '../ReanimatedModule';
|
|||||||
|
|
||||||
const UPDATED_NODES = [];
|
const UPDATED_NODES = [];
|
||||||
|
|
||||||
const INITIALIZED_NODES = new Set();
|
|
||||||
|
|
||||||
let loopID = 1;
|
let loopID = 1;
|
||||||
let propUpdatesEnqueued = null;
|
let propUpdatesEnqueued = null;
|
||||||
|
|
||||||
@@ -46,6 +44,7 @@ export default class AnimatedNode {
|
|||||||
constructor(nodeConfig, inputNodes) {
|
constructor(nodeConfig, inputNodes) {
|
||||||
this.__nodeID = ++nodeCount;
|
this.__nodeID = ++nodeCount;
|
||||||
this.__nodeConfig = sanitizeConfig(nodeConfig);
|
this.__nodeConfig = sanitizeConfig(nodeConfig);
|
||||||
|
this.__initialized = false;
|
||||||
this.__inputNodes =
|
this.__inputNodes =
|
||||||
inputNodes && inputNodes.filter(node => node instanceof AnimatedNode);
|
inputNodes && inputNodes.filter(node => node instanceof AnimatedNode);
|
||||||
}
|
}
|
||||||
@@ -93,16 +92,16 @@ export default class AnimatedNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
__nativeInitialize() {
|
__nativeInitialize() {
|
||||||
if (!INITIALIZED_NODES.has(this.__nodeID)) {
|
if (!this.__initialized) {
|
||||||
ReanimatedModule.createNode(this.__nodeID, this.__nodeConfig);
|
ReanimatedModule.createNode(this.__nodeID, { ...this.__nodeConfig });
|
||||||
INITIALIZED_NODES.add(this.__nodeID);
|
this.__initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__nativeTearDown() {
|
__nativeTearDown() {
|
||||||
if (INITIALIZED_NODES.has(this.__nodeID)) {
|
if (this.__initialized) {
|
||||||
ReanimatedModule.dropNode(this.__nodeID);
|
ReanimatedModule.dropNode(this.__nodeID);
|
||||||
INITIALIZED_NODES.delete(this.__nodeID);
|
this.__initialized = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user