react-flatpickr
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -15,4 +15,2 @@ 'use strict'; | ||
var _reactDom = require('react-dom'); | ||
var _flatpickr = require('flatpickr'); | ||
@@ -51,3 +49,2 @@ | ||
value: function componentDidMount() { | ||
var node = (0, _reactDom.findDOMNode)(this.refs.input); | ||
var options = _extends({}, this.props.options, { | ||
@@ -57,3 +54,3 @@ onChange: this.props.onChange | ||
this.flatpickr = new _flatpickr2.default(node, options); | ||
this.flatpickr = new _flatpickr2.default(this.node, options); | ||
} | ||
@@ -63,2 +60,4 @@ }, { | ||
value: function render() { | ||
var _this2 = this; | ||
// ignore onChange, options | ||
@@ -73,3 +72,5 @@ // eslint-disable-next-line no-unused-vars | ||
return _react2.default.createElement('input', _extends({}, props, { defaultValue: defaultValue || value, ref: 'input' })); | ||
return _react2.default.createElement('input', _extends({}, props, { defaultValue: defaultValue || value, ref: function ref(node) { | ||
return _this2.node = node; | ||
} })); | ||
} | ||
@@ -76,0 +77,0 @@ }]); |
import React, { Component, PropTypes } from 'react' | ||
import { findDOMNode } from 'react-dom' | ||
import Flatpickr from 'flatpickr' | ||
@@ -23,3 +22,2 @@ | ||
componentDidMount() { | ||
const node = findDOMNode(this.refs.input) | ||
const options = { | ||
@@ -30,3 +28,3 @@ ...this.props.options, | ||
this.flatpickr = new Flatpickr(node, options) | ||
this.flatpickr = new Flatpickr(this.node, options) | ||
} | ||
@@ -39,3 +37,3 @@ | ||
return ( | ||
<input {...props} defaultValue={defaultValue || value} ref='input' /> | ||
<input {...props} defaultValue={defaultValue || value} ref={node => this.node = node} /> | ||
) | ||
@@ -42,0 +40,0 @@ } |
{ | ||
"name": "react-flatpickr", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "flatpickr for React", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -28,2 +28,8 @@ | ||
* `flatpickr options`: you can pass all `flatpickr parameters` to `props.options` | ||
```jsx | ||
<Flatpickr options={{minDate: '2017-01-01'}} /> | ||
``` | ||
### License | ||
@@ -30,0 +36,0 @@ MIT |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47
1779118