{"size": 942, "ext": "js", "max_stars_repo_path": "components/Alert/Alert.js", "max_stars_repo_name": "812748665/teaset-pro", "max_stars_repo_stars_event_min_datetime": "2021-05-15T11:37:16.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-15T11:37:16.000Z", "max_issues_repo_path": "components/Alert/Alert.js", "max_issues_repo_name": "812748665/teaset-pro", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "components/Alert/Alert.js", "max_forks_repo_name": "812748665/teaset-pro", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.1538461538, "max_line_length": 121, "alphanum_fraction": 0.6125265393}
import React from 'react';

import Overlay from '../Overlay/Overlay';
import OperationView from './OperationView';
import AlertView from "./AlertView";

export default class Alert extends Overlay {

  static OperationView = OperationView;
  static AlertView = AlertView

  static alert(title, message, confirmItem, cancelItem, options = {}) {
    return super.show(
        <this.AlertView confirmItem={confirmItem} cancelItem={cancelItem} title={title} message={message} {...options} />
    );
  }

  static operation(items, cancelItem, options = {}) {
    return super.show(
        <this.OperationView items={items} cancelItem={cancelItem} {...options} />
    );
  }

  static show(title, submit = () => {}, content = null, cancel = () => {}, option = {}) {
    this.alert(title, content,
      {
        title: '确定',
        onPress: submit
      },
      {
        title: '取消',
        onPress: cancel
      },
      option
    )
  }

}
