GithubHelp home page GithubHelp logo

Deprecate `isOpen` about react-modal HOT 8 CLOSED

reactjs avatar reactjs commented on April 30, 2024
Deprecate `isOpen`

from react-modal.

Comments (8)

yvele avatar yvele commented on April 30, 2024 2

@pstoica @srph @monsieurnebo @diasbruno So basically the whole point of isOpen is to allow animations through ReactTransitionGroup ?

If I don't have animation, can you confirm that no using isOpen and returning null (no render atl all) is straightforward and well.. better.

What the point of the portal? Only animation or is there some a11y magic?

Related to #205

from react-modal.

yvele avatar yvele commented on April 30, 2024 1

@monsieurnebo CC

from react-modal.

cameronsutter avatar cameronsutter commented on April 30, 2024

I've also found it to be more convenient this way

from react-modal.

pstoica avatar pstoica commented on April 30, 2024

I think you'd lose out on being able to animate? I don't think you can wrap <Modal> in something like ReactTransitionGroup since it needs to open up through another portal.

from react-modal.

srph avatar srph commented on April 30, 2024

@pstoica Yea. I just realized this. Closing this because I just made myself look stupid 🎉 haha

from react-modal.

diasbruno avatar diasbruno commented on April 30, 2024

The Modal.js is responsible for setting all the environment (specially a11y, toggle the body class...). It also contains the timer for the animation since it doesn't uses css events to control its state.

@yvele Can you elaborate your idea to handle this?

Resources:
Modal.js#L81
Modal.js#L110
Modal.js#L117

from react-modal.

neptunian avatar neptunian commented on April 30, 2024

@yvele @diasbruno i modified the library a bit and not using isOpen works fine but then you lose out on animation. The reason I did it is because if i use the library, as is, I can't get react-router to work properly where i render a component based on a route. In my app the modals have urls and it seems react-modal is designed to be mounted when the page loads and show or hides the modal based on the isOpen prop instead of mounting and unmounting the whole component based on a route. I think it'd be better to get rid of the isOpen prop but i don't know how you'd handle animation then. I was not able to figure that part out, but i imagine there must be some other way to handle animations.

from react-modal.

neptunian avatar neptunian commented on April 30, 2024

I believe i've been able to get it working without having to remove isOpen with react-router by using the children function:
https://reacttraining.com/react-router/web/api/Route/children-func

That way the component mounts no matter what and the modal can continue using isOpen with animation.

from react-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.