Rework Pressable to handle ripple on android

This commit is contained in:
Zoe Roux 2023-01-08 21:22:20 +09:00 committed by Zoe Roux
parent a6c645c33f
commit 04eae360a7
2 changed files with 6 additions and 4 deletions

View File

@ -19,10 +19,11 @@
*/
import React, { ComponentProps, ComponentType, ForwardedRef, forwardRef } from "react";
import { Pressable, Platform, PressableProps, ViewStyle } from "react-native";
import { Platform, PressableProps, ViewStyle } from "react-native";
import { SvgProps } from "react-native-svg";
import { YoshikiStyle } from "yoshiki/dist/type";
import { px, useYoshiki } from "yoshiki/native";
import { PressableFeedback } from "./links";
import { ts } from "./utils";
declare module "react" {
@ -71,7 +72,7 @@ export const IconButton = forwardRef(function _IconButton<AsProps = PressablePro
) {
const { css } = useYoshiki();
const Container = as ?? Pressable;
const Container = as ?? PressableFeedback;
return (
<Container

View File

@ -27,6 +27,7 @@ import {
IconButton,
Link,
Poster,
PressableFeedback,
Skeleton,
Slider,
tooltip,
@ -34,7 +35,7 @@ import {
} from "@kyoo/primitives";
import { Chapter, Font, Track } from "@kyoo/models";
import { useAtomValue, useSetAtom, useAtom } from "jotai";
import { Pressable, View, ViewProps } from "react-native";
import { View, ViewProps } from "react-native";
import { useTranslation } from "react-i18next";
import { percent, rem, useYoshiki } from "yoshiki/native";
import { useRouter } from "solito/router";
@ -177,7 +178,7 @@ export const Back = ({
>
<IconButton
icon={ArrowBack}
{...(href ? { as: Link as any, href: href } : { as: Pressable, onPress: router.back })}
{...(href ? { as: Link as any, href: href } : { as: PressableFeedback, onPress: router.back })}
{...tooltip(t("player.back"))}
/>
<Skeleton>