File tree 3 files changed +13
-22
lines changed
3 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -20,29 +20,28 @@ import type {
20
20
StyleSheetStyle as _StyleSheetStyle ,
21
21
Styles as _Styles ,
22
22
StyleSheet as _StyleSheet ,
23
- StyleValue as _StyleValue ,
24
23
StyleObj ,
24
+ LayoutStyle
25
25
} from 'StyleSheetTypes' ;
26
26
27
27
export type StyleProp = StyleObj ;
28
28
export type Styles = _Styles ;
29
29
export type StyleSheet < S > = _StyleSheet < S > ;
30
- export type StyleValue = _StyleValue ;
31
30
export type StyleSheetStyle = _StyleSheetStyle ;
32
31
33
32
let hairlineWidth = PixelRatio . roundToNearestPixel ( 0.4 ) ;
34
33
if ( hairlineWidth === 0 ) {
35
34
hairlineWidth = 1 / PixelRatio . get ( ) ;
36
35
}
37
36
38
- const absoluteFillObject = {
39
- position : ( 'absolute' : 'absolute' ) ,
37
+ const absoluteFillObject : LayoutStyle = {
38
+ position : 'absolute' ,
40
39
left : 0 ,
41
40
right : 0 ,
42
41
top : 0 ,
43
42
bottom : 0 ,
44
43
} ;
45
- const absoluteFill : typeof absoluteFillObject =
44
+ const absoluteFill : StyleSheetStyle =
46
45
ReactNativePropRegistry . register ( absoluteFillObject ) ; // This also freezes it
47
46
48
47
/**
Original file line number Diff line number Diff line change @@ -220,34 +220,26 @@ export type Style = {
220
220
+ overlayColor ?: string ,
221
221
} ;
222
222
223
- export type StyleProp < + T > =
223
+ type GenericStyleProp < + T > =
224
224
| null
225
225
| void
226
226
| T
227
227
| StyleSheetStyle
228
228
| number
229
229
| false
230
230
| ''
231
- | $ReadOnlyArray < StyleProp < T >> ;
231
+ | $ReadOnlyArray < GenericStyleProp < T >> ;
232
232
233
- // export type ViewStyleProp = StyleProp<$Shape<ViewStyle<DimensionValue>>>;
234
- // export type TextStyleProp = StyleProp<
235
- // $Shape<TextStyle<DimensionValue, ColorValue>>,
236
- // >;
237
- // export type ImageStyleProp = StyleProp<
238
- // $Shape<ImageStyle<DimensionValue, ColorValue>>,
239
- // >;
233
+ export type StyleObj = GenericStyleProp < $Shape < Style >> ;
240
234
241
- export type StyleObj = StyleProp < $Shape < Style >> ;
242
- export type StyleValue = StyleObj ;
243
-
244
- export type ViewStyleProp = StyleProp < $ReadOnly < $Shape < ViewStyle >>> ;
245
- export type TextStyleProp = StyleProp < $ReadOnly < $Shape < TextStyle >>> ;
246
- export type ImageStyleProp = StyleProp < $ReadOnly < $Shape < ImageStyle >>> ;
235
+ export type ViewStyleProp = GenericStyleProp < $ReadOnly < $Shape < ViewStyle >>> ;
236
+ export type TextStyleProp = GenericStyleProp < $ReadOnly < $Shape < TextStyle >>> ;
237
+ export type ImageStyleProp = GenericStyleProp < $ReadOnly < $Shape < ImageStyle >>> ;
247
238
248
239
export type Styles = {
249
240
+ [ key : string ] : $Shape < Style > ,
250
241
} ;
242
+
251
243
export type StyleSheet < + S : Styles > = $ObjMap < S , ( Object ) => StyleSheetStyle > ;
252
244
253
245
/*
Original file line number Diff line number Diff line change 11
11
12
12
var ReactNativePropRegistry ;
13
13
14
- import type { StyleProp , Style } from 'StyleSheetTypes' ;
14
+ import type { StyleObj , Style } from 'StyleSheetTypes' ;
15
15
16
16
function getStyle ( style ) {
17
17
if ( ReactNativePropRegistry === undefined ) {
@@ -23,7 +23,7 @@ function getStyle(style) {
23
23
return style ;
24
24
}
25
25
26
- function flattenStyle ( style : ?StyleProp < Style > ) : ?Style {
26
+ function flattenStyle ( style : ?StyleObj ) : ?Style {
27
27
if ( style == null ) {
28
28
return undefined ;
29
29
}
You can’t perform that action at this time.
0 commit comments