Skip to content

Commit

Permalink
chore: Replace router link touchable component
Browse files Browse the repository at this point in the history
  • Loading branch information
olerichter00 committed Feb 6, 2025
1 parent f78303a commit 59dab71
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/app/system/navigation/RouterLink.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Touchable, TouchableProps } from "@artsy/palette-mobile"
import { TouchableProps } from "@artsy/palette-mobile"
import { navigate } from "app/system/navigation/navigate"
import { ElementInView } from "app/utils/ElementInView"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { usePrefetch } from "app/utils/queryPrefetching"
import { GestureResponderEvent } from "react-native"
import { GestureResponderEvent, TouchableOpacity } from "react-native"

interface RouterLinkProps {
disablePrefetch?: boolean
Expand Down Expand Up @@ -45,13 +45,19 @@ export const RouterLink: React.FC<RouterLinkProps & TouchableProps> = ({
}
}

const touchableProps = {
activeOpacity: 0.65,
onPress: handlePress,
...restProps,
}

if (!isPrefetchingEnabled) {
return <Touchable {...restProps} onPress={handlePress} />
return <TouchableOpacity {...touchableProps} />
}

return (
<ElementInView onVisible={handleVisible}>
<Touchable {...restProps} onPress={handlePress} />
<TouchableOpacity {...touchableProps} />
</ElementInView>
)
}

0 comments on commit 59dab71

Please sign in to comment.