Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the modal be made aware of the calling component state #66

Open
mdodge-ecgrow opened this issue Apr 19, 2021 · 1 comment
Open

Can the modal be made aware of the calling component state #66

mdodge-ecgrow opened this issue Apr 19, 2021 · 1 comment

Comments

@mdodge-ecgrow
Copy link

mdodge-ecgrow commented Apr 19, 2021

I have a custom ui modal with 2 buttons yes/no. But I only want to enable the "yes" button when the user types in a word into an input box in the modal. I have a state variable that switches to true when the word is typed. But the button is not enabling. And I printed out the variable onto the modal as well and that is not changing.

Here is my modal code:

confirmAlert({
	customUI: ({ onClose }) => {
		return (
			<div className={'custom-ui-dialog'}>
				<h1>Confirm Complete Shift</h1>
				<div className={'body'}>
					<h3>
						Are you sure you want to complete the shift?
						<br />
						Type COMPLETE below to confirm.
					</h3>
					<input
						type={'text'}
						className={'form-control'}
						onChange={checkInput}
					/>
					<br />

					<div className={'buttons'}>
						<button onClick={onClose}>No</button>
						<button
							onClick={switchShifts}
							disabled={!completedTyped}
						>
							Yes
						</button>
					</div>
					{`completedTyped: ${completedTyped}`}
				</div>
			</div>
		);
	},
	closeOnEscape: false,
	closeOnClickOutside: false,
});
@rajeevnathverma
Copy link

HI,
anyone found this solutions ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants