UNPKG

@fruits-chain/react-native-xiaoshu

Version:
40 lines (34 loc) • 1.59 kB
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import React, { memo } from 'react'; import Portal from '../portal'; import StepSelectorView from './step-selector'; import StopSelectorMethod from './step-selector-method'; /** * 步骤选择 */ const StepSelector = opts => { return new Promise((resolve, reject) => { const key = Portal.add( /*#__PURE__*/React.createElement(StopSelectorMethod, _extends({}, opts, { onClosed: () => { var _opts$onClosed; Portal.remove(key); (_opts$onClosed = opts.onClosed) === null || _opts$onClosed === void 0 ? void 0 : _opts$onClosed.call(opts); }, onConfirm: (v, o, isEnd) => { var _opts$onConfirm; (_opts$onConfirm = opts.onConfirm) === null || _opts$onConfirm === void 0 ? void 0 : _opts$onConfirm.call(opts, v, o, isEnd); resolve(v); }, onCancel: () => { var _opts$onCancel; (_opts$onCancel = opts.onCancel) === null || _opts$onCancel === void 0 ? void 0 : _opts$onCancel.call(opts); reject(new Error()); } }))); }); }; StepSelector.Component = /*#__PURE__*/memo(props => { return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(StepSelectorView, props)); }); export default StepSelector; //# sourceMappingURL=index.js.map