Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#11] style: add modal slide animation #94

Merged
merged 1 commit into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions react-native/screens/TranslateScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useEffect } from 'react';
import { StyleSheet, View, TouchableOpacity, ImageBackground, Dimensions, Alert } from 'react-native';
import { useToast, Box, Modal, Button, HStack, Text, Divider } from 'native-base';
import { useToast, Box, Button, HStack, Text, Divider, Modal } from 'native-base';
import { Camera } from 'expo-camera';
import { Ionicons } from '@expo/vector-icons';
import { theme } from '../core/theme';
Expand Down Expand Up @@ -61,7 +61,7 @@ export default function TranslateScreen({ navigation }: Navigation) {
// </Box>;
// }
// });
if (results?.event_num) {
if (results?.event_num && results.event_num > 0) {
setOpenInitialEventForm(true);
}
else {
Expand All @@ -78,6 +78,12 @@ export default function TranslateScreen({ navigation }: Navigation) {
}
}, [results]);

useEffect(() => {
if (openInitialEventForm) {
setTimeout(() => {setOpenInitialEventForm(false)}, 5000);
}
}, [openInitialEventForm])

// DEV TEST
// if (hasPermission === null) {
// return <View />;
Expand Down Expand Up @@ -172,7 +178,7 @@ export default function TranslateScreen({ navigation }: Navigation) {
// date: "2022-03-24"
// }
// ]
// })
// });
}

const handleKorean = (): void => {
Expand Down Expand Up @@ -294,7 +300,7 @@ export default function TranslateScreen({ navigation }: Navigation) {
extraMarginTop={10}
swipeHeight={Dimensions.get('window').height*0.65}
/>
<Modal isOpen={openInitialEventForm}>
<Modal isOpen={openInitialEventForm} animationPreset="slide">
<Modal.Content maxWidth="400">
<Modal.Header>
<Text fontSize="lg" fontWeight={600} textAlign="center">{results?.event_num} Events Extracted</Text>
Expand Down