mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Revert D68017325: Migrate StyleSheet/*.js to use export statements
Differential Revision: D68017325 Original commit changeset: 3c5b94742f10 Original Phabricator Diff: D68017325 fbshipit-source-id: d7ea1edfe9cca151560e9c0e5554a07153cdb8da
This commit is contained in:
1 parent
b3648be84f
commit
0f1d4704df
20 files changed
+27
-28
No files matched your search
+1
-1
@@ -31,7 +31,7 @@ export const __INTERNAL_VIEW_CONFIG = {
|
||||
radii: true,
|
||||
|
||||
colors: {
|
||||
process: require('react-native/Libraries/StyleSheet/processColorArray').default,
|
||||
process: require('react-native/Libraries/StyleSheet/processColorArray'),
|
||||
},
|
||||
|
||||
srcs: true,
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ function getReactDiffProcessValue(typeAnnotation: PropTypeAnnotation) {
|
||||
switch (typeAnnotation.elementType.name) {
|
||||
case 'ColorPrimitive':
|
||||
return j.template
|
||||
.expression`{ process: require('react-native/Libraries/StyleSheet/processColorArray').default }`;
|
||||
.expression`{ process: require('react-native/Libraries/StyleSheet/processColorArray') }`;
|
||||
case 'ImageSourcePrimitive':
|
||||
case 'PointPrimitive':
|
||||
case 'EdgeInsetsPrimitive':
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ export const __INTERNAL_VIEW_CONFIG = {
|
||||
radii: true,
|
||||
|
||||
colors: {
|
||||
process: require('react-native/Libraries/StyleSheet/processColorArray').default,
|
||||
process: require('react-native/Libraries/StyleSheet/processColorArray'),
|
||||
},
|
||||
|
||||
srcs: true,
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ const resolveAssetSource = require('../Image/resolveAssetSource');
|
||||
const processBackgroundImage =
|
||||
require('../StyleSheet/processBackgroundImage').default;
|
||||
const processColor = require('../StyleSheet/processColor').default;
|
||||
const processColorArray = require('../StyleSheet/processColorArray').default;
|
||||
const processColorArray = require('../StyleSheet/processColorArray');
|
||||
const processFilter = require('../StyleSheet/processFilter').default;
|
||||
const insetsDiffer = require('../Utilities/differ/insetsDiffer');
|
||||
const matricesDiffer = require('../Utilities/differ/matricesDiffer');
|
||||
|
||||
@@ -56,7 +56,7 @@ const _normalizeColorObject = (
|
||||
// an ios semantic color
|
||||
return color;
|
||||
} else if ('dynamic' in color && color.dynamic !== undefined) {
|
||||
const normalizeColor = require('./normalizeColor').default;
|
||||
const normalizeColor = require('./normalizeColor');
|
||||
|
||||
// a dynamic, appearance aware color
|
||||
const dynamic = color.dynamic;
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@
|
||||
|
||||
import type {ImageStyleProp, TextStyleProp} from '../StyleSheet';
|
||||
|
||||
import * as StyleSheet from '../StyleSheet';
|
||||
|
||||
const StyleSheet = require('../StyleSheet');
|
||||
const imageStyle = {tintColor: 'rgb(0, 0, 0)'};
|
||||
const textStyle = {color: 'rgb(0, 0, 0)'};
|
||||
|
||||
|
||||
+2
-2
@@ -11,12 +11,12 @@
|
||||
'use strict';
|
||||
|
||||
const {OS} = require('../../Utilities/Platform');
|
||||
const normalizeColor = require('../normalizeColor').default;
|
||||
const normalizeColor = require('../normalizeColor');
|
||||
|
||||
it('forwards calls to @react-native/normalize-colors', () => {
|
||||
jest.resetModules().mock('@react-native/normalize-colors', () => jest.fn());
|
||||
|
||||
expect(require('../normalizeColor').default('#abc')).not.toBe(null);
|
||||
expect(require('../normalizeColor')('#abc')).not.toBe(null);
|
||||
expect(require('@react-native/normalize-colors')).toBeCalled();
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import processAspectRatio from '../processAspectRatio';
|
||||
const processAspectRatio = require('../processAspectRatio');
|
||||
|
||||
describe('processAspectRatio', () => {
|
||||
it('should accept numbers', () => {
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ const PlatformColorIOS =
|
||||
require('../PlatformColorValueTypes.ios').PlatformColor;
|
||||
const DynamicColorIOS =
|
||||
require('../PlatformColorValueTypesIOS.ios').DynamicColorIOS;
|
||||
const processColorArray = require('../processColorArray').default;
|
||||
const processColorArray = require('../processColorArray');
|
||||
|
||||
const platformSpecific =
|
||||
OS === 'android'
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const processFontVariant = require('../processFontVariant').default;
|
||||
const processFontVariant = require('../processFontVariant');
|
||||
|
||||
describe('processFontVariant', () => {
|
||||
it('should accept arrays', () => {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import processTransform from '../processTransform';
|
||||
const processTransform = require('../processTransform');
|
||||
|
||||
describe('processTransform', () => {
|
||||
describe('validation', () => {
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const normalizeColor = require('../normalizeColor').default;
|
||||
const setNormalizedColorAlpha = require('../setNormalizedColorAlpha').default;
|
||||
const normalizeColor = require('../normalizeColor');
|
||||
const setNormalizedColorAlpha = require('../setNormalizedColorAlpha');
|
||||
|
||||
describe('setNormalizedColorAlpha', function () {
|
||||
it('should adjust the alpha of the color passed in', function () {
|
||||
|
||||
@@ -31,4 +31,4 @@ function normalizeColor(
|
||||
}
|
||||
}
|
||||
|
||||
export default normalizeColor;
|
||||
module.exports = normalizeColor;
|
||||
@@ -60,4 +60,4 @@ function processAspectRatio(aspectRatio?: number | string): ?number {
|
||||
return Number(matches[0]);
|
||||
}
|
||||
|
||||
export default processAspectRatio;
|
||||
module.exports = processAspectRatio;
|
||||
@@ -13,7 +13,7 @@
|
||||
import type {ColorValue, NativeColorValue} from './StyleSheet';
|
||||
|
||||
const Platform = require('../Utilities/Platform');
|
||||
const normalizeColor = require('./normalizeColor').default;
|
||||
const normalizeColor = require('./normalizeColor');
|
||||
|
||||
export type ProcessedColorValue = number | NativeColorValue;
|
||||
|
||||
|
||||
@@ -32,4 +32,4 @@ function processColorElement(color: ColorValue): ProcessedColorValue {
|
||||
return value;
|
||||
}
|
||||
|
||||
export default processColorArray;
|
||||
module.exports = processColorArray;
|
||||
@@ -27,4 +27,4 @@ function processFontVariant(
|
||||
return match;
|
||||
}
|
||||
|
||||
export default processFontVariant;
|
||||
module.exports = processFontVariant;
|
||||
@@ -266,4 +266,4 @@ function _validateTransform(
|
||||
}
|
||||
}
|
||||
|
||||
export default processTransform;
|
||||
module.exports = processTransform;
|
||||
@@ -28,4 +28,4 @@ function setNormalizedColorAlpha(input: number, alpha: number): number {
|
||||
return ((input & 0xffffff00) | alpha) >>> 0;
|
||||
}
|
||||
|
||||
export default setNormalizedColorAlpha;
|
||||
module.exports = setNormalizedColorAlpha;
|
||||
@@ -8284,7 +8284,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/norma
|
||||
"declare function normalizeColor(
|
||||
color: ?(ColorValue | ProcessedColorValue)
|
||||
): ?ProcessedColorValue;
|
||||
declare export default typeof normalizeColor;
|
||||
declare module.exports: normalizeColor;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -8332,7 +8332,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/priva
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/StyleSheet/processAspectRatio.js 1`] = `
|
||||
"declare function processAspectRatio(aspectRatio?: number | string): ?number;
|
||||
declare export default typeof processAspectRatio;
|
||||
declare module.exports: processAspectRatio;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -8382,7 +8382,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/proce
|
||||
"declare function processColorArray(
|
||||
colors: ?$ReadOnlyArray<ColorValue>
|
||||
): ?$ReadOnlyArray<ProcessedColorValue>;
|
||||
declare export default typeof processColorArray;
|
||||
declare module.exports: processColorArray;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -8414,7 +8414,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/proce
|
||||
"declare function processFontVariant(
|
||||
fontVariant: ____FontVariantArray_Internal | string
|
||||
): ?____FontVariantArray_Internal;
|
||||
declare export default typeof processFontVariant;
|
||||
declare module.exports: processFontVariant;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -8422,7 +8422,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/proce
|
||||
"declare function processTransform(
|
||||
transform: Array<Object> | string
|
||||
): Array<Object> | Array<number>;
|
||||
declare export default typeof processTransform;
|
||||
declare module.exports: processTransform;
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -8435,7 +8435,7 @@ exports[`public API should not change unintentionally Libraries/StyleSheet/proce
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/StyleSheet/setNormalizedColorAlpha.js 1`] = `
|
||||
"declare function setNormalizedColorAlpha(input: number, alpha: number): number;
|
||||
declare export default typeof setNormalizedColorAlpha;
|
||||
declare module.exports: setNormalizedColorAlpha;
|
||||
"
|
||||
`;
|
||||
|
||||
|
||||
Reference in new issue
Block a user