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

Typwriter not typing in react-modal #178

Open
mdodge-ecgrow opened this issue Mar 23, 2023 · 1 comment
Open

Typwriter not typing in react-modal #178

mdodge-ecgrow opened this issue Mar 23, 2023 · 1 comment

Comments

@mdodge-ecgrow
Copy link

I'm not sure why I'm not seeing any text typing in my app. I have a react-modal component that I want to start typing as soon at it is open.

Here is the complete component:

import ReactModal from 'react-modal';
import { ModalStyles } from '../assets/styles/ModalStyles';
import PuffLoader from 'react-spinners/PuffLoader';
import Typewriter from 'typewriter-effect/dist/core';
import CloseButton from './CloseButton';

const ProgressModal = (props: {
	openProgressModal: boolean;
	setOpenProgressModal: React.Dispatch<React.SetStateAction<boolean>>;
}) => {
	const { openProgressModal, setOpenProgressModal } = props;

	var firstTypewriter = new (Typewriter as any)(
		document.querySelector('.type-first'),
		{ devMode: true }
	);
	const typeFirstProgress = () => {
		firstTypewriter
			.typeString('Duplicating the Sermon Slides template file: ')
			.start();
	};

	return (
		<ReactModal
			isOpen={openProgressModal}
			style={ModalStyles}
			className={'progress-modal'}
			closeTimeoutMS={1000}
			onAfterOpen={typeFirstProgress}
		>
			<CloseButton setOpenModal={setOpenProgressModal} />
			<div className={'d-flex flex-column align-items-center my-4'}>
				<PuffLoader color="#36d7b7" size={150} />
				<div className={'progress-text p-3'}>
					<div className="type-first"></div>
					<div className="second"></div>
				</div>
			</div>
		</ReactModal>
	);
};

export default ProgressModal;

In my console with devMode on, I see a whole bunch of these:
image

@mdodge-ecgrow
Copy link
Author

I just tested it on the main page outside of the modal and it seems to work fine there.

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

1 participant