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:
Tim Yung 2018-09-28 00:48:09 -07:00 committed by Facebook Github Bot
parent e873809222
commit 199c918dbe
3 changed files with 13 additions and 13 deletions

View File

@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @format strict-local
* @flow
*/
@ -14,19 +14,19 @@ const ImageStylePropTypes = require('ImageStylePropTypes');
const TextStylePropTypes = require('TextStylePropTypes');
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 processTransform = require('processTransform');
const sizesDiffer = require('sizesDiffer');
const ReactNativeStyleAttributes = {
...keyMirror(ViewStylePropTypes),
...keyMirror(TextStylePropTypes),
...keyMirror(ImageStylePropTypes),
};
const ReactNativeStyleAttributes = {};
for (const attributeName of Object.keys({
...ViewStylePropTypes,
...TextStylePropTypes,
...ImageStylePropTypes,
})) {
ReactNativeStyleAttributes[attributeName] = true;
}
ReactNativeStyleAttributes.transform = {process: processTransform};
ReactNativeStyleAttributes.shadowOffset = {diff: sizesDiffer};

View File

@ -4,8 +4,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @flow strict
*/
'use strict';

View File

@ -36,8 +36,8 @@ export type MeasureLayoutOnSuccessCallback = (
type AttributeType =
| true
| $ReadOnly<{|
diff: ?<T>(arg1: T, arg2: T) => boolean,
process: ?(arg1: any) => any,
diff?: <T>(arg1: T, arg2: T) => boolean,
process?: (arg1: any) => any,
|}>;
export type AttributeConfiguration<