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

Transition not working #35

Open
kulame opened this issue Apr 3, 2023 · 2 comments
Open

Transition not working #35

kulame opened this issue Apr 3, 2023 · 2 comments

Comments

@kulame
Copy link

kulame commented Apr 3, 2023

hi this is my democode
https://github.com/kulame/solid-demo/blob/master/src/Search.tsx

<Transition
        enterClass="transition ease-in-out duration-1000"
        exitToClass="opacity-100 translate-y-0"
      >
        <Show when={modalOpen()} fallback={<></>}>
   </Show>
</Transition>

Why doesn't the window still not disappear after I clicked outside ?

In addition, the animation effect of Transition never appears after I click. Is it because I am using it incorrectly?

@mreid21
Copy link

mreid21 commented May 4, 2023

<Transition
  enterActiveClass="transition ease-in-out duration-1000"
  exitActiveClass="transition ease-in-out duration-1000"
  enterClass="opacity-0"
  enterToClass="opacity-1"
  exitToClass="opacity-0"
  <Show when={modalOpen()}>
	  ...
  </Show>
</Transition>

Per the documentation enter class is "CSS class applied to the entering element at the start of the enter transition, and removed the frame after. Defaults to "s-enter"/." So you really want to apply the transition properties on enterActiveClass and leaveActiveClass. The code above will transition your search component from opacity 0 to 1 on enter and leave.

  • enterToClass is where you want it to end up when it transitions in.
  • exitToClass is where you want it to end up when it transitions out.

Someone can correct me if I'm skipping over any important details or caveats here.
Hope this helps!

@blood1shot
Copy link

@mreid21 solution works perfectly! Here is my code that uses css module

  <Portal>
    <Transition
      enterActiveClass={styles["fade--active"]}
      exitActiveClass={styles["fade--active"]}
      enterClass={styles["opacity-0"]}
      enterToClass={styles["opacity-1"]}
      exitToClass={styles["opacity-0"]}
    >
      <Show when={props.isOpen}>
        ...
      </Show>
    </Transition>
  </Portal>

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

3 participants