mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-04 22:56:32 +08:00
RN: Fix ReactNativeViewAttributes Type Bugs
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
This commit is contained in:
committed by
Facebook Github Bot
parent
e873809222
commit
199c918dbe
@@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* @format
|
* @format strict-local
|
||||||
* @flow
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -14,19 +14,19 @@ const ImageStylePropTypes = require('ImageStylePropTypes');
|
|||||||
const TextStylePropTypes = require('TextStylePropTypes');
|
const TextStylePropTypes = require('TextStylePropTypes');
|
||||||
const ViewStylePropTypes = require('ViewStylePropTypes');
|
const ViewStylePropTypes = require('ViewStylePropTypes');
|
||||||
|
|
||||||
/* $FlowFixMe(>=0.54.0 site=react_native_oss) This comment suppresses an error
|
|
||||||
* found when Flow v0.54 was deployed. To see the error delete this comment and
|
|
||||||
* run Flow. */
|
|
||||||
const keyMirror = require('fbjs/lib/keyMirror');
|
|
||||||
const processColor = require('processColor');
|
const processColor = require('processColor');
|
||||||
const processTransform = require('processTransform');
|
const processTransform = require('processTransform');
|
||||||
const sizesDiffer = require('sizesDiffer');
|
const sizesDiffer = require('sizesDiffer');
|
||||||
|
|
||||||
const ReactNativeStyleAttributes = {
|
const ReactNativeStyleAttributes = {};
|
||||||
...keyMirror(ViewStylePropTypes),
|
|
||||||
...keyMirror(TextStylePropTypes),
|
for (const attributeName of Object.keys({
|
||||||
...keyMirror(ImageStylePropTypes),
|
...ViewStylePropTypes,
|
||||||
};
|
...TextStylePropTypes,
|
||||||
|
...ImageStylePropTypes,
|
||||||
|
})) {
|
||||||
|
ReactNativeStyleAttributes[attributeName] = true;
|
||||||
|
}
|
||||||
|
|
||||||
ReactNativeStyleAttributes.transform = {process: processTransform};
|
ReactNativeStyleAttributes.transform = {process: processTransform};
|
||||||
ReactNativeStyleAttributes.shadowOffset = {diff: sizesDiffer};
|
ReactNativeStyleAttributes.shadowOffset = {diff: sizesDiffer};
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
|
* @flow strict-local
|
||||||
* @format
|
* @format
|
||||||
* @flow strict
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ export type MeasureLayoutOnSuccessCallback = (
|
|||||||
type AttributeType =
|
type AttributeType =
|
||||||
| true
|
| true
|
||||||
| $ReadOnly<{|
|
| $ReadOnly<{|
|
||||||
diff: ?<T>(arg1: T, arg2: T) => boolean,
|
diff?: <T>(arg1: T, arg2: T) => boolean,
|
||||||
process: ?(arg1: any) => any,
|
process?: (arg1: any) => any,
|
||||||
|}>;
|
|}>;
|
||||||
|
|
||||||
export type AttributeConfiguration<
|
export type AttributeConfiguration<
|
||||||
|
|||||||
Reference in New Issue
Block a user