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

the effect is not as expected. #905

Open
liuhongjian0316 opened this issue Jun 13, 2024 · 0 comments
Open

the effect is not as expected. #905

liuhongjian0316 opened this issue Jun 13, 2024 · 0 comments

Comments

@liuhongjian0316
Copy link

---first--- 
<TransitionGroup style={{ height: '100%' }}>
            <CSSTransition
              key={location.key}
              classNames="fade"
              timeout={500}
              style={{ height: '100%' }}
              unmountOnExit
            >
              <Routes>
                <Route path="/new-chat" element={
                  AINewChat()
                } />
                <Route path="/chat" element={
                  <div>默认的聊天页面</div>
                } />
                <Route path="/" element={
                  <div>默认的聊天页面</div>
                } />
              </Routes>
            </CSSTransition>
          </TransitionGroup>

---second---
<TransitionGroup style={{ height: '100%' }}>
            <CSSTransition
              key={location.key}
              classNames="fade"
              timeout={500}
              style={{ height: '100%' }}
              nodeRef={nodeRef}
              unmountOnExit
            >
              <div ref={nodeRef}>
                <Routes>
                  <Route path="/new-chat" element={
![bug](https://github.com/reactjs/react-transition-group/assets/45460278/0e90d3b0-021f-4c5c-97b5-309c2bee2d55)

                    AINewChat()
                  } />
                  <Route path="/chat" element={
                    <div>默认的聊天页面</div>
                  } />
                  <Route path="/" element={
                    <div>默认的聊天页面</div>
                  } />
                </Routes>
              </div>
            </CSSTransition>
          </TransitionGroup>

 .fade-enter {
  opacity: 0;
  transform: scale(0.9);
}

.fade-enter-active {
  opacity: 1;
  transform: scale(1);
  transition: opacity 500ms, transform 500ms;
}

.fade-exit {
  opacity: 1;
  transform: scale(1);
}

.fade-exit-active {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 500ms, transform 500ms;
}

excessive effect is inconsistent,
'first' although there is a 'findDOMNode is deprecated and will be removed in the next major release. Instead' warning, the effect is as expected.
'second' the effect of displaying the page twice
bug2
bug

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