Skip to content

Commit e06380b

Browse files
ethansharM-i-k-e-l
andauthored
Fix random TS errors (#2314)
* Fix random TS errors * Update src/components/picker/PickerPresenter.ts Co-authored-by: Miki Leib <38354019+M-i-k-e-l@users.noreply.github.com> * Update src/components/picker/types.tsx Co-authored-by: Miki Leib <38354019+M-i-k-e-l@users.noreply.github.com> Co-authored-by: Miki Leib <38354019+M-i-k-e-l@users.noreply.github.com>
1 parent b472eb9 commit e06380b

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/components/image/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class Image extends PureComponent<Props, State> {
147147
if (Constants.isAndroid) {
148148
const {source} = this.props;
149149
const url = _.get(source, 'uri');
150-
const isGif = /(http(s?):)([/|.|\w|\s|-])*\.gif/.test(url);
150+
const isGif = /(http(s?):)([/|.|\w|\s|-])*\.gif/.test(url ?? '');
151151
return isGif;
152152
}
153153
}

src/components/picker/PickerItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Image from '../image';
1111
import Text from '../text';
1212
import {getItemLabel, isItemSelected} from './PickerPresenter';
1313
import PickerContext from './PickerContext';
14-
import {PickerItemProps} from './types';
14+
import {PickerItemProps, PickerSingleValue} from './types';
1515

1616
/**
1717
* @description: Picker.Item, for configuring the Picker's selectable options
@@ -64,7 +64,7 @@ const PickerItem = (props: PickerItemProps) => {
6464
if (migrate) {
6565
context.onPress(value);
6666
} else {
67-
context.onPress(typeof value === 'object' || context.isMultiMode ? value : {value, label: itemLabel});
67+
context.onPress(typeof value === 'object' || context.isMultiMode ? value : ({value, label: itemLabel}) as PickerSingleValue);
6868
}
6969
}, [migrate, value, context.onPress]);
7070

src/components/picker/PickerPresenter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ export function getItemLabel(label: string, value: PickerValue, getItemLabel: Pi
4545
return label;
4646
}
4747

48-
export function shouldFilterOut(searchValue: string, itemLabel: string) {
48+
export function shouldFilterOut(searchValue: string, itemLabel?: string) {
4949
return !_.includes(_.lowerCase(itemLabel), _.lowerCase(searchValue));
5050
}

src/components/picker/types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export type PickerBaseProps = Omit<TextFieldProps, 'value' | 'onChange'> &
9494
renderItem?: (
9595
value: PickerValue,
9696
itemProps: PickerItemProps & {isSelected: boolean; isItemDisabled: boolean},
97-
label: string
97+
label?: string
9898
) => React.ReactElement;
9999
/**
100100
* Render custom picker modal (e.g ({visible, children, toggleModal}) => {...})

0 commit comments

Comments
 (0)