import React, {useEffect, useRef, useState} from 'react'; import {Image, SafeAreaView, View} from 'react-native'; import Animated, {Easing, timing, useValue} from 'react-native-reanimated'; import Carousel from 'react-native-snap-carousel'; import {SvgXml} from 'react-native-svg'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import { COMMUNITY_SVG, NOTE_SVG, ORGANIZE_SVG, PRIVACY_SVG, SYNC_SVG, } from '../../assets/images/assets'; import {useTracked} from '../../provider'; import {useSettingStore} from '../../provider/stores'; import {DDS} from '../../services/DeviceDetection'; import {dHeight, dWidth, getElevation} from '../../utils'; import {openLinkInBrowser} from '../../utils/functions'; import {SIZE} from '../../utils/SizeUtils'; import Storage from '../../utils/storage'; import {sleep} from '../../utils/TimeUtils'; import {Button} from '../Button'; import Heading from '../Typography/Heading'; import Paragraph from '../Typography/Paragraph'; const features = [ { title: 'Notesnook', description: 'A safe place to write and stay organized.', icon: require('../../assets/images/notesnook-logo-png.png'), type: 'image', }, { title: 'Made to protect your privacy', description: 'Your data is encrypted on your device. No one but you can read your notes.', icon: PRIVACY_SVG, link: 'https://notesnook.com', img: 'privacy', }, { icon: SYNC_SVG, title: 'While keeping you in sync', description: 'Everything is automatically synced to all your devices in a safe and secure way. Notesnook is available on all major platforms.', link: 'https://notesnook.com', img: 'sync', }, { icon: ORGANIZE_SVG, title: 'And helping you stay organized', description: 'Add your notes in notebooks and topics or simply assign tags or colors to find them easily.', link: 'https://notesnook.com', img: 'sync', }, { icon: COMMUNITY_SVG, title: 'Join our community', description: 'We are not ghosts, chat with us and share your experience. Give suggestions, report issues and meet other people using Notesnook', link: 'https://discord.gg/zQBK97EE22', img: 'community', }, ]; let currentIndex = 0; const SplashScreen = () => { const [state, dispatch] = useTracked(); const {colors} = state; const carouselRef = useRef(); const [isNext, setIsNext] = useState(true); const isIntroCompleted = useSettingStore(state => state.isIntroCompleted); const setIntroCompleted = useSettingStore(state => state.setIntroCompleted); const opacity = useValue(0); const translateY = useValue(20); const translateY2 = useValue(0); useEffect(() => { if (!isIntroCompleted) { setTimeout(() => { timing(opacity, { toValue: 1, duration: 500, easing: Easing.in(Easing.ease), }).start(); timing(translateY, { toValue: 0, duration: 500, easing: Easing.in(Easing.ease), }).start(); }, 15); } }, [isIntroCompleted]); const hide = async () => { timing(translateY2, { toValue: dHeight * 2, duration: 500, easing: Easing.in(Easing.ease), }).start(); await sleep(500); setIntroCompleted(true); }; return ( !isIntroCompleted && ( { currentIndex = i; }} maxToRenderPerBatch={10} renderItem={({item, index}) => ( {item.type === 'image' ? ( ) : item.type === 'icon' ? ( ) : ( )} {item.title && ( {item.title} )} {item.description && ( {item.description} )} {item.link && (