mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 23:28:12 +00:00
Summary: Fixes the runtime value of `ReactNativeStyleAttributes` to correctly map to `true` instead of strings (as returned by `keyMirror`). Reviewed By: TheSavior Differential Revision: D10057235 fbshipit-source-id: dc855cff3a114761098ed5176b2e6e25412481dc
51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format strict-local
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
const ImageStylePropTypes = require('ImageStylePropTypes');
|
|
const TextStylePropTypes = require('TextStylePropTypes');
|
|
const ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
const processColor = require('processColor');
|
|
const processTransform = require('processTransform');
|
|
const sizesDiffer = require('sizesDiffer');
|
|
|
|
const ReactNativeStyleAttributes = {};
|
|
|
|
for (const attributeName of Object.keys({
|
|
...ViewStylePropTypes,
|
|
...TextStylePropTypes,
|
|
...ImageStylePropTypes,
|
|
})) {
|
|
ReactNativeStyleAttributes[attributeName] = true;
|
|
}
|
|
|
|
ReactNativeStyleAttributes.transform = {process: processTransform};
|
|
ReactNativeStyleAttributes.shadowOffset = {diff: sizesDiffer};
|
|
|
|
const colorAttributes = {process: processColor};
|
|
ReactNativeStyleAttributes.backgroundColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderBottomColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderLeftColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderRightColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderTopColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderStartColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderEndColor = colorAttributes;
|
|
ReactNativeStyleAttributes.color = colorAttributes;
|
|
ReactNativeStyleAttributes.shadowColor = colorAttributes;
|
|
ReactNativeStyleAttributes.textDecorationColor = colorAttributes;
|
|
ReactNativeStyleAttributes.tintColor = colorAttributes;
|
|
ReactNativeStyleAttributes.textShadowColor = colorAttributes;
|
|
ReactNativeStyleAttributes.overlayColor = colorAttributes;
|
|
|
|
module.exports = ReactNativeStyleAttributes;
|