Permalink
Browse files

Tightening type for flattenStyle

Reviewed By: yungsters

Differential Revision: D7131703

fbshipit-source-id: d8e37fcd0c743057e04760b1e50f8d879bd2826a
  • Loading branch information...
TheSavior authored and facebook-github-bot committed Mar 3, 2018
1 parent 3152e93 commit 70a3ececc368a8d0fe4b57b13ac956ad99a637c7
Showing with 7 additions and 9 deletions.
  1. +4 −4 Libraries/Animated/src/nodes/AnimatedTransform.js
  2. +3 −5 Libraries/StyleSheet/flattenStyle.js
@@ -15,9 +15,9 @@ const AnimatedWithChildren = require('./AnimatedWithChildren');
const NativeAnimatedHelper = require('../NativeAnimatedHelper');
class AnimatedTransform extends AnimatedWithChildren {
_transforms: Array<Object>;
_transforms: $ReadOnlyArray<Object>;
constructor(transforms: Array<Object>) {
constructor(transforms: $ReadOnlyArray<Object>) {
super();
this._transforms = transforms;
}
@@ -34,7 +34,7 @@ class AnimatedTransform extends AnimatedWithChildren {
});
}
__getValue(): Array<Object> {
__getValue(): $ReadOnlyArray<Object> {
return this._transforms.map(transform => {
const result = {};
for (const key in transform) {
@@ -49,7 +49,7 @@ class AnimatedTransform extends AnimatedWithChildren {
});
}
__getAnimatedValue(): Array<Object> {
__getAnimatedValue(): $ReadOnlyArray<Object> {
return this._transforms.map(transform => {
const result = {};
for (const key in transform) {
@@ -9,10 +9,9 @@
*/
'use strict';
var invariant = require('fbjs/lib/invariant');
var ReactNativePropRegistry;
import type { StyleObj } from 'StyleSheetTypes';
import type { DimensionValue, ColorValue, StyleProp, Style } from 'StyleSheetTypes';
function getStyle(style) {
if (ReactNativePropRegistry === undefined) {
@@ -24,11 +23,10 @@ function getStyle(style) {
return style;
}
function flattenStyle(style: ?StyleObj): ?Object {
if (!style) {
function flattenStyle(style: ?StyleProp<Style<DimensionValue, ColorValue>>): ?Style<DimensionValue, ColorValue> {
if (style == null) {
return undefined;
}
invariant(style !== true, 'style may be false but not true');
if (!Array.isArray(style)) {
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an

0 comments on commit 70a3ece

Please sign in to comment.