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 1
1
< head >
2
2
< 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 >
3
12
</ head >
4
13
< body >
5
14
< div class ="container ">
Original file line number Diff line number Diff line change @@ -9,11 +9,14 @@ var App = React.createClass({
9
9
mixins : [ ReactFire ] ,
10
10
getInitialState : function ( ) {
11
11
return {
12
- items : { }
12
+ items : { } ,
13
+ loaded : false
13
14
}
14
15
} ,
15
16
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 ) ;
17
20
} ,
18
21
render : function ( ) {
19
22
return < div className = "row panel panel-default" >
@@ -22,9 +25,14 @@ var App = React.createClass({
22
25
To-Do List
23
26
</ h2 >
24
27
< 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 >
26
31
</ div >
27
32
</ div >
33
+ } ,
34
+ handleDataLoaded : function ( ) {
35
+ this . setState ( { loaded : true } ) ;
28
36
}
29
37
} ) ;
30
38
You can’t perform that action at this time.
0 commit comments