|
| 1 | +import { Feather, Ionicons } from '@expo/vector-icons' |
| 2 | +import * as ImagePicker from 'expo-image-picker' |
| 3 | +import { Link, useRouter } from 'expo-router' |
| 4 | +import { useCallback, useEffect, useState } from 'react' |
| 5 | +import { Alert, Image, Linking, Platform, StatusBar, StyleSheet } from 'react-native' |
| 6 | +import { SafeAreaView } from 'react-native-safe-area-context' |
| 7 | +import { |
| 8 | + Avatar, |
| 9 | + Button, |
| 10 | + Heading, |
| 11 | + Pressable, |
| 12 | + Text, |
| 13 | + View, |
| 14 | + XStack, |
| 15 | + YStack, |
| 16 | + ZStack, |
| 17 | +} from 'tamagui' |
| 18 | +import FeatherIcon from '../../../src/components/common/FeatherIcon' |
| 19 | + |
| 20 | +export default function Screen() { |
| 21 | + const [video, setVideo] = useState<string | null>(null) |
| 22 | + const router = useRouter() |
| 23 | + |
| 24 | + const selectVideo = async () => { |
| 25 | + try { |
| 26 | + let result = await ImagePicker.launchImageLibraryAsync({ |
| 27 | + mediaTypes: ImagePicker.MediaTypeOptions.Videos, |
| 28 | + allowsEditing: true, |
| 29 | + aspect: [9, 16], |
| 30 | + videoMaxDuration: 60, |
| 31 | + quality: 1, |
| 32 | + }) |
| 33 | + |
| 34 | + if (!result.canceled) { |
| 35 | + router.push({ |
| 36 | + pathname: '/camera/caption', |
| 37 | + params: { path: result.assets[0].uri }, |
| 38 | + }) |
| 39 | + } |
| 40 | + } catch (error) { |
| 41 | + Alert.alert('Error', JSON.stringify(error)) |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + return ( |
| 46 | + <SafeAreaView flexGrow={1} style={{ backgroundColor: 'black' }}> |
| 47 | + <StatusBar animated={true} barStyle="light" /> |
| 48 | + <YStack gap="$3" px="$5" alignItems="center" justifyContent="center" flexGrow={1}> |
| 49 | + <Ionicons name="create-outline" color="yellow" size={100} /> |
| 50 | + <Heading size="$10" color="#fff" fontWeight="bold"> |
| 51 | + Create Loop |
| 52 | + </Heading> |
| 53 | + </YStack> |
| 54 | + |
| 55 | + <YStack gap="$3" px="$5" alignItems="center" justifyContent="center" flexGrow={1}> |
| 56 | + <Text color="#fff" fontSize="$6" style={{ textAlign: 'center' }}> |
| 57 | + Adult content or nudity is not allowed. |
| 58 | + </Text> |
| 59 | + <Text color="#fff" fontSize="$6" style={{ textAlign: 'center' }}> |
| 60 | + You can share videos up to 60 seconds long. |
| 61 | + </Text> |
| 62 | + </YStack> |
| 63 | + |
| 64 | + <YStack |
| 65 | + flexShrink={1} |
| 66 | + w="100%" |
| 67 | + alignItems="center" |
| 68 | + justifyContent="center" |
| 69 | + px="$3" |
| 70 | + gap="$3" |
| 71 | + > |
| 72 | + <Button |
| 73 | + theme="yellow" |
| 74 | + size="$6" |
| 75 | + bg="$yellow9" |
| 76 | + alignSelf="stretch" |
| 77 | + color="black" |
| 78 | + fontWeight="bold" |
| 79 | + onPress={() => selectVideo()} |
| 80 | + > |
| 81 | + Select |
| 82 | + </Button> |
| 83 | + </YStack> |
| 84 | + </SafeAreaView> |
| 85 | + ) |
| 86 | +} |
0 commit comments