import React, {useEffect, useRef, useState} from 'react'; import {Image, 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 { NOTE_SVG, SYNC_SVG, ORGANIZE_SVG, PRIVACY_SVG, COMMUNITY_SVG, } from '../../assets/images/assets'; import {useTracked} from '../../provider'; import {eSendEvent} from '../../services/EventManager'; import {dHeight, dWidth, getElevation} from '../../utils'; import {eOpenLoginDialog} from '../../utils/Events'; 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'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import {DDS} from '../../services/DeviceDetection'; import {openLinkInBrowser} from '../../utils/functions'; import {Modal} from 'react-native'; import {SafeAreaView} from 'react-native'; import {SvgToPngView} from '../ListPlaceholders'; import {MMKV} from '../../utils/mmkv'; 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 [visible, setVisible] = useState(false); const carouselRef = useRef(); const [isNext, setIsNext] = useState(true); const opacity = useValue(0); const translateY = useValue(20); const translateY2 = useValue(0); useEffect(() => { MMKV.getStringAsync('introCompleted').then(async r => { setTimeout(() => { if (!r) { setVisible(true); timing(opacity, { toValue: 1, duration: 500, easing: Easing.in(Easing.ease), }).start(); timing(translateY, { toValue: 0, duration: 500, easing: Easing.in(Easing.ease), }).start(); } }, 1); }); }, []); const hide = async () => { timing(translateY2, { toValue: dHeight * 2, duration: 500, easing: Easing.in(Easing.ease), }).start(); await sleep(500); setVisible(false); }; return ( visible && ( { currentIndex = i; }} maxToRenderPerBatch={10} renderItem={({item, index}) => ( {item.type === 'image' ? ( ) : item.type === 'icon' ? ( ) : ( )} {item.title && ( {item.title} )} {item.description && ( {item.description} )} {item.link && (