Support style inspection in production

This commit is contained in:
Nicolas Gallagher
2018-12-10 17:01:23 -08:00
parent 85e098deec
commit 4b3f6efb21

View File

@@ -1,11 +1,9 @@
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import StyleSheet from './StyleSheet';
// allow component styles to be editable in React Dev Tools
if (process.env.NODE_ENV !== 'production') {
if (canUseDOM && window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.resolveRNStyle = StyleSheet.flatten;
}
// allow original component styles to be inspected in React Dev Tools
if (canUseDOM && window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.resolveRNStyle = StyleSheet.flatten;
}
export default StyleSheet;