Skip to content

Commit 6e6d058

Browse files
committed
flow: Change Style type to any
React Native have improved their internal Flow types significantly. They have a lot of concrete style types and they conflicted with what we had (a decent approximation) I tried for hours to implement something sensible that kept our styling types concrete and helpful. The best approach looked like this: ```js import type { ImageStyleProp, TextStyleProp, ViewStyleProp, } from 'react-native/Libraries/StyleSheet/StyleSheet'; type Style = ViewStyleProp | TextStyleProp | ImageStyleProp; ``` This confused Flow as it wasn't able to choose between the three when two or more were viable. Trying to specify one of the three types directly instead of Style looked like the right option. After coding this for a while though, it was obvious that it required too much change, and the benefit per effort was not good. We should keep an eye on how the RN internal typings and Flow itself progresses and reconsider using more concrete types in future.
1 parent 43b8386 commit 6e6d058

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/types.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export type ThunkDispatch<T> = ((Dispatch, GetState) => T) => T;
3030

3131
export type Dispatch = ReduxDispatch<*> & ThunkDispatch<*>;
3232

33-
export type Style = boolean | number | Array<Style> | ?{ [string]: any };
33+
export type Style = any;
3434

3535
export type Orientation = 'LANDSCAPE' | 'PORTRAIT';
3636

0 commit comments

Comments
 (0)