From 32fdd5f05ccb5e615467832f76d97b824df5002a Mon Sep 17 00:00:00 2001 From: Miller Medeiros Date: Tue, 30 Aug 2016 15:29:50 -0700 Subject: [PATCH] Add checkpoint/rollback to ReactNativeReconcileTransaction --- .../native/ReactNativeReconcileTransaction.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/renderers/native/ReactNativeReconcileTransaction.js b/src/renderers/native/ReactNativeReconcileTransaction.js index ca2e5a0349667..de34a657b5dbf 100644 --- a/src/renderers/native/ReactNativeReconcileTransaction.js +++ b/src/renderers/native/ReactNativeReconcileTransaction.js @@ -97,6 +97,19 @@ var Mixin = { return ReactUpdateQueue; }, + /** + * Save current transaction state -- if the return value from this method is + * passed to `rollback`, the transaction will be reset to that state. + */ + checkpoint: function() { + // reactMountReady is the our only stateful wrapper + return this.reactMountReady.checkpoint(); + }, + + rollback: function(checkpoint) { + this.reactMountReady.rollback(checkpoint); + }, + /** * `PooledClass` looks for this, and will invoke this before allowing this * instance to be reused.