Skip to content

Commit cf60409

Browse files
authored
Merge pull request #11 from ramprakashreddy/master
Readme Updated
2 parents efd7a87 + 4182a7c commit cf60409

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

readme.md

+38-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ npm install react-native-animated-loader --save
3434
```
3535

3636
## Usage
37-
37+
### Class Component
3838
```jsx
3939
import React from 'react';
40-
import { StyleSheet } from 'react-native';
40+
import { StyleSheet,Text } from 'react-native';
4141
import AnimatedLoader from "react-native-animated-loader";
4242

4343
export default class Loader extends React.Component {
@@ -77,6 +77,41 @@ const styles = StyleSheet.create({
7777
}
7878
});
7979
```
80+
### Functional Component
81+
82+
```jsx
83+
import React, {useState, useEffect} from 'react';
84+
import {StyleSheet, Text} from 'react-native';
85+
import AnimatedLoader from 'react-native-animated-loader';
86+
export default function App() {
87+
const [visible, setVisible] = useState(false);
88+
useEffect(() => {
89+
setInterval(() => {
90+
setVisible(!visible);
91+
}, 2000);
92+
}, []);
93+
94+
return (
95+
<AnimatedLoader
96+
visible={visible}
97+
overlayColor="rgba(255,255,255,0.75)"
98+
animationStyle={styles.lottie}
99+
speed={1}>
100+
<Text>Doing something...</Text>
101+
</AnimatedLoader>
102+
);
103+
}
104+
const styles = StyleSheet.create({
105+
lottie: {
106+
width: 100,
107+
height: 100,
108+
},
109+
});
110+
111+
```
112+
113+
### Usage in Expo
114+
[Example for expo projects](https://snack.expo.dev/tTSGEcb5J)
80115

81116
### Loader files
82117

@@ -95,7 +130,7 @@ You can find free lottie files for your loaders [here](https://lottiefiles.com/s
95130
|**`loop`**| A boolean flag indicating whether or not the animation should loop. | `true` |
96131

97132
## Work in Progress
98-
- [ ] Add expo example
133+
- [x] Add expo example
99134
- [ ] Add ability to render text with animations
100135
- [ ] Add test cases
101136

0 commit comments

Comments
 (0)