diff --git a/packages/benchmarks/webpack.config.js b/packages/benchmarks/webpack.config.js index 58dc7cee..b778c9d6 100644 --- a/packages/benchmarks/webpack.config.js +++ b/packages/benchmarks/webpack.config.js @@ -49,7 +49,7 @@ module.exports = { new webpack.optimize.UglifyJsPlugin({ compress: { dead_code: true, - drop_console: true, + drop_console: false, screw_ie8: true, warnings: false } diff --git a/packages/react-native-web/src/exports/StyleSheet/StyleSheet.js b/packages/react-native-web/src/exports/StyleSheet/StyleSheet.js new file mode 100644 index 00000000..5c35aedf --- /dev/null +++ b/packages/react-native-web/src/exports/StyleSheet/StyleSheet.js @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2016-present, Nicolas Gallagher. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + * + * @providesModule StyleSheet + * @noflow + */ + +import flattenStyle from './flattenStyle'; +import getHairlineWidth from './getHairlineWidth'; +import ReactNativePropRegistry from '../../modules/ReactNativePropRegistry'; + +const absoluteFillObject = { + position: 'absolute', + left: 0, + right: 0, + top: 0, + bottom: 0 +}; +const absoluteFill = ReactNativePropRegistry.register(absoluteFillObject); + +const StyleSheet = { + absoluteFill, + absoluteFillObject, + compose(style1, style2) { + if (style1 && style2) { + return [style1, style2]; + } else { + return style1 || style2; + } + }, + create(styles) { + const result = {}; + Object.keys(styles).forEach(key => { + if (process.env.NODE_ENV !== 'production') { + const StyleSheetValidation = require('./StyleSheetValidation').default; + StyleSheetValidation.validateStyle(key, styles); + } + const id = styles[key] && ReactNativePropRegistry.register(styles[key]); + result[key] = id; + }); + return result; + }, + flatten: flattenStyle, + hairlineWidth: getHairlineWidth() +}; + +export default StyleSheet; diff --git a/packages/react-native-web/src/exports/StyleSheet/index.js b/packages/react-native-web/src/exports/StyleSheet/index.js index 398d639a..6d99be04 100644 --- a/packages/react-native-web/src/exports/StyleSheet/index.js +++ b/packages/react-native-web/src/exports/StyleSheet/index.js @@ -1,19 +1,5 @@ -/** - * Copyright (c) 2016-present, Nicolas Gallagher. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - * - * @providesModule StyleSheet - * @noflow - */ - -import flattenStyle from './flattenStyle'; -import getHairlineWidth from './getHairlineWidth'; import modality from '../../modules/modality'; -import ReactNativePropRegistry from '../../modules/ReactNativePropRegistry'; -import styleResolver from './styleResolver'; +import StyleSheet from './StyleSheet'; // initialize focus-ring fix modality(); @@ -22,46 +8,8 @@ modality(); if (process.env.NODE_ENV !== 'production') { const { canUseDOM } = require('fbjs/lib/ExecutionEnvironment'); if (canUseDOM && window.__REACT_DEVTOOLS_GLOBAL_HOOK__) { - window.__REACT_DEVTOOLS_GLOBAL_HOOK__.resolveRNStyle = flattenStyle; + window.__REACT_DEVTOOLS_GLOBAL_HOOK__.resolveRNStyle = StyleSheet.flatten; } } -const absoluteFillObject = { - position: 'absolute', - left: 0, - right: 0, - top: 0, - bottom: 0 -}; -const absoluteFill = ReactNativePropRegistry.register(absoluteFillObject); - -const StyleSheet = { - absoluteFill, - absoluteFillObject, - compose(style1, style2) { - if (style1 && style2) { - return [style1, style2]; - } else { - return style1 || style2; - } - }, - create(styles) { - const result = {}; - Object.keys(styles).forEach(key => { - if (process.env.NODE_ENV !== 'production') { - const StyleSheetValidation = require('./StyleSheetValidation').default; - StyleSheetValidation.validateStyle(key, styles); - } - const id = styles[key] && ReactNativePropRegistry.register(styles[key]); - result[key] = id; - }); - return result; - }, - flatten: flattenStyle, - getStyleSheets() { - return styleResolver.getStyleSheets(); - }, - hairlineWidth: getHairlineWidth() -}; - export default StyleSheet;