Skip to content

Commit

Permalink
Merge branch 'main' into wallet-396-update-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardsph authored Aug 9, 2024
2 parents 0d4cf5e + aa2a259 commit 8f69a7d
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { faBell } from "@fortawesome/free-solid-svg-icons/faBell";
import { faUser } from "@fortawesome/free-solid-svg-icons/faUser";
import { useSession } from "@/hooks/session";
import {
Animated,
Dimensions,
StyleSheet,
TouchableOpacity,
Expand Down Expand Up @@ -73,8 +72,6 @@ export default function TabLayout() {
},
});

const rotation = useRef(new Animated.Value(0)).current;

const [menuVisible, setMenuVisible] = useState(false);
const [menuPosition, setMenuPosition] = useState({ x: 0, y: 0 });
const [positionType, setPositionType] = useState<
Expand All @@ -95,16 +92,9 @@ export default function TabLayout() {
const rightHeaderAddButtonRef = useRef(null);
const toggleMenu = (
type: "topMiddle" | "bottomLeft" | "bottomMiddle" = "topMiddle",
buttonRef: MutableRefObject<null> = rightHeaderAddButtonRef,
animated = false
buttonRef: MutableRefObject<null> = rightHeaderAddButtonRef
) => {
if (buttonRef && buttonRef.current) {
if (animated)
Animated.timing(rotation, {
toValue: menuVisible ? 0 : 1,
duration: 300,
useNativeDriver: true,
}).start(() => {});
(
buttonRef.current as unknown as {
measure: (
Expand Down Expand Up @@ -134,14 +124,6 @@ export default function TabLayout() {
);
}
};
const rotateInterpolate = rotation.interpolate({
inputRange: [0, 1],
outputRange: ["0deg", "45deg"],
});

const animatedStyle = {
transform: [{ rotate: rotateInterpolate }],
};

if (!session) {
return <Redirect href="/login" />;
Expand Down Expand Up @@ -198,12 +180,10 @@ export default function TabLayout() {
<TouchableOpacity
ref={rightHeaderAddButtonRef}
onPress={() =>
toggleMenu("bottomLeft", rightHeaderAddButtonRef, true)
toggleMenu("bottomLeft", rightHeaderAddButtonRef)
}
>
<Animated.View style={animatedStyle}>
<FontAwesome6 size={32} name="circle-plus" />
</Animated.View>
<FontAwesome6 size={32} name="circle-plus" />
</TouchableOpacity>
),
headerRightContainerStyle: { paddingRight: 16 },
Expand Down Expand Up @@ -270,7 +250,7 @@ export default function TabLayout() {
</Tabs>
<PopupMenu
visible={menuVisible}
onClose={() => toggleMenu("topMiddle", rightHeaderAddButtonRef, true)}
onClose={() => toggleMenu("topMiddle", rightHeaderAddButtonRef)}
position={menuPosition}
positionType={positionType}
/>
Expand Down

0 comments on commit 8f69a7d

Please sign in to comment.