0

我想在 ActionSheet 按钮中显示带有标题的图像,如下所示:

在此处输入图像描述

我正在使用的代码是

var BUTTONS = [
  'Investigated and Resolved',
  'Under Investigation',
  'Action Required',
  'Urgent Action Required',
  // 'Delete',
  'Cancel',
];
var CANCEL_INDEX = 4;

showActionSheet = () => {
    ActionSheet.showActionSheetWithOptions({
        title: 'Flag the status of the event',
        options: BUTTONS,
        cancelButtonIndex: CANCEL_INDEX,
      },
      (buttonIndex) => {
        this.setState({ clicked: BUTTONS[buttonIndex] });
      });
  }

有没有办法设置文本样式或添加图像?

4

2 回答 2

2

为上述所需功能找到了这个库。它适用于安卓和iOS。

反应本机操作表

我们还可以根据我们的设计自定义操作表的每个组件。

于 2017-10-13T04:36:59.307 回答
0

ActionSheetIOS 正在实现本机 UIAlertController,它不允许您自定义文本或向按钮添加图像。至少不是以非 hacky 的方式,而且您肯定无法通过 ActionSheetIOS 做到这一点。

您很可能必须使用自定义 JS 实现,例如 react-native-actionsheet。

于 2017-10-11T20:39:41.457 回答