Skip to content

Commit

Permalink
[#11] style: add modal slide animation
Browse files Browse the repository at this point in the history
  • Loading branch information
hee-suh committed May 30, 2022
1 parent e7de0c4 commit 04032f7
Showing 1 changed file with 10 additions and 4 deletions.
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

0 comments on commit 04032f7

Please sign in to comment.