File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,14 @@ class FadeInView extends Component {
12
12
13
13
componentDidMount ( ) {
14
14
const { viewOpacity } = this . state ;
15
- const { onFadeComplete, duration = 500 } = this . props ;
15
+ const { onFadeComplete, duration = 500 , delay } = this . props ;
16
16
17
17
Animated . timing (
18
18
viewOpacity ,
19
19
{
20
20
toValue : 1 ,
21
21
duration,
22
+ delay
22
23
} ,
23
24
) . start ( onFadeComplete || ( ( ) => { } ) ) ;
24
25
}
@@ -38,6 +39,7 @@ class FadeInView extends Component {
38
39
FadeInView . propTypes = {
39
40
onFadeComplete : PropTypes . func ,
40
41
duration : PropTypes . number ,
42
+ delay : PropTypes . number ,
41
43
style : PropTypes . oneOfType ( [
42
44
PropTypes . number ,
43
45
PropTypes . string ,
Original file line number Diff line number Diff line change @@ -11,10 +11,15 @@ A function that is called when the fade animation completes
11
11
### ` duration `
12
12
The duration of the fade animation, ** ` 500ms ` ** by default
13
13
14
+ ### ` delay `
15
+ The time to wait (in milliseconds) before the fade starts, ** ` 0ms ` ** by default
16
+
14
17
### ` style `
15
18
Style to be given to the view
16
19
17
20
## Usage
21
+
22
+ ### Basic Usage
18
23
``` javascript
19
24
import FadeInView from ' react-native-fade-in-view' ;
20
25
@@ -28,3 +33,19 @@ const myFadeInComponent = () => (
28
33
< / FadeInView>
29
34
);
30
35
```
36
+
37
+ ### Cascading List View
38
+ ``` javascript
39
+ import FadeInView from ' react-native-fade-in-view' ;
40
+
41
+ // Assuming items is an array of components
42
+ const myFadeInList = () => (
43
+ < ScrollView>
44
+ {items .map ((item , i ) => (
45
+ < FadeInView key= {i} delay= {i * 20 }>
46
+ {item}
47
+ < / FadeInView>
48
+ ))}
49
+ < / ScrollView>
50
+ );
51
+ ```
You can’t perform that action at this time.
0 commit comments