Skip to content

Commit ab60fff

Browse files
authored
Fix various typing issues (#1291)
* Fix various typing issues * Omit RNText style for our own style prop
1 parent dc79399 commit ab60fff

File tree

8 files changed

+3665
-45
lines changed

8 files changed

+3665
-45
lines changed

generatedTypes/components/button/ButtonTypes.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ImageStyle, TextStyle, StyleProp } from 'react-native';
22
import { BaseComponentInjectedProps, ForwardRefInjectedProps, TypographyModifiers, ColorsModifiers, BackgroundColorModifier, MarginModifiers } from '../../commons/new';
33
import { TouchableOpacityProps } from '../touchableOpacity';
44
import { TextProps } from '../text';
5+
import { ImageProps } from '../image';
56
export declare enum ButtonSize {
67
xSmall = "xSmall",
78
small = "small",
@@ -25,7 +26,7 @@ export declare type ButtonProps = TouchableOpacityProps & TypographyModifiers &
2526
/**
2627
* Icon image source or a callback function that returns a source
2728
*/
28-
iconSource?: object | number | Function;
29+
iconSource?: ImageProps['source'] | Function;
2930
/**
3031
* Icon image style
3132
*/

generatedTypes/components/button/index.d.ts

Lines changed: 1828 additions & 20 deletions
Large diffs are not rendered by default.

generatedTypes/components/card/CardSection.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export declare type CardSectionProps = ViewProps & {
4040
/**
4141
* Other image props that will be passed to the image
4242
*/
43-
imageProps?: ImageProps;
43+
imageProps?: Partial<ImageProps>;
4444
};
4545
declare const _default: React.ComponentClass<ViewProps & {
4646
/**
@@ -76,7 +76,7 @@ declare const _default: React.ComponentClass<ViewProps & {
7676
/**
7777
* Other image props that will be passed to the image
7878
*/
79-
imageProps?: ImageProps | undefined;
79+
imageProps?: Partial<ImageProps> | undefined;
8080
} & {
8181
useCustomTheme?: boolean | undefined;
8282
}, any>;

generatedTypes/components/text/index.d.ts

Lines changed: 459 additions & 6 deletions
Large diffs are not rendered by default.

generatedTypes/incubator/TextField/usePreset.d.ts

Lines changed: 1368 additions & 12 deletions
Large diffs are not rendered by default.

src/components/button/ButtonTypes.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '../../commons/new';
1111
import {TouchableOpacityProps} from '../touchableOpacity';
1212
import {TextProps} from '../text';
13+
import {ImageProps} from '../image';
1314

1415
export enum ButtonSize {
1516
xSmall = 'xSmall',
@@ -40,7 +41,7 @@ export type ButtonProps = TouchableOpacityProps &
4041
/**
4142
* Icon image source or a callback function that returns a source
4243
*/
43-
iconSource?: object | number | Function;
44+
iconSource?: ImageProps['source'] | Function;
4445
/**
4546
* Icon image style
4647
*/

src/components/card/CardSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type CardSectionProps = ViewProps & {
4444
/**
4545
* Other image props that will be passed to the image
4646
*/
47-
imageProps?: ImageProps;
47+
imageProps?: Partial<ImageProps>;
4848
};
4949

5050
type Props = CardSectionProps & asCardChildProps;

src/components/text/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, {PureComponent} from 'react';
2-
import {Text as RNText, StyleSheet, TextProps as RNTextProps, TextStyle, Animated} from 'react-native';
2+
import {Text as RNText, StyleSheet, TextProps as RNTextProps, TextStyle, Animated, StyleProp} from 'react-native';
33
import _ from 'lodash';
44
import {
55
asBaseComponent,
@@ -12,7 +12,7 @@ import {
1212
} from '../../commons/new';
1313
import {Colors} from 'style';
1414

15-
export type TextProps = RNTextProps & TypographyModifiers & ColorsModifiers & MarginModifiers & {
15+
export type TextProps = Omit<RNTextProps, 'style'> & TypographyModifiers & ColorsModifiers & MarginModifiers & {
1616
/**
1717
* color of the text
1818
*/
@@ -38,6 +38,7 @@ export type TextProps = RNTextProps & TypographyModifiers & ColorsModifiers & Ma
3838
*/
3939
animated?: boolean;
4040
textAlign?: string;
41+
style?: StyleProp<TextStyle | Animated.AnimatedProps<TextStyle>>;
4142
}
4243
export type TextPropTypes = TextProps; //TODO: remove after ComponentPropTypes deprecation;
4344

0 commit comments

Comments
 (0)