Skip to content

v2.0.0

Compare
Choose a tag to compare
@FrameMuse FrameMuse released this 22 May 20:23
· 147 commits to main since this release
d61735b

What's new

Features

  • Modals now can be layered! - #28
  • ModalWindow has new serialized property
  • ModalWindow has new on method
  • ModalController has new on method
  • ModalController has new close method
  • ModalController has new show and hide methods

Breaking changes

  • ModalWindow now is a class instead of interface
  • Modal is not exporting now, instead you should create your own Modal using ModalController
  • ModalContainer now has a required property controller
  • id property in ModalWindow is now a number instead of string
  • useModalContext renamed to useModalWindow
  • observe method in ModalController is renamed to subscribe and callback doesn't have state as an argument anymore - #142
  • isClosed property in ModalWindow is renamed to closed
  • isFocused property in ModalWindow is removed
  • Renamed isOpen to active in ModalController
  • Rename ModalState to ModalSnapshot
  • Rename useModalState to useModalSnapshot

What's Changed

Full Changelog: v1.2.3...v2.0.0

Migration from v1.x.x

#1

Create local instance of ModalController

import { ModalController } from "react-modal-global"

export const Modal = new ModalController()

#2

Pass your local Modal to ModalContainer

import Modal from "./Modal"

<ModalContainer controller={Modal} />

#3

Rename properies using your IDE or create a wrapper as dependency injection.