mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-21 05:55:48 +00:00
@@ -10,7 +10,7 @@ import StylePropTypes from '../StylePropTypes'
|
||||
* event classes
|
||||
*/
|
||||
const initialState = { classNames: predefinedClassNames }
|
||||
const options = { obfuscateClassNames: process.env.NODE_ENV === 'production' }
|
||||
const options = { obfuscateClassNames: !(process.env.NODE_ENV !== 'production') }
|
||||
const createStore = () => new Store(initialState, options)
|
||||
let store = createStore()
|
||||
let isRendered = false
|
||||
@@ -62,6 +62,21 @@ const create = (styles: Object): Object => {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
const deepFreeze = (obj) => {
|
||||
const propNames = Object.getOwnPropertyNames(obj)
|
||||
propNames.forEach((name) => {
|
||||
const prop = obj[name]
|
||||
if (typeof prop === 'object' && prop !== null && !Object.isFrozen(prop)) {
|
||||
deepFreeze(prop)
|
||||
}
|
||||
})
|
||||
return Object.freeze(obj)
|
||||
}
|
||||
|
||||
deepFreeze(styles)
|
||||
}
|
||||
|
||||
return styles
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user