Last active
August 26, 2020 20:54
-
-
Save Krisztiaan/11856c0faffc70f00766b7f791375a75 to your computer and use it in GitHub Desktop.
Simple react-native-tvos typescript support. Use with `patch-package`.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/@types/react-native/index.d.ts b/node_modules/@types/react-native/index.d.ts | |
index dba6a80..114a383 100644 | |
--- a/node_modules/@types/react-native/index.d.ts | |
+++ b/node_modules/@types/react-native/index.d.ts | |
@@ -63,6 +63,41 @@ | |
import * as React from 'react'; | |
+export const TVMenuControl: { | |
+ enableTVMenuKey(): void; | |
+ disableTVMenuKey(): void; | |
+}; | |
+ | |
+export interface HWKeyEvent { | |
+ eventType: string; | |
+ eventKeyAction: number; | |
+ tag?: number; | |
+}; | |
+ | |
+export class TVEventHandler { | |
+ enable<T extends React.Component<unknown>>( | |
+ component?: T, | |
+ callback?: (component: T, data: HWKeyEvent) => void | |
+ ): void; | |
+ disable(): void; | |
+}; | |
+ | |
+export interface FocusGuideProps extends ViewProps { | |
+ /** | |
+ * Array of `Component`s to register as destinations with `UIFocusGuide` | |
+ */ | |
+ destinations?: (null | number | React.Component<any, any> | React.ComponentClass<any>)[] | |
+}; | |
+ | |
+/** | |
+ * This component provides support for Apple's `UIFocusGuide` API, | |
+ * to help ensure that focusable controls can be navigated to, | |
+ * even if they are not directly in line with other controls. | |
+ * An example is provided in `RNTester` that shows two different ways of using this component. | |
+ * https://github.com/react-native-community/react-native-tvos/blob/master/RNTester/js/TVFocusGuideExample.js | |
+ */ | |
+export declare class TVFocusGuideView extends React.Component<FocusGuideProps> {} | |
+ | |
type Constructor<T> = new (...args: any[]) => T; | |
export type MeasureOnSuccessCallback = ( |
Yeah I'll look into it tomorrow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
would it make sense to add this to DefinitelyTyped? and follow the same approach as the
react-native-tvos
module and have users change theirpackage.json
manually:I would definitely add a few contributions