Skip to content

Commit 6e8569b

Browse files
committed
fix flow and wrong spread
1 parent 4a90907 commit 6e8569b

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

src/HeaderButton.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import * as React from 'react';
55
const BUTTON_HIT_SLOP = { top: 5, bottom: 5, left: 5, right: 5 };
66
import { StyleSheet, View } from 'react-native';
77
import Touchable from 'react-native-platform-touchable';
8-
import type { StyleObj } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
8+
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
99

1010
// from <Item />
1111
export type HeaderButtonProps = {
1212
onPress: ?() => any,
13-
buttonWrapperStyle?: StyleObj,
13+
buttonWrapperStyle?: ViewStyleProp,
1414
ButtonElement?: React.Element<any>,
1515
testID?: string,
1616
};
@@ -20,7 +20,7 @@ export type HeaderButtonProps = {
2020
export type VisibleButtonProps = $Exact<{
2121
iconName?: string,
2222
title: string,
23-
buttonStyle?: StyleObj,
23+
buttonStyle?: ViewStyleProp,
2424

2525
IconComponent?: React.ComponentType<*>,
2626
iconSize?: number,
@@ -32,9 +32,13 @@ type OtherProps = {
3232
getButtonElement: VisibleButtonProps => React.Element<any>,
3333
};
3434

35-
export class HeaderButton extends React.PureComponent<
36-
HeaderButtonProps & VisibleButtonProps & OtherProps
37-
> {
35+
type Props = $Exact<{
36+
...$Exact<HeaderButtonProps>,
37+
...$Exact<VisibleButtonProps>,
38+
...$Exact<OtherProps>,
39+
}>;
40+
41+
export class HeaderButton extends React.PureComponent<Props> {
3842
static defaultProps = {
3943
background: Touchable.SelectableBackgroundBorderless(),
4044
};
@@ -52,7 +56,7 @@ export class HeaderButton extends React.PureComponent<
5256
IconComponent,
5357
iconSize,
5458
color,
55-
other,
59+
...other
5660
} = this.props;
5761

5862
const ButtonElement =

src/HeaderButtons.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*
2-
* @flow
3-
*/
2+
* @flow
3+
*/
44
import * as React from 'react';
55
import { HeaderButton, type HeaderButtonProps, type VisibleButtonProps } from './HeaderButton';
66
import { StyleSheet, Platform, View, Text } from 'react-native';
77
import { OverflowButton, type OverflowButtonProps, IS_IOS } from './OverflowButton';
8-
import type { StyleObj } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
8+
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
99

1010
const textTransformer = (label: string) =>
1111
IS_IOS ? label.charAt(0).toUpperCase() + label.substr(1) : label.toUpperCase();
@@ -32,7 +32,7 @@ export class Item extends React.Component<ItemProps> {
3232
type HeaderButtonsProps = {
3333
children: React.Node,
3434
left: boolean,
35-
overflowButtonWrapperStyle?: StyleObj,
35+
overflowButtonWrapperStyle?: ViewStyleProp,
3636
HeaderButtonComponent: React.ComponentType<*>,
3737
...$Exact<OverflowButtonProps>,
3838
};

src/OverflowButton.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* @flow
3-
*/
2+
* @flow
3+
*/
44
import * as React from 'react';
55
import {
66
View,
@@ -11,19 +11,19 @@ import {
1111
Platform,
1212
} from 'react-native';
1313
import { HeaderButton, type VisibleButtonProps } from './HeaderButton';
14-
import type { StyleObj } from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
14+
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
1515
export const OVERFLOW_BUTTON_TEST_ID = 'headerOverflowButton';
1616

1717
export const IS_IOS = Platform.OS === 'ios';
1818

1919
export type OverflowButtonProps = {
20-
OverflowIcon: React.Node,
20+
OverflowIcon: React.Element<*>,
2121
onOverflowMenuPress?: ({ hiddenButtons: Array<React.Element<*>> }) => any,
2222
};
2323

2424
type Props = {
2525
hiddenButtons: Array<React.Element<*>>,
26-
buttonWrapperStyle?: StyleObj,
26+
buttonWrapperStyle?: ViewStyleProp,
2727
...$Exact<OverflowButtonProps>,
2828
};
2929

0 commit comments

Comments
 (0)