File tree Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Expand file tree Collapse file tree 3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change 1+ # Releases
2+
3+ ## v1.1.0 (Unreleased)
4+
5+
6+ - Add PropTypes, React 16 Support ([ #2 ] ( https://github.com/tiffon/txregions/pull/2 ) , [ @richseviora ] ( https://github.com/richseviora ) )
7+
8+ - Fix bug focus event handler ([ #3 ] ( https://github.com/tiffon/txregions/pull/3 ) , [ @tiffon ] ( https://github.com/tiffon ) )
9+
10+ - Don't use unsafe lifecycle methods ([ #3 ] ( https://github.com/tiffon/txregions/pull/3 ) , [ @tiffon ] ( https://github.com/tiffon ) )
11+
12+
13+ ### [ Changes for 1.0.3 and earlier are not logged here] ( https://www.youtube.com/watch?v=NoAzpa1x7jU&feature=youtu.be&t=107 )
Original file line number Diff line number Diff line change 2222 "build-min" : " NODE_ENV=production webpack -p src/index.js umd/TxRegions.min.js" ,
2323 "lint" : " eslint src demo" ,
2424 "start" : " cd demo && node server.js && cd -" ,
25- "test-node" : " mocha --compilers js:babel-core/register tests.node.js" ,
2625 "postinstall" : " node ./npm-scripts/postinstall.js"
2726 },
2827 "authors" : [
Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ export const classNames = {
4646
4747export default class TxRegionsInput extends Component {
4848
49+ static getDerivedStateFromProps ( props , state ) {
50+ if ( ! ( 'value' in props ) || state . raw === props . value ) {
51+ return null
52+ }
53+ return { raw : props . value == null ? '' : String ( props . value ) }
54+ }
4955
5056 constructor ( props ) {
5157 super ( props ) ;
@@ -381,8 +387,8 @@ export default class TxRegionsInput extends Component {
381387 this . setState ( {
382388 hasFocus : true ,
383389 rawCaretPos : this . _findSelectionOffset ( )
384- } , 0 ) ;
385- } )
390+ } ) ;
391+ } , 0 )
386392 }
387393
388394
@@ -440,13 +446,6 @@ export default class TxRegionsInput extends Component {
440446 }
441447
442448
443- componentWillReceiveProps ( nextProps , nextState ) {
444- if ( 'value' in nextProps ) {
445- this . setState ( { raw : nextProps . value } ) ;
446- }
447- }
448-
449-
450449 shouldComponentUpdate ( nextProps , nextState ) {
451450 return (
452451 nextState . hasFocus !== this . state . hasFocus ||
@@ -457,11 +456,6 @@ export default class TxRegionsInput extends Component {
457456 }
458457
459458
460- componentWillUpdate ( nextProps , nextState ) {
461- this . _updateViolations ( ) ;
462- }
463-
464-
465459 componentDidUpdate ( ) {
466460 this . _forceHtml ( ) ;
467461
@@ -482,6 +476,8 @@ export default class TxRegionsInput extends Component {
482476
483477
484478 render ( ) {
479+ this . _updateViolations ( ) ;
480+
485481 const
486482 p = this . props ,
487483 clean = this . clean ,
You can’t perform that action at this time.
0 commit comments