Skip to content

Commit

Permalink
fix: Remove debounce
Browse files Browse the repository at this point in the history
* iOS seems to have problems when not called from main thread or something. Removed debouncing.
  • Loading branch information
lukashaertel committed Sep 14, 2024
1 parent 6407112 commit e951e75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
9 changes: 2 additions & 7 deletions src/components/generic/containers/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useThemeBackground, useThemeBorder, useThemeColorValue } from "../../..
import { Continuous } from "../atoms/Continuous";
import { Icon, IconNames } from "../atoms/Icon";
import { Label } from "../atoms/Label";
import { useDebounce } from "../../../hooks/util/useDebounce";
import { Row } from "./Row";

const iconSize = 26;
Expand Down Expand Up @@ -52,13 +51,9 @@ export const Header: FC<HeaderProps> = (props) => {
const styleBorder = useThemeBorder("darken");

const navigation = useNavigation();

const onBack = useDebounce(() => navigation.goBack(), [navigation]);
const onSecondary = useDebounce(() => ("secondaryIcon" in props ? props.secondaryPress() : undefined), [props]);

return (
<Row style={[styles.container, styleBackground, styleBorder, props.style]} type="center" variant="spaced">
<TouchableOpacity hitSlop={backHitSlop} containerStyle={styles.back} onPress={onBack}>
<TouchableOpacity hitSlop={backHitSlop} containerStyle={styles.back} onPress={() => navigation.goBack()}>
<Icon name="chevron-left" size={iconSize} color={colorValue} />
</TouchableOpacity>

Expand All @@ -68,7 +63,7 @@ export const Header: FC<HeaderProps> = (props) => {

{/* Optional secondary action. */}
{!("secondaryIcon" in props) ? null : (
<TouchableOpacity hitSlop={secondaryHitSlop} containerStyle={styles.secondary} onPress={onSecondary}>
<TouchableOpacity hitSlop={secondaryHitSlop} containerStyle={styles.secondary} onPress={() => props.secondaryPress()}>
<Icon name={props.secondaryIcon} size={iconSize} color={colorValue} />
</TouchableOpacity>
)}
Expand Down
6 changes: 0 additions & 6 deletions src/hooks/util/useDebounce.ts

This file was deleted.

11 changes: 3 additions & 8 deletions src/routes/dealers/Dealers.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TFunction } from "i18next";
import moment, { Moment } from "moment-timezone";

import { useMemo } from "react";
import { Platform, Share } from "react-native";
import { Share } from "react-native";

import { DealerDetailsInstance, dealerInstanceForAny } from "../../components/dealers/DealerCard";
import { dealerSectionForCategory, dealerSectionForLetter, dealerSectionForLocation, DealerSectionProps } from "../../components/dealers/DealerSection";
Expand Down Expand Up @@ -177,17 +177,12 @@ export const useDealerAlphabeticalGroups = (t: TFunction, now: Moment, results:
return result;
}, [t, now, results, all]);
};
export const shareDealer = (dealer: DealerDetails) => {
if (Platform.OS === "web") {
console.log("share");
return;
}
return Share.share(
export const shareDealer = (dealer: DealerDetails) =>
Share.share(
{
title: dealer.DisplayNameOrAttendeeNickname,
url: `${appBase}/Web/Dealers/${dealer.Id}`,
message: `Check out ${dealer.DisplayNameOrAttendeeNickname} on ${conAbbr}!\n${appBase}/Web/Dealers/${dealer.Id}`,
},
{},
).catch(captureException);
};

0 comments on commit e951e75

Please sign in to comment.