|
|
|
@ -1,15 +1,17 @@
|
|
|
|
|
import React, { useState, useRef } from 'react';
|
|
|
|
|
import { Modal, View, StyleSheet, Text, FlatList, Animated, TouchableOpacity, ImageBackground, Image } from 'react-native';
|
|
|
|
|
import { Modal, View, StyleSheet, useColorScheme, Text, FlatList, Animated, TouchableOpacity, ImageBackground, Image } from 'react-native';
|
|
|
|
|
// import Modal from "react-native-modal";
|
|
|
|
|
import { useNavigation } from "@react-navigation/native";
|
|
|
|
|
|
|
|
|
|
import normalize from '../components/Normalize';
|
|
|
|
|
import OnboardingItem from './OnboardingItem';
|
|
|
|
|
import Paginator from './Paginator';
|
|
|
|
|
import NextButton from './NextButton';
|
|
|
|
|
import slides from '../data/slides';
|
|
|
|
|
import { GraphicalCharterDark } from '../assets/GraphicalCharterDark';
|
|
|
|
|
import { GraphicalCharterLight } from '../assets/GraphicalCharterLight';
|
|
|
|
|
|
|
|
|
|
export default function Onboarding() {
|
|
|
|
|
const style = useColorScheme() == 'light' ? GraphicalCharterLight : GraphicalCharterDark;
|
|
|
|
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
|
|
|
const scrollX = useRef(new Animated.Value(0)).current;
|
|
|
|
|
const slidesRef = useRef(null);
|
|
|
|
@ -34,71 +36,12 @@ export default function Onboarding() {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
<View style={styles.container}>
|
|
|
|
|
<View style={styles.balise}>
|
|
|
|
|
<FlatList
|
|
|
|
|
data={slides}
|
|
|
|
|
renderItem={({item}) => <OnboardingItem item={item} />}
|
|
|
|
|
horizontal
|
|
|
|
|
showsHorizontalScrollIndicator={false}
|
|
|
|
|
pagingEnabled
|
|
|
|
|
bounces={false}
|
|
|
|
|
keyExtractor={(item) => item.id}
|
|
|
|
|
onScroll={Animated.event([{ nativeEvent: { contentOffset: { x: scrollX } } }], {
|
|
|
|
|
useNativeDriver: false,
|
|
|
|
|
})}
|
|
|
|
|
scrollEventThrottle={32}
|
|
|
|
|
onViewableItemsChanged={viewableItemsChanged}
|
|
|
|
|
viewabilityConfig={viewConfig}
|
|
|
|
|
ref={slidesRef}
|
|
|
|
|
/>
|
|
|
|
|
<Paginator data={slides} scrollX={scrollX}/>
|
|
|
|
|
<NextButton scrollTo={scrollTo} percentage={(currentIndex + 1) * (100 / slides.length)} />
|
|
|
|
|
</View>
|
|
|
|
|
<Modal animationType="slide" visible={isModalVisible} transparent={true} presentationStyle={'pageSheet'}>
|
|
|
|
|
<View style={styles.modalContent}>
|
|
|
|
|
<ImageBackground source={require("../assets/images/Background_Start_Page.png")} style={styles.backgroundImage}>
|
|
|
|
|
<View style={styles.modalView}>
|
|
|
|
|
<Text style={styles.versionText}>
|
|
|
|
|
v2.0
|
|
|
|
|
</Text>
|
|
|
|
|
<TouchableOpacity onPress={handleModal} style={styles.closeButtonCircle}>
|
|
|
|
|
<View>
|
|
|
|
|
<Image source={require("../assets/icons/icons/croix.png")} style={styles.imageButton}/>
|
|
|
|
|
</View>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<Image source={require("../assets/icons/Logo_White_Flad.png")} style={styles.imageLogo}/>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
style={styles.buttonConnection}
|
|
|
|
|
onPress={() => {handleModal();
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
navigation.navigate('Login');
|
|
|
|
|
}}>
|
|
|
|
|
<Text style={styles.text}>CONTINUER AVEC SPOTIFY</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<TouchableOpacity style={styles.buttonInscription} onPress={() => {handleModal(); navigation.navigate('Register');}}>
|
|
|
|
|
<Text style={styles.text}>S’INSCRIRE MAINTENANT</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<Image source={require("../assets/images/Flady.gif")} style={styles.mascot}/>
|
|
|
|
|
<TouchableOpacity style={styles.button2Connection} onPress={() => {handleModal(); navigation.navigate('Login');}}>
|
|
|
|
|
<Text style={styles.text}>SE CONNECTER</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
</ImageBackground>
|
|
|
|
|
</View>
|
|
|
|
|
</Modal>
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const styles = StyleSheet.create({
|
|
|
|
|
container: {
|
|
|
|
|
flex: 1,
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
backgroundColor: '#141414'
|
|
|
|
|
backgroundColor: style.body
|
|
|
|
|
},
|
|
|
|
|
imageLogo: {
|
|
|
|
|
width: normalize(324),
|
|
|
|
@ -197,3 +140,64 @@ const styles = StyleSheet.create({
|
|
|
|
|
right: normalize(0)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
<View style={styles.container}>
|
|
|
|
|
<View style={styles.balise}>
|
|
|
|
|
<FlatList
|
|
|
|
|
data={slides}
|
|
|
|
|
renderItem={({ item }) => <OnboardingItem item={item} />}
|
|
|
|
|
horizontal
|
|
|
|
|
showsHorizontalScrollIndicator={false}
|
|
|
|
|
pagingEnabled
|
|
|
|
|
bounces={false}
|
|
|
|
|
keyExtractor={(item) => item.id}
|
|
|
|
|
onScroll={Animated.event([{ nativeEvent: { contentOffset: { x: scrollX } } }], {
|
|
|
|
|
useNativeDriver: false,
|
|
|
|
|
})}
|
|
|
|
|
scrollEventThrottle={32}
|
|
|
|
|
onViewableItemsChanged={viewableItemsChanged}
|
|
|
|
|
viewabilityConfig={viewConfig}
|
|
|
|
|
ref={slidesRef}
|
|
|
|
|
/>
|
|
|
|
|
<Paginator data={slides} scrollX={scrollX} />
|
|
|
|
|
<NextButton scrollTo={scrollTo} percentage={(currentIndex + 1) * (100 / slides.length)} />
|
|
|
|
|
</View>
|
|
|
|
|
<Modal animationType="slide" visible={isModalVisible} transparent={true} presentationStyle={'pageSheet'}>
|
|
|
|
|
<View style={styles.modalContent}>
|
|
|
|
|
<ImageBackground source={require("../assets/images/Background_Start_Page.png")} style={styles.backgroundImage}>
|
|
|
|
|
<View style={styles.modalView}>
|
|
|
|
|
<Text style={styles.versionText}>
|
|
|
|
|
v2.0
|
|
|
|
|
</Text>
|
|
|
|
|
<TouchableOpacity onPress={handleModal} style={styles.closeButtonCircle}>
|
|
|
|
|
<View>
|
|
|
|
|
<Image source={require("../assets/icons/icons/croix.png")} style={styles.imageButton} />
|
|
|
|
|
</View>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<Image source={require("../assets/icons/Logo_White_Flad.png")} style={styles.imageLogo} />
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
style={styles.buttonConnection}
|
|
|
|
|
onPress={() => {
|
|
|
|
|
handleModal();
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
navigation.navigate('Login');
|
|
|
|
|
}}>
|
|
|
|
|
<Text style={styles.text}>CONTINUER AVEC SPOTIFY</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<TouchableOpacity style={styles.buttonInscription} onPress={() => { handleModal(); navigation.navigate('Register'); }}>
|
|
|
|
|
<Text style={styles.text}>S’INSCRIRE MAINTENANT</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
<Image source={require("../assets/images/Flady.gif")} style={styles.mascot} />
|
|
|
|
|
<TouchableOpacity style={styles.button2Connection} onPress={() => { handleModal(); navigation.navigate('Login'); }}>
|
|
|
|
|
<Text style={styles.text}>SE CONNECTER</Text>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
</View>
|
|
|
|
|
</ImageBackground>
|
|
|
|
|
</View>
|
|
|
|
|
</Modal>
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|