fix component drawer
This commit is contained in:
@@ -10,7 +10,7 @@ import { Styles } from "@/styles/global-styles";
|
|||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
import { router, Stack, useLocalSearchParams } from "expo-router";
|
import { router, Stack, useLocalSearchParams } from "expo-router";
|
||||||
import React, { useRef, useState } from "react";
|
import React, { useRef, useState } from "react";
|
||||||
import { Animated, Text, TouchableHighlight, TouchableOpacity, View } from "react-native";
|
import { Animated, InteractionManager, Text, TouchableHighlight, TouchableOpacity, View } from "react-native";
|
||||||
|
|
||||||
export default function Profile() {
|
export default function Profile() {
|
||||||
const { id } = useLocalSearchParams();
|
const { id } = useLocalSearchParams();
|
||||||
@@ -64,8 +64,10 @@ export default function Profile() {
|
|||||||
duration: 300,
|
duration: 300,
|
||||||
useNativeDriver: true,
|
useNativeDriver: true,
|
||||||
}).start(() => {
|
}).start(() => {
|
||||||
|
InteractionManager.runAfterInteractions(() => {
|
||||||
setIsDrawerOpen(false); // baru ganti state setelah animasi selesai
|
setIsDrawerOpen(false); // baru ganti state setelah animasi selesai
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import {
|
|||||||
Animated,
|
Animated,
|
||||||
PanResponder,
|
PanResponder,
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
View
|
View,
|
||||||
|
InteractionManager,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
|
||||||
import { AccentColor, MainColor } from "@/constants/color-palet";
|
import { AccentColor, MainColor } from "@/constants/color-palet";
|
||||||
@@ -39,7 +40,9 @@ DrawerCustomProps) {
|
|||||||
},
|
},
|
||||||
onPanResponderRelease: (_, gestureState) => {
|
onPanResponderRelease: (_, gestureState) => {
|
||||||
if (gestureState.dy > 200) {
|
if (gestureState.dy > 200) {
|
||||||
|
InteractionManager.runAfterInteractions(() => {
|
||||||
closeDrawer();
|
closeDrawer();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Animated.spring(drawerAnim, {
|
Animated.spring(drawerAnim, {
|
||||||
toValue: 0,
|
toValue: 0,
|
||||||
@@ -59,7 +62,9 @@ DrawerCustomProps) {
|
|||||||
style={styles.overlay}
|
style={styles.overlay}
|
||||||
pointerEvents="auto"
|
pointerEvents="auto"
|
||||||
onTouchStart={() => {
|
onTouchStart={() => {
|
||||||
setTimeout(closeDrawer, 0);
|
InteractionManager.runAfterInteractions(() => {
|
||||||
|
closeDrawer();
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
19
components/index.ts
Normal file
19
components/index.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { TextInputCustom } from "./TextInput/TextInputCustom";
|
||||||
|
import ButtonCustom from "./Button/ButtonCustom";
|
||||||
|
import AlertCustom from "./Alert/AlertCustom";
|
||||||
|
import DrawerCustom from "./Drawer/DrawerCustom";
|
||||||
|
import ViewWrapper from "./_ShareComponent/ViewWrapper";
|
||||||
|
import BackButton from "./_ShareComponent/BackButton";
|
||||||
|
import Spacing from "./_ShareComponent/Spacing";
|
||||||
|
import TruncatedText from "./_ShareComponent/TruncatedText";
|
||||||
|
|
||||||
|
export {
|
||||||
|
TextInputCustom,
|
||||||
|
ButtonCustom,
|
||||||
|
AlertCustom,
|
||||||
|
DrawerCustom,
|
||||||
|
ViewWrapper,
|
||||||
|
BackButton,
|
||||||
|
Spacing,
|
||||||
|
TruncatedText,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user