Update Options Dialog to support Icon
這個提交存在於:
父節點
a9a2b9150b
當前提交
2f94be64e5
共有 1 個檔案被更改,包括 12 行新增 和 2 行删除
|
@ -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;
|
||||
|
|
載入中…
新增問題並參考