Skip to content

Commit

Permalink
feat: create example code
Browse files Browse the repository at this point in the history
  • Loading branch information
erickcrus committed Mar 16, 2023
1 parent a894494 commit fcf55dd
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 87 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import React, { useState } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import Loader from '@erickcrus/three-dots-loader';

return () => {
const AppScreen = () => {
const [ loading, setLoading ] = useState(false);

const onPress = () => {
Expand All @@ -37,7 +37,9 @@ return () => {
alignSelf: 'center',
borderRadius: 10
}} onPress={onPress}>
{loading ? <Loader size={8} color='#FFF' /> : <Text style={{color:'#FFF'}}>Test</Text>}
{loading ?
<Loader size={8} color='#FFF' /> :
<Text style={{color:'#FFF'}}>Test</Text>}
</TouchableOpacity>
</View>;
}
Expand Down
30 changes: 0 additions & 30 deletions example/app.json

This file was deleted.

Binary file removed example/assets/adaptive-icon.png
Binary file not shown.
Binary file removed example/assets/favicon.png
Binary file not shown.
Binary file removed example/assets/icon.png
Binary file not shown.
Binary file removed example/assets/splash.png
Binary file not shown.
53 changes: 28 additions & 25 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
import * as React from 'react';
import React, { useState } from 'react';
import { View, Text, TouchableOpacity } from 'react-native';
import Loader from '@erickcrus/three-dots-loader';

import { StyleSheet, View, Text } from 'react-native';
import { multiply } from '@erickcrus/three-dots-loader';
const AppScreen = () => {
const [loading, setLoading] = useState(false);

export default function App() {
const [result, setResult] = React.useState<number | undefined>();
const onPress = () => {
setLoading(true);
setTimeout(() => {
setLoading(false);
}, 1250);
}

React.useEffect(() => {
multiply(3, 7).then(setResult);
}, []);

return (
<View style={styles.container}>
<Text>Result: {result}</Text>
return <View style={{ flex: 1 }}>
<View style={{ flex: 1 }}>
<Text>Press button to test</Text>
</View>
);
<TouchableOpacity style={{
flex: 0,
backgroundColor: '#00b9fc',
paddingVertical: 10,
width: '82%',
alignSelf: 'center',
borderRadius: 10
}} onPress={onPress}>
{loading ?
<Loader size={8} color='#FFF' /> :
<Text style={{ color: '#FFF' }}>Test</Text>}
</TouchableOpacity>
</View>;
}

const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
box: {
width: 60,
height: 60,
marginVertical: 20,
},
});
export default AppScreen;
29 changes: 0 additions & 29 deletions scripts/bootstrap.js

This file was deleted.

1 change: 0 additions & 1 deletion src/__tests__/index.test.tsx

This file was deleted.

0 comments on commit fcf55dd

Please sign in to comment.