mountSafeCallback_NOT_REALLY_SAFE() — react Function Reference
Architecture documentation for the mountSafeCallback_NOT_REALLY_SAFE() function in NativeMethodsMixinUtils.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD dc587c00_336f_7aab_76ee_641b333ed07b["mountSafeCallback_NOT_REALLY_SAFE()"] 78f5be05_fc7e_f09a_e92e_c046356e87a8["NativeMethodsMixinUtils.js"] dc587c00_336f_7aab_76ee_641b333ed07b -->|defined in| 78f5be05_fc7e_f09a_e92e_c046356e87a8 926818d2_2d01_f8c8_6db6_bf1fb80cc370["measure()"] 926818d2_2d01_f8c8_6db6_bf1fb80cc370 -->|calls| dc587c00_336f_7aab_76ee_641b333ed07b d1b3a229_331f_e55a_657f_3c6151c38db4["measureInWindow()"] d1b3a229_331f_e55a_657f_3c6151c38db4 -->|calls| dc587c00_336f_7aab_76ee_641b333ed07b style dc587c00_336f_7aab_76ee_641b333ed07b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-native-renderer/src/NativeMethodsMixinUtils.js lines 14–46
export function mountSafeCallback_NOT_REALLY_SAFE(
context: any,
callback: ?Function,
): any {
return function () {
if (!callback) {
return undefined;
}
// This protects against createClass() components.
// We don't know if there is code depending on it.
// We intentionally don't use isMounted() because even accessing
// isMounted property on a React ES6 class will trigger a warning.
if (typeof context.__isMounted === 'boolean') {
if (!context.__isMounted) {
return undefined;
}
}
// FIXME: there used to be other branches that protected
// against unmounted host components. But RN host components don't
// define isMounted() anymore, so those checks didn't do anything.
// They caused false positive warning noise so we removed them:
// https://github.com/facebook/react-native/issues/18868#issuecomment-413579095
// However, this means that the callback is NOT guaranteed to be safe
// for host components. The solution we should implement is to make
// UIManager.measure() and similar calls truly cancelable. Then we
// can change our own code calling them to cancel when something unmounts.
return callback.apply(context, arguments);
};
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does mountSafeCallback_NOT_REALLY_SAFE() do?
mountSafeCallback_NOT_REALLY_SAFE() is a function in the react codebase, defined in packages/react-native-renderer/src/NativeMethodsMixinUtils.js.
Where is mountSafeCallback_NOT_REALLY_SAFE() defined?
mountSafeCallback_NOT_REALLY_SAFE() is defined in packages/react-native-renderer/src/NativeMethodsMixinUtils.js at line 14.
What calls mountSafeCallback_NOT_REALLY_SAFE()?
mountSafeCallback_NOT_REALLY_SAFE() is called by 2 function(s): measure, measureInWindow.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free