Skip to content

Commit 2ae2dc5

Browse files
committed
change Function type to a more elaborate function type
1 parent 4ac54cf commit 2ae2dc5

File tree

14 files changed

+23
-23
lines changed

14 files changed

+23
-23
lines changed

generatedTypes/components/button/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export declare type ButtonPropTypes = TextPropTypes & TypographyModifiers & Colo
3838
/**
3939
* Actions handler
4040
*/
41-
onPress?: Function;
41+
onPress?: (props: any) => void;
4242
/**
4343
* Disable interactions for the component
4444
*/
@@ -95,7 +95,7 @@ export declare type ButtonPropTypes = TextPropTypes & TypographyModifiers & Colo
9595
* callback for getting activeBackgroundColor (e.g. (calculatedBackgroundColor, prop) => {...})
9696
* better set using ThemeManager
9797
*/
98-
getActiveBackgroundColor?: Function;
98+
getActiveBackgroundColor?: (backgroundColor: string, props: any) => string;
9999
/**
100100
* should animate layout change
101101
* Note?: For Android you must set 'setLayoutAnimationEnabledExperimental(true)' via RN's 'UIManager'
@@ -289,7 +289,7 @@ declare class Button extends PureComponent<Props, ButtonState> {
289289
get isFilled(): boolean;
290290
get isIconButton(): boolean | 0 | undefined;
291291
getBackgroundColor(): any;
292-
getActiveBackgroundColor(): any;
292+
getActiveBackgroundColor(): string | undefined;
293293
getLabelColor(): string | undefined;
294294
getLabelSizeStyle(): object;
295295
getContainerSizeStyle(): any;

generatedTypes/components/checkbox/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ interface CheckboxProps {
88
/**
99
* Invoked with the new value when the value changes.
1010
*/
11-
onValueChange?: Function;
11+
onValueChange?: (value: boolean) => void;
1212
/**
1313
* Whether the checkbox should be disabled
1414
*/

generatedTypes/components/image/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { PureComponent } from 'react';
2-
import { ImageProps as RNImageProps } from 'react-native';
2+
import { ImageProps as RNImageProps, ImageSourcePropType } from 'react-native';
33
import { ForwardRefInjectedProps } from '../../commons/new';
44
import { OverlayTypeType } from '../overlay';
55
declare type ImageProps = RNImageProps & {
66
/**
77
* custom source transform handler for manipulating the image source (great for size control)
88
*/
9-
sourceTransformer?: Function;
9+
sourceTransformer?: (props: any) => ImageSourcePropType;
1010
/**
1111
* if provided image source will be driven from asset name
1212
*/
@@ -62,7 +62,7 @@ declare class Image extends PureComponent<Props> {
6262
BOTTOM: string;
6363
SOLID: string;
6464
};
65-
sourceTransformer?: Function;
65+
sourceTransformer?: (props: any) => ImageSourcePropType;
6666
constructor(props: Props);
6767
isGif(): boolean | undefined;
6868
shouldUseImageBackground(): boolean;

generatedTypes/components/radioButton/RadioButton.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface RadioButtonPropTypes {
1212
/**
1313
* Invoked when pressing the button
1414
*/
15-
onPress?: Function;
15+
onPress?: (selected: boolean) => void;
1616
/**
1717
* Whether the radio button should be disabled
1818
*/

generatedTypes/components/radioButton/RadioGroup.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface RadioGroupPropTypes {
77
/**
88
* Invoked once when value changes, by selecting one of the radio buttons in the group
99
*/
10-
onValueChange?: Function;
10+
onValueChange?: (value: string | number | boolean) => void;
1111
}
1212
declare const _default: React.ComponentType<RadioGroupPropTypes>;
1313
export default _default;

generatedTypes/components/radioButton/RadioGroupContext.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface RadioGroupContextPropTypes {
77
/**
88
* Invoked once when value changes, by selecting one of the radio buttons in the group
99
*/
10-
onValueChange?: Function;
10+
onValueChange?: (value: string | number | boolean) => void;
1111
}
1212
declare const _default: React.Context<RadioGroupContextPropTypes>;
1313
export default _default;

generatedTypes/incubator/TouchableOpacity.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ declare type TouchableOpacityPropTypes = {
2020
/**
2121
* Callback for when tapping the touchable
2222
*/
23-
onPress: Function;
23+
onPress: (props: any) => void;
2424
/**
2525
* Callback for when long pressing the touchable
2626
*/
27-
onLongPress: Function;
27+
onLongPress: (props: any) => void;
2828
/**
2929
* Pass controlled pressState to track gesture state changes
3030
*/

src/components/button/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export type ButtonPropTypes = TextPropTypes &
5858
/**
5959
* Actions handler
6060
*/
61-
onPress?: Function;
61+
onPress?: (props: any) => void;
6262
/**
6363
* Disable interactions for the component
6464
*/
@@ -115,7 +115,7 @@ export type ButtonPropTypes = TextPropTypes &
115115
* callback for getting activeBackgroundColor (e.g. (calculatedBackgroundColor, prop) => {...})
116116
* better set using ThemeManager
117117
*/
118-
getActiveBackgroundColor?: Function;
118+
getActiveBackgroundColor?: (backgroundColor: string, props: any) => string;
119119
/**
120120
* should animate layout change
121121
* Note?: For Android you must set 'setLayoutAnimationEnabledExperimental(true)' via RN's 'UIManager'

src/components/checkbox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface CheckboxProps {
2020
/**
2121
* Invoked with the new value when the value changes.
2222
*/
23-
onValueChange?: Function;
23+
onValueChange?: (value: boolean) => void;
2424
/**
2525
* Whether the checkbox should be disabled
2626
*/

src/components/image/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import _ from 'lodash';
22
import React, {PureComponent} from 'react';
33
//@ts-ignore
44
import hoistNonReactStatic from 'hoist-non-react-statics';
5-
import {Image as RNImage, ImageProps as RNImageProps, StyleSheet, ImageBackground} from 'react-native';
5+
import {Image as RNImage, ImageProps as RNImageProps, StyleSheet, ImageBackground, ImageSourcePropType} from 'react-native';
66
import Constants from '../../helpers/Constants';
77
import {asBaseComponent, forwardRef, ForwardRefInjectedProps} from '../../commons/new';
88
// @ts-ignore
@@ -13,7 +13,7 @@ type ImageProps = RNImageProps & {
1313
/**
1414
* custom source transform handler for manipulating the image source (great for size control)
1515
*/
16-
sourceTransformer?: Function;
16+
sourceTransformer?: (props: any) => ImageSourcePropType;
1717
/**
1818
* if provided image source will be driven from asset name
1919
*/
@@ -69,7 +69,7 @@ class Image extends PureComponent<Props> {
6969

7070
public static overlayTypes = Overlay.overlayTypes;
7171

72-
sourceTransformer?: Function;
72+
sourceTransformer?: (props: any) => ImageSourcePropType;
7373

7474
constructor(props: Props) {
7575
super(props);

src/components/radioButton/RadioButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface RadioButtonPropTypes {
3535
/**
3636
* Invoked when pressing the button
3737
*/
38-
onPress?: Function;
38+
onPress?: (selected: boolean) => void;
3939
/**
4040
* Whether the radio button should be disabled
4141
*/

src/components/radioButton/RadioGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface RadioGroupPropTypes {
1212
/**
1313
* Invoked once when value changes, by selecting one of the radio buttons in the group
1414
*/
15-
onValueChange?: Function;
15+
onValueChange?: (value: string | number | boolean) => void;
1616
}
1717

1818
interface RadioGroupState {

src/components/radioButton/RadioGroupContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface RadioGroupContextPropTypes {
88
/**
99
* Invoked once when value changes, by selecting one of the radio buttons in the group
1010
*/
11-
onValueChange?: Function;
11+
onValueChange?: (value: string | number | boolean) => void;
1212
}
1313

1414
type PropTypes = RadioGroupContextPropTypes;

src/incubator/TouchableOpacity.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ type TouchableOpacityPropTypes = {
4646
/**
4747
* Callback for when tapping the touchable
4848
*/
49-
onPress: Function;
49+
onPress: (props: any) => void;
5050
/**
5151
* Callback for when long pressing the touchable
5252
*/
53-
onLongPress: Function;
53+
onLongPress: (props: any) => void;
5454
/**
5555
* Pass controlled pressState to track gesture state changes
5656
*/

0 commit comments

Comments
 (0)