import * as React from "react"; import { BasePromptProps } from "./view.pc"; export type Props = { label: string; onOk?: any; onCancel?: any; defaultValue?: string; }; type State = { value: string; }; export default (Base: React.ComponentClass) => class PromptController extends React.PureComponent { constructor(props: Props) { super(props); this.state = { value: props.defaultValue }; } onOk = () => { this.props.onOk(this.state.value); }; onInputChange = value => { this.setState({ ...this.state, value }); }; render() { const { label, onCancel, defaultValue } = this.props; const { onInputChange, onOk } = this; return ( ); } };