Giter Site home page Giter Site logo

react-redux-modal's People

Contributors

diegoddox avatar kylecesmat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-redux-modal's Issues

Warning: setState(...): Cannot update during an existing state transition (such as within `render`).

When trigger openUserInfoModal it show Warning
Warning: setState(...): Cannot update during an existing state transition (such as within render). Render methods should be a pure function of props and state.

And Error:
Uncaught Invariant Violation: Expected onClick listener to be a function, instead got type object

My Parent component

import React, { PropTypes } from 'react'
import css from './Activities.less'
import ActivityItem from './ActivityItem'
import { modal } from 'react-redux-modal'
import UserQuickView from '../user/UserQuickView'

export default class Activities extends React.Component {
  static propTypes = {
    transactions: PropTypes.array,
  }
  constructor(props) {
    super(props)
    this.props = props
    this.openUserInfoModal = this.openUserInfoModal.bind(this)
  }
  openUserInfoModal(user) {
    modal.add(UserQuickView, {
      title: user.firstName,
      size: 'medium',
    })
  }
  render() {
    const { transactions } = this.props
    return (
      <div className={css.Activities}>
        {transactions.map(transaction => (
          <ActivityItem
            key={transaction.id}
            transaction={transaction}
            openUserInfoModal={this.openUserInfoModal}
          />
        ))}
      </div>
    )
  }
}

My Children component

import React, { PropTypes } from 'react'
import { Link } from 'react-router'
import css from './Activities.less'

export default class ActivityItem extends React.Component {
  static propTypes = {
    transaction: PropTypes.object.isRequired,
    openUserInfoModal: PropTypes.func,
  }

  constructor(props) {
    super(props)
    this.props = props
    this._openUserInfoModal = this._openUserInfoModal.bind(this)
  }

  _openUserInfoModal(user) {
    this.props.openUserInfoModal(user)
  }

  render() {
    const { transaction } = this.props
    return (
      <div key={transaction.id} className={css.Transaction}>
        <div className={css.InformationContainer}>
          <a
            className={css.UserName}
            onClick={() => this._openUserInfoModal(transaction.to)}
          >
            {transaction.to.firstName} {transaction.to.lastName}
          </a> receive
          <span className={css.Point}> {transaction.point}&hearts; </span> from&nbsp;
          <a
            className={css.UserName}
            onClick={() => this._openUserInfoModal(transaction.from)}
          >
            {transaction.from.firstName} {transaction.from.lastName}
          </a>
        </div>
      </div>
    )
  }
}

closeOnOutsideClick closes modal when content is clicked

Hi, I'm using this on a project, and setting closeOnOutsideClick to true seems to close the modal even when content is clicked inside the modal. I would assume this isn't intentional?

Looks like the click handler is attached to the entire component, I'll make a PR to attach it to the shadow overlay, assuming that is expected behavior?

onClick={this.handleOnOutsideClick.bind(this)}>

Handle browser back navigation

If I were to use this on mobile and I were to open a modal, navigating back should, theoretically, close the modal. How would you handle that scenario here?

Auto Focus?

It should be possible to automatically focus a selected modal element when it opens.

It should be possible to focus a specific other element when the modal closes.

how to re-render a modal?

I'm trying to figure out how to update the modal after it's been displayed, like to update a price estimate value. Right now I'm able to modal.add(myComponent, {}) to create a modal and render myComponent but I can't figure out how to update the component. I could remove the modal and display it again with the new props but that would discard the user updates inside the modal, such as form fields.

I'm currently getting around this issue by using connect() on myComponet to link it directly to the store, but I'd prefer to use a basic component and not a redux container. What's the best way to do this? Maybe I should always specify a generic container for the modal and one of the options will be the actual component I want displayed? I feel like the problem will be that the container will need to know about every property any modal will need and will pass those to every modal it displays.

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.