Fix some deprecation warnings

This commit is contained in:
Zoe Roux 2023-11-09 20:37:12 +01:00
parent 8fb46099d4
commit e7c878b30a
10 changed files with 44 additions and 11 deletions

View File

@ -2,6 +2,7 @@
"name": "mobile", "name": "mobile",
"version": "1.0.0", "version": "1.0.0",
"main": "index.tsx", "main": "index.tsx",
"sideEffects": false,
"scripts": { "scripts": {
"dev": "expo start", "dev": "expo start",
"android": "expo start --android", "android": "expo start --android",

View File

@ -2,6 +2,7 @@
"name": "web", "name": "web",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"sideEffects": ["./src/polyfill.ts"],
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",

View File

@ -2,6 +2,7 @@
"name": "@kyoo/models", "name": "@kyoo/models",
"main": "src/index.ts", "main": "src/index.ts",
"types": "src/index.ts", "types": "src/index.ts",
"sideEffects": false,
"packageManager": "yarn@3.2.4", "packageManager": "yarn@3.2.4",
"devDependencies": { "devDependencies": {
"@types/react": "18.2.34", "@types/react": "18.2.34",

View File

@ -2,6 +2,7 @@
"name": "@kyoo/primitives", "name": "@kyoo/primitives",
"main": "src/index.ts", "main": "src/index.ts",
"types": "src/index.ts", "types": "src/index.ts",
"sideEffects": false,
"packageManager": "yarn@3.2.4", "packageManager": "yarn@3.2.4",
"devDependencies": { "devDependencies": {
"@gorhom/portal": "^1.0.14", "@gorhom/portal": "^1.0.14",

View File

@ -53,12 +53,16 @@ export const A = ({
: undefined : undefined
} }
textProps={css( textProps={css(
[
{
fontFamily: theme.font.normal,
color: theme.link,
},
{
userSelect: "text",
} as any,
],
{ {
fontFamily: theme.font.normal,
color: theme.link,
},
{
selectable: true,
hrefAttrs: { target }, hrefAttrs: { target },
...props, ...props,
}, },

View File

@ -73,7 +73,7 @@ const Menu = <AsProps,>({
<MenuContext.Provider value={setOpen}> <MenuContext.Provider value={setOpen}>
<Pressable <Pressable
onPress={() => setOpen(false)} onPress={() => setOpen(false)}
focusable={false} tabIndex={-1}
{...css({ ...StyleSheet.absoluteFillObject, flexGrow: 1, bg: "transparent" })} {...css({ ...StyleSheet.absoluteFillObject, flexGrow: 1, bg: "transparent" })}
/> />
<View <View

View File

@ -69,7 +69,7 @@ export const Slider = ({
onMouseEnter={() => setHover(true)} onMouseEnter={() => setHover(true)}
// @ts-ignore Web only // @ts-ignore Web only
onMouseLeave={() => setHover(false)} onMouseLeave={() => setHover(false)}
focusable tabIndex={0}
onFocus={() => setFocus(true)} onFocus={() => setFocus(true)}
onBlur={() => setFocus(false)} onBlur={() => setFocus(false)}
onStartShouldSetResponder={() => true} onStartShouldSetResponder={() => true}
@ -107,7 +107,7 @@ export const Slider = ({
paddingVertical: ts(1), paddingVertical: ts(1),
// @ts-ignore Web only // @ts-ignore Web only
cursor: "pointer", cursor: "pointer",
focus: focusReset, ...focusReset,
}, },
props, props,
)} )}

View File

@ -22,8 +22,32 @@ import React from "react";
import "react-native"; import "react-native";
declare module "react-native" { declare module "react-native" {
interface PressableStateCallbackType {
hovered?: boolean;
focused?: boolean;
}
interface AccessibilityProps {
tabIndex?: number;
}
interface ViewStyle {
transitionProperty?: string;
transitionDuration?: string;
}
interface TextProps {
href?: string;
hrefAttrs?: {
rel?: "noreferrer";
target?: string;
};
}
interface ViewProps { interface ViewProps {
dataSet?: Record<string, string>; dataSet?: Record<string, string>;
href?: string;
hrefAttrs?: {
rel: "noreferrer";
target?: "_blank";
};
onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
} }
} }

View File

@ -85,7 +85,7 @@ export const Hover = ({
<> <>
<Back isLoading={isLoading} name={showName} href={href} {...css(opacity, props)} /> <Back isLoading={isLoading} name={showName} href={href} {...css(opacity, props)} />
<Pressable <Pressable
focusable={false} tabIndex={-1}
onPointerDown={onPointerDown} onPointerDown={onPointerDown}
onPress={Platform.OS !== "web" ? () => onPointerDown?.({} as any) : undefined} onPress={Platform.OS !== "web" ? () => onPointerDown?.({} as any) : undefined}
{...css( {...css(
@ -247,9 +247,9 @@ export const LoadingIndicator = () => {
return ( return (
<View <View
pointerEvents="none"
{...css({ {...css({
position: "absolute", position: "absolute",
pointerEvents: "none",
top: 0, top: 0,
bottom: 0, bottom: 0,
left: 0, left: 0,

View File

@ -43,6 +43,7 @@ import { useTranslation } from "react-i18next";
import { PlayMode, playModeAtom, subtitleAtom } from "./state"; import { PlayMode, playModeAtom, subtitleAtom } from "./state";
import uuid from "react-native-uuid"; import uuid from "react-native-uuid";
import { Pressable } from "react-native"; import { Pressable } from "react-native";
import "@kyoo/primitives/src/types.d.ts";
import { useYoshiki } from "yoshiki/native"; import { useYoshiki } from "yoshiki/native";
const MimeTypes: Map<string, string> = new Map([ const MimeTypes: Map<string, string> = new Map([
@ -77,7 +78,7 @@ const Video = forwardRef<NativeVideo, VideoProps>(function Video(
return ( return (
<Pressable <Pressable
focusable={false} tabIndex={-1}
onPress={() => onPointerDown?.({ nativeEvent: { pointerType: "pointer" } } as any)} onPress={() => onPointerDown?.({ nativeEvent: { pointerType: "pointer" } } as any)}
{...css({ flexGrow: 1, flexShrink: 1 })} {...css({ flexGrow: 1, flexShrink: 1 })}
> >