-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
231 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,118 @@ | ||
import { multiply } from '@fijit-club/rn-tourguide'; | ||
import { useEffect, useState } from 'react'; | ||
import { StyleSheet, Text, View } from 'react-native'; | ||
/* eslint-disable react-native/no-color-literals */ | ||
import { Ionicons } from '@expo/vector-icons'; | ||
import { TourGuideProvider, TourGuideZone, useTourGuideController } from '@fijit-club/rn-tourguide'; | ||
import { type FC, useEffect } from 'react'; | ||
import { Image, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; | ||
|
||
export default function App() { | ||
const [result, setResult] = useState<number | undefined>(); | ||
const uri = 'https://pbs.twimg.com/profile_images/1223192265969016833/U8AX9Lfn_400x400.jpg'; | ||
|
||
const AppContent = () => { | ||
const iconProps = { size: 40, color: '#888' }; | ||
const { start, canStart, stop } = useTourGuideController(); | ||
|
||
useEffect(() => { | ||
multiply(3, 7).then(setResult); | ||
}, []); | ||
if (canStart) start(1); | ||
}, [canStart, start]); | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text>Result: {result}</Text> | ||
</View> | ||
<ScrollView | ||
contentContainerStyle={styles.scrollContainer} | ||
keyboardShouldPersistTaps="always" | ||
scrollEventThrottle={16} | ||
> | ||
<View style={styles.container}> | ||
<TourGuideZone zone={6}> | ||
<Text style={styles.title}>{'Welcome to the demo of\n"rn-tourguide"'}</Text> | ||
</TourGuideZone> | ||
<View style={styles.middleView}> | ||
<TouchableOpacity onPress={() => start(2)} style={styles.button}> | ||
<Text style={styles.buttonText}>START THE TUTORIAL!</Text> | ||
</TouchableOpacity> | ||
|
||
<TourGuideZone zone={3}> | ||
<TouchableOpacity onPress={() => start(4)} style={styles.button}> | ||
<Text style={styles.buttonText}>Step 4</Text> | ||
</TouchableOpacity> | ||
</TourGuideZone> | ||
<TouchableOpacity onPress={() => start(2)} style={styles.button}> | ||
<Text style={styles.buttonText}>Step 2</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity onPress={stop} style={styles.button}> | ||
<Text style={styles.buttonText}>Stop</Text> | ||
</TouchableOpacity> | ||
<TourGuideZone zone={7}> | ||
<Image source={{ uri }} style={styles.profilePhoto} /> | ||
</TourGuideZone> | ||
</View> | ||
<View style={styles.row}> | ||
<TourGuideZone zone={4}> | ||
<Ionicons name="add-circle" {...iconProps} /> | ||
</TourGuideZone> | ||
<Ionicons name="chatbubbles" {...iconProps} /> | ||
<Ionicons name="globe" {...iconProps} /> | ||
<TourGuideZone zone={5}> | ||
<Ionicons name="navigate" {...iconProps} /> | ||
</TourGuideZone> | ||
<TourGuideZone zone={2}> | ||
<Ionicons name="rainy" {...iconProps} /> | ||
</TourGuideZone> | ||
</View> | ||
{/* {Platform.OS !== 'web' ? | ||
<TourGuideZoneByPosition height={64} isTourGuide left={50} shape={'circle'} top={250} width={64} zone={1} /> | ||
: null} */} | ||
</View> | ||
</ScrollView> | ||
); | ||
} | ||
}; | ||
|
||
const App: FC = () => { | ||
return ( | ||
<TourGuideProvider> | ||
<AppContent /> | ||
</TourGuideProvider> | ||
); | ||
}; | ||
const styles = StyleSheet.create({ | ||
scrollContainer: { | ||
flexGrow: 1, | ||
marginTop: 60, | ||
}, | ||
container: { | ||
flex: 1, | ||
backgroundColor: '#fff', | ||
alignItems: 'center', | ||
paddingTop: 40, | ||
}, | ||
title: { | ||
fontSize: 24, | ||
textAlign: 'center', | ||
}, | ||
profilePhoto: { | ||
width: 140, | ||
height: 140, | ||
borderRadius: 70, | ||
marginVertical: 20, | ||
}, | ||
middleView: { | ||
flex: 1, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
// box: { | ||
// width: 60, | ||
// height: 60, | ||
// marginVertical: 20, | ||
// }, | ||
button: { | ||
backgroundColor: '#2980b9', | ||
paddingVertical: 10, | ||
paddingHorizontal: 15, | ||
margin: 2, | ||
}, | ||
buttonText: { | ||
color: 'white', | ||
fontSize: 16, | ||
}, | ||
row: { | ||
width: '100%', | ||
padding: 15, | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
}, | ||
}); | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export function multiply(a: number, b: number): Promise<number> { | ||
return Promise.resolve(a * b); | ||
} | ||
export { default as TourGuideProvider } from './TourGuideProvider'; | ||
export { default as TourGuideZone } from './TourGuideZone'; | ||
export { default as useTourGuideController } from './useTourGuideController'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters