Amirul93

Onboarding.tsx

Apr 12th, 2021 (edited)
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import PagerView from 'react-native-pager-view';
  2. import React, {useRef, useState} from 'react';
  3. import {StyleSheet, Text, TouchableOpacity, View} from 'react-native';
  4. import {Formik} from 'formik';
  5.  
  6. import GetStarted from './GetStarted';
  7. import Registration from './Registration';
  8. import Verification from './Verification';
  9. import Theme from '../../utils/theme';
  10. import {SafeAreaView} from 'react-native-safe-area-context';
  11. import {registerSchema} from '../../models/registerSchema';
  12.  
  13. export const Onboarding: React.FunctionComponent = () => {
  14.   const pagerRef: React.LegacyRef<PagerView> = useRef(null);
  15.  
  16.   const onPageChange = (page: number) => {
  17.     pagerRef.current?.setPage(page);
  18.   };
  19.  
  20.   return (
  21.     <SafeAreaView style={styles.container}>
  22.       <Formik
  23.         initialValues={{}}
  24.         validationSchema={registerSchema}
  25.         onSubmit={values => console.log(values)}>
  26.         <PagerView style={{flex: 1}} ref={pagerRef} scrollEnabled={false}>
  27.           <View key="1">
  28.             <GetStarted onPageChange={onPageChange} />
  29.           </View>
  30.           <View key="2">
  31.             <Registration onPageChange={onPageChange} />
  32.           </View>
  33.           <View key="3">
  34.             <Verification onPageChange={onPageChange} />
  35.           </View>
  36.         </PagerView>
  37.       </Formik>
  38.     </SafeAreaView>
  39.   );
  40. };
  41.  
  42. const styles = StyleSheet.create({
  43.   container: {
  44.     flex: 1,
  45.     backgroundColor: Theme.colors.lightGray,
  46.   },
  47. });
  48.  
Add Comment
Please, Sign In to add comment