mirror of
https://github.com/status-im/react-native.git
synced 2025-01-24 16:29:01 +00:00
8e3ce0ff98
Summary: Move the ViewAttributes and StyleAttributes configuration into the Components library since they're coupled and change with the native component configuration. This also decouples StyleAttributes from the reconciler by adding it to the ReactViewAttributes. To do that, I refactored the property diffing to allow for recursive configurations. Now an attribute configuration can be a nested object, a custom configuration (diff/process) or true. The requireNativeComponent path incorrectly gets its attributes set up on the root validAttributes instead of the nested style object. So I also have to add the nested form. Effectively these currently allow these attributes on props or nested. @public Reviewed By: @vjeux Differential Revision: D2456842 fb-gh-sync-id: cd5405bd8316c2fcb016d06c61244ce7719c26c0
49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* 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. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule ReactNativeStyleAttributes
|
|
* @flow
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var ImageStylePropTypes = require('ImageStylePropTypes');
|
|
var TextStylePropTypes = require('TextStylePropTypes');
|
|
var ViewStylePropTypes = require('ViewStylePropTypes');
|
|
|
|
var keyMirror = require('keyMirror');
|
|
var matricesDiffer = require('matricesDiffer');
|
|
var processColor = require('processColor');
|
|
var sizesDiffer = require('sizesDiffer');
|
|
|
|
var ReactNativeStyleAttributes = {
|
|
...keyMirror(ViewStylePropTypes),
|
|
...keyMirror(TextStylePropTypes),
|
|
...keyMirror(ImageStylePropTypes),
|
|
};
|
|
|
|
ReactNativeStyleAttributes.transformMatrix = { diff: matricesDiffer };
|
|
ReactNativeStyleAttributes.shadowOffset = { diff: sizesDiffer };
|
|
|
|
// Do not rely on this attribute.
|
|
ReactNativeStyleAttributes.decomposedMatrix = 'decomposedMatrix';
|
|
|
|
var colorAttributes = { process: processColor };
|
|
ReactNativeStyleAttributes.backgroundColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderBottomColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderLeftColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderRightColor = colorAttributes;
|
|
ReactNativeStyleAttributes.borderTopColor = colorAttributes;
|
|
ReactNativeStyleAttributes.color = colorAttributes;
|
|
ReactNativeStyleAttributes.shadowColor = colorAttributes;
|
|
ReactNativeStyleAttributes.textDecorationColor = colorAttributes;
|
|
ReactNativeStyleAttributes.tintColor = colorAttributes;
|
|
|
|
module.exports = ReactNativeStyleAttributes;
|