Comments (8)
Can you provide a codesandbox example? Or some steps to reproduce? Which version?
from collapsed.
@roginfarrer Can't, cause I received TypeError: Cannot read property 'useMemo' of undefined
every time, when i tried to use your library in code sandbox
from collapsed.
Sounds like you don't have React installed. The library requires React v16.8.x.
Here's a codesandbox demo
from collapsed.
Closing due to inactivity.
from collapsed.
The same bug!
We can easily reproduce it by adding padding to container that receives collapse props.
I tried it with basic demo on your demo site
from collapsed.
I think this is related to challenges measuring the element with padding applied. Will need to dig in further.
from collapsed.
A quick fix is to apply padding to the child element instead.
<section {...getCollapseProps()}><div style={{ padding: 20 }}>{props.children}</div></section>
from collapsed.
I'm thinking the solution here is just to document this limitation and add a console.warn
if the padding
property is passed to the Collapse. I looked into getting the vertical padding when measuring the element's dimensions via window.getComputedStyle
, but that operation is costly, and still doesn't give a smooth closing transition (the transition ends at the element's sum of the top and bottom padding, not 0
). As @Sandstedt said, the best solution here is to apply padding to the children instead.
from collapsed.
Related Issues (20)
- Is it possible to have 2 icons switch back and forth when expanding or collapsing? HOT 1
- We should have multiple collapse/accordion option in a single component
- inline styling not working HOT 3
- If the height is changed from the outside while the open/close process has never been executed, it will not synchronize. HOT 5
- Remove raf dependency HOT 1
- Since switching to createRoute (concurrent React), inline styles are sometimes not updated HOT 15
- Dependency Dashboard
- No longer compatible with React < 18. HOT 2
- can we replace useEffectAfterMount HOT 2
- Use expand on a Table cell on react HOT 2
- New version doesn't toggle HOT 9
- Media query collapsed HOT 2
- Incorrect peer dependency HOT 1
- SSR usage - prevent initially display if not expanded by default HOT 5
- OffsetHeight vs ScrollHeight HOT 3
- hasDisabledAnimation isn't `false` by default HOT 3
- Request to update "react-collapsed" CONTRIBUTING.md due to old version and package manager conversion.
- Safari 13 support, or at least graceful error handling? HOT 3
- Read more effect HOT 3
- Code for accordion storybook incomplete
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from collapsed.