react-native/Libraries/StyleSheet
James Isaac 820cfa1f3b Refine StyleSheet Flow types
Summary:
Nice addition of the recent Flow types for style props in 9c29ee1504, however I think there are some slight issues in the definition.

`type Styles = {[key: string]: Object}` makes sense, as it's referring to the set of named style groups a user creates a `StyleSheet` from, e.g.

```javascript
const styles: StyleSheet = StyleSheet.create({
  container: {
    height: 20
  },
  text: {
    color: '#999',
    fontSize: 12,
  },
}: Styles)
```

However `type StyleValue = {[key: string]: Object}` doesn't make sense.  You actually want only the `Object` portion of that definition, presuming it's meant to be used like below:

```javascript
type MyTextProps = {
  style: StyleProp,
}

<MyText style={{ color: '#999', fontSize: 12 }}>Hello</Text>
```

 ---

I've also added `void` to the `StyleValue`, as undefined seems to be handled fine, and can be a useful shorthand in JSX.

 ---

And finally, I've allowed nesting of style prop arrays, by making StyleProp self-referencing, as RN seems to flatten those without issue.  This can be important if you're passing in a style prop quite high up the component tree, and sticking it in an array with other styles at several points while it's passed down.

N/A (These types aren't referenced anywhere else)

[INTERNAL] [MINOR] [StyleSheet] - Refine Flow types
Closes https://github.com/facebook/react-native/pull/16741

Reviewed By: frantic

Differential Revision: D6278010

Pulled By: TheSavior

fbshipit-source-id: 0170a233ab71d29f445786f5e695463f9730db3a
2017-11-09 11:58:15 -08:00
..
__tests__ Adding @email tags to most of the tests 2017-11-02 06:25:03 -07:00
ColorPropType.js Sync React Native with React 16.0.0-alpha.3 (take 2) 2017-02-27 17:30:30 -08:00
EdgeInsetsPropType.js Fix Flow errors at declaration of most major library components 2017-10-20 03:50:25 -07:00
LayoutPropTypes.js iOS: Implement margin(Start|End) styles for RN 2017-10-18 19:33:31 -07:00
PointPropType.js Update remaining PropTypes references 2017-06-12 16:03:09 -07:00
StyleSheet.js Refine StyleSheet Flow types 2017-11-09 11:58:15 -08:00
StyleSheetPropType.js Patch up for future React Sync 2017-02-08 14:50:43 -08:00
StyleSheetTypes.js Unrevert D3518381 2016-07-06 12:58:41 -07:00
StyleSheetValidation.js Upgrade Flow to v0.56.0 2017-10-02 21:11:05 -07:00
TransformPropTypes.js update docs for Transforms 2017-07-28 12:49:01 -07:00
flattenStyle.js Flat ReactNative renderer bundle [WIP] 2017-05-26 11:03:06 -07:00
normalizeColor.js Upgrade fbsource/xplat/js to Flow v0.53.0 2017-08-17 18:45:01 -07:00
processColor.js Flowify Process Color 2017-04-26 11:31:56 -07:00
processTransform.js Fix parseFloat mistaken uses of "radix" 2017-05-03 23:00:39 -07:00
setNormalizedColorAlpha.js Replace usages of hexToRgb with setNormalizedColorAlpha 2016-02-09 14:58:34 -08:00