Created
September 9, 2020 20:27
-
-
Save Krisztiaan/3d24c7a3c3d4dd8d206c12903adc61d7 to your computer and use it in GitHub Desktop.
react-native-tvos@0.62.2-1 typescript typing extension
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
import '@types/react-native'; | |
import React from 'react'; | |
import { ViewProps } from 'react-native'; | |
declare module 'react-native' { | |
export const TVMenuControl: { | |
enableTVMenuKey(): void; | |
disableTVMenuKey(): void; | |
}; | |
interface HWFocusEvent { | |
eventType: 'blur' | 'focus'; | |
eventKeyAction: -1; | |
tag: number; | |
} | |
export type HWKeyEvent = | |
| HWFocusEvent | |
| { | |
eventType: 'up' | 'down' | 'right' | 'left' | string; | |
eventKeyAction: -1 | 1 | 0 | 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 class TVFocusGuideView extends React.Component<FocusGuideProps> {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment