Skip to content
This repository was archived by the owner on Nov 27, 2022. It is now read-only.

Commit d1670ad

Browse files
committed
fix: fix flow issues
1 parent a55b298 commit d1670ad

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

src/TabBar.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import type {
1717
Scene,
1818
SceneRendererProps,
1919
Route,
20+
Style,
2021
} from './TabViewTypeDefinitions';
2122

2223
type IndicatorProps<T> = SceneRendererProps<T> & {
@@ -40,15 +41,15 @@ type Props<T> = SceneRendererProps<T> & {
4041
pressColor?: string,
4142
pressOpacity?: number,
4243
getLabelText: (scene: Scene<T>) => ?string,
43-
renderLabel?: (scene: Scene<T>) => ?React.Element<*>,
44-
renderIcon?: (scene: Scene<T>) => ?React.Element<*>,
45-
renderBadge?: (scene: Scene<T>) => ?React.Element<*>,
46-
renderIndicator?: (props: IndicatorProps<T>) => ?React.Element<*>,
44+
renderLabel?: (scene: Scene<T>) => ?React.Element<any>,
45+
renderIcon?: (scene: Scene<T>) => ?React.Element<any>,
46+
renderBadge?: (scene: Scene<T>) => ?React.Element<any>,
47+
renderIndicator?: (props: IndicatorProps<T>) => ?React.Element<any>,
4748
onTabPress?: Function,
48-
tabStyle?: any,
49-
indicatorStyle?: any,
50-
labelStyle?: any,
51-
style?: any,
49+
tabStyle?: Style,
50+
indicatorStyle?: Style,
51+
labelStyle?: Style,
52+
style?: Style,
5253
};
5354

5455
type State = {

src/TabViewAnimated.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import type {
1212
Route,
1313
SubscriptionName,
1414
PagerProps,
15+
Style,
1516
} from './TabViewTypeDefinitions';
1617

1718
type DefaultProps<T> = {
18-
renderPager: (props: SceneRendererProps<T> & PagerProps) => React.Element<*>,
19+
renderPager: (
20+
props: SceneRendererProps<T> & PagerProps,
21+
) => React.Element<any>,
1922
};
2023

2124
type Props<T> = PagerProps & {
@@ -24,12 +27,14 @@ type Props<T> = PagerProps & {
2427
onChangePosition?: (value: number) => void,
2528
initialLayout?: Layout,
2629
canJumpToTab?: (route: T) => boolean,
27-
renderPager: (props: SceneRendererProps<T> & PagerProps) => React.Element<*>,
28-
renderScene: (props: SceneRendererProps<T> & Scene<T>) => ?React.Element<*>,
29-
renderHeader?: (props: SceneRendererProps<T>) => ?React.Element<*>,
30-
renderFooter?: (props: SceneRendererProps<T>) => ?React.Element<*>,
30+
renderPager: (
31+
props: SceneRendererProps<T> & PagerProps,
32+
) => React.Element<any>,
33+
renderScene: (props: SceneRendererProps<T> & Scene<T>) => ?React.Element<any>,
34+
renderHeader?: (props: SceneRendererProps<T>) => ?React.Element<any>,
35+
renderFooter?: (props: SceneRendererProps<T>) => ?React.Element<any>,
3136
lazy?: boolean,
32-
style?: any,
37+
style?: Style,
3338
};
3439

3540
type State = {

src/TabViewPagerAndroid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type PageScrollState = 'dragging' | 'settling' | 'idle';
1818
type Props<T> = SceneRendererProps<T> & {
1919
animationEnabled?: boolean,
2020
swipeEnabled?: boolean,
21-
children?: any,
21+
children?: React.Element<any>,
2222
};
2323

2424
export default class TabViewPagerAndroid<T: Route<*>>

src/TabViewPagerPan.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ type Props<T> = SceneRendererProps<T> & {
5656
swipeEnabled?: boolean,
5757
swipeDistanceThreshold: number,
5858
swipeVelocityThreshold: number,
59-
children?: any,
59+
children?: React.Element<any>,
6060
};
6161

6262
const DEAD_ZONE = 12;

src/TabViewPagerScroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type State = {
2222
type Props<T> = SceneRendererProps<T> & {
2323
animationEnabled?: boolean,
2424
swipeEnabled?: boolean,
25-
children?: any,
25+
children?: React.Element<any>,
2626
};
2727

2828
export default class TabViewPagerScroll<T: Route<*>>

src/TabViewTypeDefinitions.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,5 @@ export type PagerProps = {
5757
swipeVelocityThreshold?: number,
5858
children?: *,
5959
};
60+
61+
export type Style = Object | number | false | null | void | Array<Style>;

src/TouchableItem.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Platform,
99
View,
1010
} from 'react-native';
11+
import type { Style } from './TabViewTypeDefinitions';
1112

1213
const LOLLIPOP = 21;
1314

@@ -16,8 +17,8 @@ type Props = {
1617
borderless?: boolean,
1718
pressColor?: string,
1819
pressOpacity?: number,
19-
children?: React.Element<*>,
20-
style?: any,
20+
children?: React.Element<any>,
21+
style?: Style,
2122
};
2223

2324
type DefaultProps = {

0 commit comments

Comments
 (0)