File tree Expand file tree Collapse file tree 3 files changed +13
-22
lines changed
Expand file tree Collapse file tree 3 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -20,29 +20,28 @@ import type {
2020 StyleSheetStyle as _StyleSheetStyle ,
2121 Styles as _Styles ,
2222 StyleSheet as _StyleSheet ,
23- StyleValue as _StyleValue ,
2423 StyleObj ,
24+ LayoutStyle
2525} from 'StyleSheetTypes' ;
2626
2727export type StyleProp = StyleObj ;
2828export type Styles = _Styles ;
2929export type StyleSheet < S > = _StyleSheet < S > ;
30- export type StyleValue = _StyleValue ;
3130export type StyleSheetStyle = _StyleSheetStyle ;
3231
3332let hairlineWidth = PixelRatio . roundToNearestPixel ( 0.4 ) ;
3433if ( hairlineWidth === 0 ) {
3534 hairlineWidth = 1 / PixelRatio . get ( ) ;
3635}
3736
38- const absoluteFillObject = {
39- position : ( 'absolute' : 'absolute' ) ,
37+ const absoluteFillObject : LayoutStyle = {
38+ position : 'absolute' ,
4039 left : 0 ,
4140 right : 0 ,
4241 top : 0 ,
4342 bottom : 0 ,
4443} ;
45- const absoluteFill : typeof absoluteFillObject =
44+ const absoluteFill : StyleSheetStyle =
4645 ReactNativePropRegistry . register ( absoluteFillObject ) ; // This also freezes it
4746
4847/**
Original file line number Diff line number Diff line change @@ -220,34 +220,26 @@ export type Style = {
220220 + overlayColor ?: string ,
221221} ;
222222
223- export type StyleProp < + T > =
223+ type GenericStyleProp < + T > =
224224 | null
225225 | void
226226 | T
227227 | StyleSheetStyle
228228 | number
229229 | false
230230 | ''
231- | $ReadOnlyArray < StyleProp < T >> ;
231+ | $ReadOnlyArray < GenericStyleProp < T >> ;
232232
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 >> ;
240234
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 >>> ;
247238
248239export type Styles = {
249240 + [ key : string ] : $Shape < Style > ,
250241} ;
242+
251243export type StyleSheet < + S : Styles > = $ObjMap < S , ( Object ) => StyleSheetStyle > ;
252244
253245/*
Original file line number Diff line number Diff line change 1111
1212var ReactNativePropRegistry ;
1313
14- import type { StyleProp , Style } from 'StyleSheetTypes' ;
14+ import type { StyleObj , Style } from 'StyleSheetTypes' ;
1515
1616function getStyle ( style ) {
1717 if ( ReactNativePropRegistry === undefined ) {
@@ -23,7 +23,7 @@ function getStyle(style) {
2323 return style ;
2424}
2525
26- function flattenStyle ( style : ?StyleProp < Style > ) : ?Style {
26+ function flattenStyle ( style : ?StyleObj ) : ?Style {
2727 if ( style == null ) {
2828 return undefined ;
2929 }
You can’t perform that action at this time.
0 commit comments