I am having an issue with framer-motion AnimatePresence component. I am trying to start the animation after the component is visible within the viewport, to achieve this, I used react-intersection-observer. It works as intended for the starting animation, but the exit animation breaks and I am not sure what is causing the problem. I created a sandbox that reproduces this behavior at https://codesandbox.io/s/holy-dream-rb5gu?file=/src/index.js
Framer motion Animate Presence exit issue
7.9k Views Asked by paul At
1
There are 1 best solutions below
Related Questions in REACTJS
- What is `_dereq_()` inside React?
- React TypeError: React.renderComponent is not a function
- React - saving a component in the ref callback
- React Rails component: manually triggering a re-render
- React, ES6 - getInitialState was defined on a plain JavaScript class
- How to get multiple selected options value in React JS?
- React.render replace container instead of inserting into
- reactjs datagrid use html
- props is not initialized in react component
- How to display xml data using Reactjs
- hooking up the data model in ReactJS - syntax
- ReactJS: How to use an immutable empty array or object
- How to use Sinon.js FakeXMLHttpRequest with superagent?
- React select onChange is not working
- ReactJS - Tutorial Comment System > Threaded commenting
Related Questions in FRAMER-MOTION
- How do you transition framer motion values?
- animation routes with framer motion
- How to use animation multiple times in framer motion
- How to detect certain scroll position with framer-motion?
- Framer motion prevent children from parent's animation
- How to use multiple 'useInView' hooks in the same react component?
- Next JS Framer Motion Fade Out
- framer-motion exit affter few seconds
- How to achieve full-page animation on scroll using Framer Motion, Complex layouts changes?
- Framer Motion/React- Inline styles by framer persisting after new variant is passed to the motion component
- Styling framer-motion-carousel in React
- Where to put AnimatePresence in NextJs 13.4
- Framer motion mode=wait not working on Child Component?
- scroll snap behaviour with transform
- How to dynamically change CSS Filter Property in Next.js with Framer Motion
Related Questions in REACT-INTERSECTION-OBSERVER
- Framer Motion/React- Inline styles by framer persisting after new variant is passed to the motion component
- React-Intersection-Observer running into infintite loop giving "Maximum update depth exceeded." in nextjs 14 app directory
- react-intersection-observer only works with the last elements
- Why does a react component, tested with React Testing Library has issue with react-intersection-observer?
- Framer motion Animate Presence exit issue
- Trying to implement react-intersection-observer inside react-grid-layout with no luck
- Type 'MutableRefObject<null>' is missing the following properties from type 'Element'
- React ref.current is undefined in useLayoutEffect
- How to change viewport from browser window to my declared component when using react-intersection-observer?
- Stagger divswhen they are in view using react-intersection-observer and framer-motion
- How to restrict the first fetch call to happen only when the view is visible in the viewport
- React & Typescript Issue: trigger elements with InsertionObserver using props and manage them in other component
- React useInView triggers before Element is in view
- react-intersection-observer not working mobile view
- Intersection Observer API going into infinite rendering loop
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It looks like using the imperative AnimationControls API is overriding the other declarative animation settings for the element (like
exit).Changing that
animateprop to just accept a variant instead of an animation control seems to work:Code Sandbox example
I added a state for the current variant. Starts as
hiddenand updates tovisiblewheninViewchanges:Then use that variant state to update the animation prop on the div: