Skip to content

Commit

Permalink
refactor: change the flow typing for functions (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
gawrysiak authored and satya164 committed May 6, 2018
1 parent 772b82a commit 9fd6db4
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
style?: any,
/**
* @optional
Expand Down
2 changes: 1 addition & 1 deletion src/components/Card/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* Content of the `Card`.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Checkbox.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* Custom color for checkbox.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* Custom color for unchecked checkbox.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dialog/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Props = {
/**
* Callback that is called when the user dismisses the dialog.
*/
onDismiss: Function,
onDismiss: () => mixed,
/**
* Determines Whether the dialog is visible.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/DrawerItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* Custom color for the drawer text and icon.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/FAB.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
style?: any,
/**
* @optional
Expand Down
2 changes: 1 addition & 1 deletion src/components/List/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* @optional
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Props = {
/**
* Callback that is called when the user dismisses the modal.
*/
onDismiss: Function,
onDismiss: () => mixed,
/**
* Determines Whether the modal is visible.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/components/RadioButton.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* Custom color for radio.
*/
Expand Down Expand Up @@ -75,9 +75,9 @@ class RadioButton extends React.Component<Props> {
onPress={
disabled
? undefined
: e => {
: () => {
context && context.onValueChange(this.props.value);
onPress && onPress(e);
onPress && onPress();
}
}
style={styles.container}
Expand Down
6 changes: 3 additions & 3 deletions src/components/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
/**
* Custom color for unchecked radio.
*/
Expand Down Expand Up @@ -169,9 +169,9 @@ class RadioButton extends React.Component<Props, State> {
onPress={
disabled
? undefined
: e => {
: () => {
context && context.onValueChange(this.props.value);
onPress && onPress(e);
onPress && onPress();
}
}
style={styles.container}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Searchbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Props = {
/**
* Callback to execute if we want the left icon to act as button.
*/
onIconPress?: Function,
onIconPress?: () => mixed,
style?: any,
/**
* @optional
Expand Down
4 changes: 2 additions & 2 deletions src/components/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ type Props = {
/**
* Callback that is called when the text input is focused.
*/
onFocus?: Function,
onFocus?: () => mixed,
/**
* Callback that is called when the text input is blurred.
*/
onBlur?: Function,
onBlur?: () => mixed,
/**
* Value of the text input.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/ToolbarAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
style?: any,
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/ToolbarBackAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
/**
* Function to execute on press.
*/
onPress?: Function,
onPress?: () => mixed,
style?: any,
};

Expand Down

0 comments on commit 9fd6db4

Please sign in to comment.