This file contains hidden or 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
| { | |
| "name": "use-fuse", | |
| "version": "1.0.1", | |
| "main": "useFuse.ts" | |
| } |
This file contains hidden or 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
| { | |
| "name": "use-debounce", | |
| "version": "1.0.0", | |
| "main": "useDebounce.ts" | |
| } |
This file contains hidden or 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 { useState, useEffect } from 'react' | |
| export default function useDebouncedState<T>(value: T, delay: number) { | |
| const [debouncedValue, setDebouncedValue] = useState<T>(value) | |
| useEffect(() => { | |
| const handler = setTimeout(() => setDebouncedValue(value), delay) | |
| return () => clearTimeout(handler) | |
| }, [value, delay, setDebouncedValue]) |
This file contains hidden or 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; | |
| }; |
This file contains hidden or 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 { useState, useCallback } from 'react' | |
| import { LayoutChangeEvent } from 'react-native' | |
| interface Measurement { | |
| width: number | |
| height: number | |
| } | |
| type OnLayoutCallback = (event: LayoutChangeEvent) => void |
This file contains hidden or 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; |
This file contains hidden or 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 React, { useContext, useEffect, useState, useCallback } from 'react'; | |
| import { TouchableWithoutFeedbackProps } from 'react-native'; | |
| import useDelayedState from './useDelayedState'; | |
| const FocusChangeContext = React.createContext<(isFocused: boolean, instant?: boolean) => void>( | |
| () => undefined | |
| ); | |
| const HasFocusContext = React.createContext<boolean>(false); |
This file contains hidden or 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
| type ValuesOf<T> = T extends { [key: string]: infer T } ? T : never | |
| // type Parameters<T> = T extends (...args: infer T) => any ? T : never | |
| type FirstParameter<T> = T extends (first: infer T, ...args: any) => any ? T : never | |
| type SecondParameter<T> = T extends (first: any, second: infer T, ...args: any) => any ? T : never | |
| type PromiseValue<T> = T extends Promise<infer U> | |
| ? U | |
| : T extends (...args: any[]) => Promise<infer U> | |
| ? U | |
| : T | |
| type Require<T, P extends keyof T> = T & Required<Pick<T, P>> |
This file contains hidden or 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 useDebounce from "react-use/lib/useDebounce"; | |
| import { useMemo, useState, Dispatch, SetStateAction } from "react"; | |
| import Fuse, { FuseOptions } from "fuse.js"; | |
| export default <T>( | |
| data: ReadonlyArray<T>, | |
| fuseOptions: FuseOptions<T>, | |
| debounce: number = 500 | |
| ): [ReadonlyArray<T>, string, Dispatch<SetStateAction<string>>] => { | |
| const [filteredData, setFilteredData] = useState(data); |