Update Options Dialog to support Icon
这个提交包含在:
父节点
a9a2b9150b
当前提交
2f94be64e5
共有 1 个文件被更改,包括 12 次插入 和 2 次删除
|
@ -6,6 +6,7 @@ import {FlatList} from 'react-native';
|
||||||
|
|
||||||
export type OptionsDialogButtonType = {
|
export type OptionsDialogButtonType = {
|
||||||
title: string,
|
title: string,
|
||||||
|
icon?: string,
|
||||||
onPress: () => void,
|
onPress: () => void,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,10 +20,19 @@ type PropsType = {
|
||||||
|
|
||||||
class OptionsDialog extends React.PureComponent<PropsType> {
|
class OptionsDialog extends React.PureComponent<PropsType> {
|
||||||
getButtonRender = ({item}: {item: OptionsDialogButtonType}): React.Node => {
|
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 {
|
render(): React.Node {
|
||||||
const {props} = this;
|
const {props} = this;
|
||||||
|
|
正在加载…
在新工单中引用