Skip to content

Commit 4869105

Browse files
authored
fix/chip_ts_issue (#1047)
* fix/chip_ts_issue * omit source from ImageProps in chip's iconProps * import ImageProps from uilib, remove some ignores
1 parent 827ccb7 commit 4869105

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

generatedTypes/components/chip/index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React from 'react';
2-
import { StyleProp, ViewStyle, ViewProps, ImageStyle, ImageProps, TextStyle, ImageSourcePropType } from 'react-native';
2+
import { StyleProp, ViewStyle, ViewProps, ImageStyle, TextStyle, ImageSourcePropType } from 'react-native';
33
import { AvatarProps } from '../avatar';
44
import { BadgeProps } from '../badge';
5+
import { ImageProps } from '../image';
56
import { TouchableOpacityProps } from '../touchableOpacity';
67
export declare type ChipProps = ViewProps & TouchableOpacityProps & {
78
/**
@@ -58,7 +59,7 @@ export declare type ChipProps = ViewProps & TouchableOpacityProps & {
5859
/**
5960
* Additional icon props
6061
*/
61-
iconProps?: ImageProps;
62+
iconProps?: Omit<ImageProps, 'source'>;
6263
/**
6364
* Icon style
6465
*/
@@ -160,7 +161,7 @@ declare const _default: React.ComponentClass<ViewProps & Pick<import("react-nati
160161
/**
161162
* Additional icon props
162163
*/
163-
iconProps?: ImageProps | undefined;
164+
iconProps?: Pick<ImageProps, "margin" | "marginL" | "marginT" | "marginR" | "marginB" | "marginH" | "marginV" | "style" | "testID" | "onLayout" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityStates" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityComponentType" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityTraits" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "width" | "height" | "borderRadius" | "borderBottomLeftRadius" | "borderBottomRightRadius" | "borderTopLeftRadius" | "borderTopRightRadius" | "aspectRatio" | "onError" | "onLoad" | "onLoadEnd" | "onLoadStart" | "progressiveRenderingEnabled" | "resizeMode" | "resizeMethod" | "loadingIndicatorSource" | "defaultSource" | "blurRadius" | "capInsets" | "onProgress" | "onPartialLoad" | "fadeDuration" | "cover" | "sourceTransformer" | "assetName" | "assetGroup" | "tintColor" | "supportRTL" | "overlayType" | "overlayColor" | "customOverlayContent"> | undefined;
164165
/**
165166
* Icon style
166167
*/

src/components/chip/index.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
import _ from 'lodash';
22
import React, {useCallback} from 'react';
3-
import {StyleSheet, StyleProp, ViewStyle, ViewProps, ImageStyle, ImageProps, TextStyle, ImageSourcePropType} from 'react-native';
4-
// @ts-ignore
3+
import {StyleSheet, StyleProp, ViewStyle, ViewProps, ImageStyle, TextStyle, ImageSourcePropType} from 'react-native';
54
import Assets from '../../assets';
65
import {asBaseComponent} from '../../commons/new';
76
import {BorderRadiuses, Spacings} from '../../style';
8-
// @ts-ignore
97
import Avatar, {AvatarProps} from '../avatar';
10-
// @ts-ignore
118
import Badge, {BadgeProps, BADGE_SIZES} from '../badge';
12-
import Image from '../image';
9+
import Image, {ImageProps} from '../image';
1310
import Text from '../text';
1411
import TouchableOpacity, {TouchableOpacityProps} from '../touchableOpacity';
1512
import View from '../view';
@@ -76,7 +73,7 @@ export type ChipProps = ViewProps & TouchableOpacityProps & {
7673
/**
7774
* Additional icon props
7875
*/
79-
iconProps?: ImageProps
76+
iconProps?: Omit<ImageProps, 'source'>;
8077
/**
8178
* Icon style
8279
*/
@@ -213,7 +210,6 @@ const Chip = ({
213210
<Text
214211
text90M
215212
numberOfLines={1}
216-
// @ts-ignore
217213
style={[styles.label, getMargins('label'), labelStyle]}
218214
testID={`${testID}.label`}
219215
>

0 commit comments

Comments
 (0)