Skip to content

Latest commit

 

History

History
42 lines (36 loc) · 905 Bytes

README.md

File metadata and controls

42 lines (36 loc) · 905 Bytes

material-ui-dialogs

Use

//--------------------- Simple helper functions -------------------//
async function main() {
	await muiDialogs.alert({
		title: 'My title',
		content: 'My message',
		okLabel: 'Ok'
	})
}
main()


//------------------------ with Redux Form -------------------------//
class TestReduxFormDialog extends PureComponent {
	formDialogRef = formDialog => {
		this.formDialog = formDialog;
	}
	
	showForm = async() => {
		const values = await this.formDialog.show();
		// values is null if the dialog was cancelled
		console.log("values", values);
	}
	
	render() {
		return (
			<FlatButton onTouchTap={this.showForm} label="ShowForm"/>
			<ReduxFormDialog
				ref={this.formDialogRef}
				title="Form Title"
			>
				<AnyReduxForm />
			</ReduxFormDialog>
		)
	}
}
// you can use the showForm function directly, but you'll have to provide the Redux store as an argument.