Skip to content

Commit

Permalink
[ReactNative] Fix some mount callback issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sahrens committed May 15, 2015
1 parent 2497c02 commit 4771806
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 24 deletions.
14 changes: 13 additions & 1 deletion Libraries/ReactIOS/NativeMethodsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var findNodeHandle = require('findNodeHandle');
var flattenStyle = require('flattenStyle');
var invariant = require('invariant');
var mergeFast = require('mergeFast');
var mountSafeCallback = require('mountSafeCallback');
var precomputeStyle = require('precomputeStyle');

type MeasureOnSuccessCallback = (
Expand Down Expand Up @@ -161,4 +160,17 @@ if (__DEV__) {
};
}

/**
* In the future, we should cleanup callbacks by cancelling them instead of
* using this.
*/
var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any {
return function() {
if (!callback || (context.isMounted && !context.isMounted())) {
return;
}
return callback.apply(context, arguments);
};
};

module.exports = NativeMethodsMixin;
23 changes: 0 additions & 23 deletions Libraries/Utilities/mountSafeCallback.js

This file was deleted.

0 comments on commit 4771806

Please sign in to comment.