From 9fd6db4ec7c958259f23860b9ff6c227728f645b Mon Sep 17 00:00:00 2001 From: Grzegorz Gawrysiak Date: Sun, 6 May 2018 17:23:53 +0200 Subject: [PATCH] refactor: change the flow typing for functions (#351) --- src/components/Button.js | 2 +- src/components/Card/Card.js | 2 +- src/components/Checkbox.ios.js | 2 +- src/components/Checkbox.js | 2 +- src/components/Dialog/Dialog.js | 2 +- src/components/DrawerItem.js | 2 +- src/components/FAB.js | 2 +- src/components/List/ListItem.js | 2 +- src/components/Modal.js | 2 +- src/components/RadioButton.ios.js | 6 +++--- src/components/RadioButton.js | 6 +++--- src/components/Searchbar.js | 2 +- src/components/TextInput.js | 4 ++-- src/components/Toolbar/ToolbarAction.js | 2 +- src/components/Toolbar/ToolbarBackAction.js | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/components/Button.js b/src/components/Button.js index 203c63d9ce..c9523dea97 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -54,7 +54,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, style?: any, /** * @optional diff --git a/src/components/Card/Card.js b/src/components/Card/Card.js index 64784c0262..9991bdd8ee 100644 --- a/src/components/Card/Card.js +++ b/src/components/Card/Card.js @@ -21,7 +21,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * Content of the `Card`. */ diff --git a/src/components/Checkbox.ios.js b/src/components/Checkbox.ios.js index c2bc5fa166..31436686e8 100644 --- a/src/components/Checkbox.ios.js +++ b/src/components/Checkbox.ios.js @@ -20,7 +20,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * Custom color for checkbox. */ diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js index e577bebff2..6c6a19f0e5 100644 --- a/src/components/Checkbox.js +++ b/src/components/Checkbox.js @@ -20,7 +20,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * Custom color for unchecked checkbox. */ diff --git a/src/components/Dialog/Dialog.js b/src/components/Dialog/Dialog.js index 7b8b297209..d8f021f7ba 100644 --- a/src/components/Dialog/Dialog.js +++ b/src/components/Dialog/Dialog.js @@ -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. */ diff --git a/src/components/DrawerItem.js b/src/components/DrawerItem.js index 6b053fcf38..aba1097a29 100644 --- a/src/components/DrawerItem.js +++ b/src/components/DrawerItem.js @@ -26,7 +26,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * Custom color for the drawer text and icon. */ diff --git a/src/components/FAB.js b/src/components/FAB.js index 72161c4e5f..637710d0ce 100644 --- a/src/components/FAB.js +++ b/src/components/FAB.js @@ -31,7 +31,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, style?: any, /** * @optional diff --git a/src/components/List/ListItem.js b/src/components/List/ListItem.js index b671f698a6..dfa4341440 100644 --- a/src/components/List/ListItem.js +++ b/src/components/List/ListItem.js @@ -30,7 +30,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * @optional */ diff --git a/src/components/Modal.js b/src/components/Modal.js index ec36b15d83..c18d1545ef 100644 --- a/src/components/Modal.js +++ b/src/components/Modal.js @@ -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. */ diff --git a/src/components/RadioButton.ios.js b/src/components/RadioButton.ios.js index 4b1264d21f..56037d4b2e 100644 --- a/src/components/RadioButton.ios.js +++ b/src/components/RadioButton.ios.js @@ -25,7 +25,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * Custom color for radio. */ @@ -75,9 +75,9 @@ class RadioButton extends React.Component { onPress={ disabled ? undefined - : e => { + : () => { context && context.onValueChange(this.props.value); - onPress && onPress(e); + onPress && onPress(); } } style={styles.container} diff --git a/src/components/RadioButton.js b/src/components/RadioButton.js index 5d4768c9b1..545a78f6ca 100644 --- a/src/components/RadioButton.js +++ b/src/components/RadioButton.js @@ -24,7 +24,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, /** * Custom color for unchecked radio. */ @@ -169,9 +169,9 @@ class RadioButton extends React.Component { onPress={ disabled ? undefined - : e => { + : () => { context && context.onValueChange(this.props.value); - onPress && onPress(e); + onPress && onPress(); } } style={styles.container} diff --git a/src/components/Searchbar.js b/src/components/Searchbar.js index 075a3e0995..c6fef10812 100644 --- a/src/components/Searchbar.js +++ b/src/components/Searchbar.js @@ -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 diff --git a/src/components/TextInput.js b/src/components/TextInput.js index 5730822409..e5c61f1d3f 100644 --- a/src/components/TextInput.js +++ b/src/components/TextInput.js @@ -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. */ diff --git a/src/components/Toolbar/ToolbarAction.js b/src/components/Toolbar/ToolbarAction.js index 9ec990e808..3b5c2395c2 100644 --- a/src/components/Toolbar/ToolbarAction.js +++ b/src/components/Toolbar/ToolbarAction.js @@ -27,7 +27,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, style?: any, }; diff --git a/src/components/Toolbar/ToolbarBackAction.js b/src/components/Toolbar/ToolbarBackAction.js index 90dee5e4e2..5d99f0b504 100644 --- a/src/components/Toolbar/ToolbarBackAction.js +++ b/src/components/Toolbar/ToolbarBackAction.js @@ -18,7 +18,7 @@ type Props = { /** * Function to execute on press. */ - onPress?: Function, + onPress?: () => mixed, style?: any, };