Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing - Missing accessibilityLabel in ReactVideoProps #3427

Closed
delphinebugner opened this issue Dec 19, 2023 · 4 comments · Fixed by #3434
Closed

Typing - Missing accessibilityLabel in ReactVideoProps #3427

delphinebugner opened this issue Dec 19, 2023 · 4 comments · Fixed by #3434

Comments

@delphinebugner
Copy link
Contributor

delphinebugner commented Dec 19, 2023

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-video@6.0.0-beta.2 for the project I'm working on.

After the upgrade (from 5.2.1 to 6.0.0-beta.2), typing broke for accessibilityLabel of Video - even if it is actually taken into account in the test after!

Without the fix:

TS error= Property 'accessibilityLabel' does not exist on type 'IntrinsicAttributes & ReactVideoProps'

import Video, { IgnoreSilentSwitchType, ReactVideoProps, ResizeMode } from 'react-native-video';

export const TF1Video = (props: ReactVideoProps) => {
  return (
    <Video
      muted={true}
      repeat={true}
      resizeMode={ResizeMode.COVER}
      rate={1.0}
      ignoreSilentSwitch={IgnoreSilentSwitchType.OBEY}
      accessibilityLabel="TF1video" // 🐞🐞  TS error= Property 'accessibilityLabel' does not exist on type 'IntrinsicAttributes & ReactVideoProps'
      {...props}
    />
  );
};

It was okay in previous version of lib (5.2.1).
It's only a TS issue, in my test screen.getByLabelText('TF1video') works! 👌

With the fix

After adding it: TypeScript happy 😊
image

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-video/lib/types/video.d.ts b/node_modules/react-native-video/lib/types/video.d.ts
index f61eda2..96b43d1 100644
--- a/node_modules/react-native-video/lib/types/video.d.ts
+++ b/node_modules/react-native-video/lib/types/video.d.ts
@@ -129,6 +129,7 @@ export declare enum PosterResizeModeType {
     STRETCH = "stretch"
 }
 export interface ReactVideoProps extends ReactVideoEvents {
+    accessibilityLabel?: string;
     source?: ReactVideoSource;
     drm?: Drm;
     style?: StyleProp<ViewStyle>;

On the lib, it could / should probably be on the types/video.ts file?
I may open a PR for it, if pertinent!

This issue body was partially generated by patch-package.

@KrzysztofMoch
Copy link
Member

Hey 👋, @delphinebugner
How about make ReactVideoProps extends AccessibilityProps ? It should do the job
I would appreciate it if you could make a PR!

@freeboub
Copy link
Collaborator

@KrzysztofMoch @delphinebugner would it make sens to also add testID prop ?!

@delphinebugner
Copy link
Contributor Author

Great idea for the accessibility props, it will add everything @KrzysztofMoch! I'll do it soon 🙂

@freeboub I think accessibility label is a better standard than test ID, but I guess the last ones are still widely used, so yes we should add them to!

@KrzysztofMoch
Copy link
Member

Will be available in next release (6.0.0-beta.3).
@delphinebugner Thank you for you PR 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants