Skip to content

Commit

Permalink
defaulting open to false and letting the effect set the default openi…
Browse files Browse the repository at this point in the history
…ng state
  • Loading branch information
Eitan Elbaz committed Jun 28, 2023
1 parent 93ce52f commit ced6144
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/ReactGrandTour.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import React, { useMemo, useCallback, useState, PropsWithChildren, useEffect } from 'react';
import styles from './styles';
import {
ComponentOverrides,
ComponentVisibility,
ReactGrandTourCloseReason,
ReactGrandTourProps,
ReactGrandTourStep,
} from './types';
import { ReactGrandTourCloseReason, ReactGrandTourProps, ReactGrandTourStep } from './types';
import {
Arrow,
CurrentStepLabel,
Expand All @@ -21,7 +15,7 @@ import {
} from './components';
import ReactGrandTourContext from './Context';

type Props = PropsWithChildren<ReactGrandTourProps & Partial<ComponentOverrides>>;
type Props = PropsWithChildren<ReactGrandTourProps>;

const defaultShortcuts = {
closeModal: ['Escape'],
Expand Down Expand Up @@ -61,7 +55,7 @@ const ReactGrandTour: React.FC<Props> = ({
hidePreviousStepButton,
hideStepButtons,
}) => {
const [open, setOpen] = useState(defaultOpen);
const [open, setOpen] = useState(false);
const [currentIndex, setCurrentIndex] = useState(openAt);
const [steps, setSteps] = useState(defaultSteps);
const allSteps = useMemo(() => steps.map((_, i) => i), [steps]);
Expand Down

0 comments on commit ced6144

Please sign in to comment.