import React, {useState} from 'react' import { Animated, Image, StyleSheet, TouchableOpacity, useWindowDimensions, View, } from 'react-native' import {TabView, SceneMap, Route, TabBarProps} from 'react-native-tab-view' import { FontAwesomeIcon, FontAwesomeIconStyle, } from '@fortawesome/react-native-fontawesome' import {CenteredView} from '../util/Views.web' import {Text} from '../util/text/Text' import {useStores} from 'state/index' import {s, colors} from 'lib/styles' import {TABS_EXPLAINER} from 'lib/assets' import {TABS_ENABLED} from 'lib/build-flags' const ROUTES = TABS_ENABLED ? [ {key: 'intro', title: 'Intro'}, {key: 'tabs', title: 'Tabs'}, ] : [{key: 'intro', title: 'Intro'}] const Intro = () => ( Welcome to{' '} Bluesky This is an early beta. Your feedback is appreciated! ) const Tabs = () => ( Tabs Never lose your place! Long-press to open posts and profiles in a new tab. ) const SCENE_MAP = { intro: Intro, tabs: Tabs, } const renderScene = SceneMap(SCENE_MAP) export const FeatureExplainer = () => { const layout = useWindowDimensions() const store = useStores() const [index, setIndex] = useState(0) const onPressSkip = () => store.onboard.next() const onPressNext = () => { if (index >= ROUTES.length - 1) { store.onboard.next() } else { setIndex(index + 1) } } const renderTabBar = (props: TabBarProps) => { const inputRange = props.navigationState.routes.map((x, i) => i) return ( {props.navigationState.routes.map((route, i) => { const opacity = props.position.interpolate({ inputRange, outputRange: inputRange.map(inputIndex => inputIndex === i ? 1 : 0.5, ), }) return ( setIndex(i)}> ° ) })} ) } const FirstExplainer = SCENE_MAP[ROUTES[0]?.key as keyof typeof SCENE_MAP] return ( {ROUTES.length > 1 ? ( ) : FirstExplainer ? ( ) : ( )} Skip Next ) } const styles = StyleSheet.create({ container: { height: '100%', justifyContent: 'center', paddingBottom: '10%', }, tabBar: { flexDirection: 'row', }, tabItem: { alignItems: 'center', padding: 16, }, explainer: { paddingHorizontal: 16, }, explainerIcon: { flexDirection: 'row', }, explainerHeading: { fontSize: 42, fontWeight: 'bold', textAlign: 'center', marginBottom: 16, }, explainerHeadingIntro: { lineHeight: 40, }, explainerHeadingBrand: {fontSize: 56}, explainerDesc: { fontSize: 18, textAlign: 'center', marginBottom: 16, color: colors.gray5, }, explainerDescIntro: {fontSize: 24}, explainerImg: { resizeMode: 'contain', maxWidth: '100%', maxHeight: 330, }, footer: { flexDirection: 'row', justifyContent: 'center', paddingTop: 24, }, footerBtn: { color: colors.blue3, fontSize: 19, paddingHorizontal: 36, paddingVertical: 8, }, footerBtnNext: { marginLeft: 10, borderWidth: 1, borderColor: colors.blue3, borderRadius: 6, }, })