Skip to content

Commit 4895c64

Browse files
elicwhitefacebook-github-bot
authored andcommittedMar 8, 2018
Rename Style to DangerouslyImpreciseStyle
Reviewed By: yungsters Differential Revision: D7190268 fbshipit-source-id: d652a95be7550d65cfbfc59f41d7bda92915bacf
1 parent 5b32358 commit 4895c64

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed
 

‎Libraries/StyleSheet/StyleSheet.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ const flatten = require('flattenStyle');
2020
import type {
2121
____StyleSheetInternalStyleIdentifier_Internal as StyleSheetInternalStyleIdentifier,
2222
____Styles_Internal,
23-
____StyleObj_Internal,
23+
____DangerouslyImpreciseStyleProp_Internal,
2424
____ViewStyleProp_Internal,
2525
____TextStyleProp_Internal,
2626
____ImageStyleProp_Internal,
2727
LayoutStyle,
2828
} from 'StyleSheetTypes';
2929

30-
export type DangerouslyImpreciseStyleProp = ____StyleObj_Internal;
30+
export type DangerouslyImpreciseStyleProp = ____DangerouslyImpreciseStyleProp_Internal;
3131
export type ViewStyleProp = ____ViewStyleProp_Internal;
3232
export type TextStyleProp = ____TextStyleProp_Internal;
3333
export type ImageStyleProp = ____ImageStyleProp_Internal;

‎Libraries/StyleSheet/StyleSheetTypes.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export type ImageStyle = $ReadOnly<{|
213213
overlayColor?: string,
214214
|}>;
215215

216-
export type Style = {
216+
export type DangerouslyImpreciseStyle = {
217217
...$Exact<TextStyle>,
218218
+resizeMode?: 'contain' | 'cover' | 'stretch' | 'center' | 'repeat',
219219
+tintColor?: ColorValue,
@@ -230,7 +230,9 @@ type GenericStyleProp<+T> =
230230
| ''
231231
| $ReadOnlyArray<GenericStyleProp<T>>;
232232

233-
export type ____StyleObj_Internal = GenericStyleProp<$Shape<Style>>;
233+
export type ____DangerouslyImpreciseStyleProp_Internal = GenericStyleProp<
234+
$Shape<DangerouslyImpreciseStyle>,
235+
>;
234236
export type ____ViewStyleProp_Internal = GenericStyleProp<
235237
$ReadOnly<$Shape<ViewStyle>>,
236238
>;
@@ -242,7 +244,7 @@ export type ____ImageStyleProp_Internal = GenericStyleProp<
242244
>;
243245

244246
export type ____Styles_Internal = {
245-
+[key: string]: $Shape<Style>,
247+
+[key: string]: $Shape<DangerouslyImpreciseStyle>,
246248
};
247249

248250
/*
@@ -260,4 +262,6 @@ type Props = {position: TypeForStyleKey<'position'>};
260262
This will correctly give you the type 'absolute' | 'relative' instead of the
261263
weak type of just string;
262264
*/
263-
export type TypeForStyleKey<+key: $Keys<Style>> = $ElementType<Style, key>;
265+
export type TypeForStyleKey<
266+
+key: $Keys<DangerouslyImpreciseStyle>,
267+
> = $ElementType<DangerouslyImpreciseStyle, key>;

‎Libraries/StyleSheet/flattenStyle.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
*
77
* @providesModule flattenStyle
88
* @flow
9+
* @format
910
*/
1011
'use strict';
1112

1213
var ReactNativePropRegistry;
1314

1415
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';
15-
import type { Style } from 'StyleSheetTypes';
16+
import type {DangerouslyImpreciseStyle} from 'StyleSheetTypes';
1617

1718
function getStyle(style) {
1819
if (ReactNativePropRegistry === undefined) {
@@ -24,7 +25,9 @@ function getStyle(style) {
2425
return style;
2526
}
2627

27-
function flattenStyle(style: ?DangerouslyImpreciseStyleProp): ?Style {
28+
function flattenStyle(
29+
style: ?DangerouslyImpreciseStyleProp,
30+
): ?DangerouslyImpreciseStyle {
2831
if (style == null) {
2932
return undefined;
3033
}

0 commit comments

Comments
 (0)