File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 11< head >
22 < link rel ="stylesheet " href ="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css ">
3+ < style >
4+ .content {
5+ opacity : 0 ;
6+ transition : opacity 1s ease-in;
7+ }
8+ .loaded {
9+ opacity : 1 ;
10+ }
11+ </ style >
312</ head >
413< body >
514 < div class ="container ">
Original file line number Diff line number Diff line change @@ -9,11 +9,14 @@ var App = React.createClass({
99 mixins : [ ReactFire ] ,
1010 getInitialState : function ( ) {
1111 return {
12- items : { }
12+ items : { } ,
13+ loaded : false
1314 }
1415 } ,
1516 componentWillMount : function ( ) {
16- this . bindAsObject ( new Firebase ( rootUrl + 'items/' ) , 'items' ) ;
17+ fb = new Firebase ( rootUrl + 'items/' ) ;
18+ this . bindAsObject ( fb , 'items' ) ;
19+ fb . on ( 'value' , this . handleDataLoaded ) ;
1720 } ,
1821 render : function ( ) {
1922 return < div className = "row panel panel-default" >
@@ -22,9 +25,14 @@ var App = React.createClass({
2225 To-Do List
2326 </ h2 >
2427 < Header itemsStore = { this . firebaseRefs . items } />
25- < List items = { this . state . items } />
28+ < div className = { "content " + ( this . state . loaded ? 'loaded' : '' ) } >
29+ < List items = { this . state . items } />
30+ </ div >
2631 </ div >
2732 </ div >
33+ } ,
34+ handleDataLoaded : function ( ) {
35+ this . setState ( { loaded : true } ) ;
2836 }
2937} ) ;
3038
You can’t perform that action at this time.
0 commit comments