Update Options Dialog to support Icon

This commit is contained in:
docjyJ 2020-09-02 14:42:00 +02:00
parent a9a2b9150b
commit 2f94be64e5

View file

@ -6,6 +6,7 @@ import {FlatList} from 'react-native';
export type OptionsDialogButtonType = {
title: string,
icon?: string,
onPress: () => void,
};
@ -19,10 +20,19 @@ type PropsType = {
class OptionsDialog extends React.PureComponent<PropsType> {
getButtonRender = ({item}: {item: OptionsDialogButtonType}): React.Node => {
return <Button onPress={item.onPress}>{item.title}</Button>;
return (
<Button onPress={item.onPress} icon={item.icon}>
{item.title}
</Button>
);
};
keyExtractor = (item: OptionsDialogButtonType): string => item.title;
keyExtractor = (item: OptionsDialogButtonType): string => {
if (item.icon != null) {
return item.title + item.icon;
}
return item.title;
};
render(): React.Node {
const {props} = this;