motiondivision / motiondivision/motion
[BUG] dynamic `layout` does not work whithout remount
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
1. Read the FAQs 👇
check
2. Describe the bug
(Not sure this is a bug or intended behavior, so please let me know if it is intended.)
If layout is changed to true after mount, motion.div does not animate.
In case layout is set to true on mount, it does animate as expected.
3. IMPORTANT: Provide a CodeSandbox reproduction of the bug
https://codesandbox.io/p/sandbox/framer-virtual-hgzcgz?file=%2Fsrc%2FApp.tsx%3A9%2C11
4. Steps to reproduce
- Click "Add" couple of times to add items with no
layoutprop set - Click "Toggle" button to set layout to
truefor next items. - Click "Add" again to more items.
- Items added in step 1 do not animate
5. Expected behavior
Items animate for layout changes even if layout prop is changed to true dynamically.
6. Video or screenshots
https://github.com/framer/motion/assets/99154189/75f3d441-160c-4e8c-9fb6-b05fc6787bd9
7. Environment details
If applicable, let us know which OS, browser, browser version etc you're using.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the linked CodeSandbox reproduction and verify the behavior described in the numbered steps. Then trace how motion.div handles a layout prop that changes after mount. Done means items animate layout changes both when layout is enabled initially and when it is enabled dynamically, with the reproduction no longer showing the bug.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100