Migrated hooks/autoCompleteSheet to TypeScript
Summary: Migrated autoCompleteSheet.js to autoCompleteSheet.tsx Reviewed By: danielbuechele Differential Revision: D17133608 fbshipit-source-id: eba06c5add7687e013b8f0e2b430b359dbf1cb48
This commit is contained in:
committed by
Facebook Github Bot
parent
950bbbf97d
commit
5877c1df96
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {Glyph, styled} from 'flipper';
|
||||
import {useItemNavigation} from '../hooks/autoCompleteSheet';
|
||||
import {useItemNavigation} from '../hooks/autoCompleteSheet.tsx';
|
||||
import {filterProvidersToLineItems} from '../util/autoCompleteProvider.tsx';
|
||||
|
||||
import type {AutoCompleteProvider} from '../flow-types';
|
||||
|
||||
@@ -3,20 +3,19 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
* @flow strict-local
|
||||
*/
|
||||
|
||||
import {useEffect, useState} from 'react';
|
||||
import type {AutoCompleteLineItem} from '../flow-types';
|
||||
import {AutoCompleteLineItem} from '../types';
|
||||
|
||||
export const useItemNavigation = (
|
||||
lineItems: Array<AutoCompleteLineItem>,
|
||||
onHighlighted: string => void,
|
||||
onHighlighted: (uri: string) => void,
|
||||
) => {
|
||||
const [selectedItem, setSelectedItem] = useState(0);
|
||||
|
||||
const handleKeyPress = ({key}) => {
|
||||
switch (key) {
|
||||
const handleKeyPress = (event: KeyboardEvent) => {
|
||||
switch (event.key) {
|
||||
case 'ArrowDown': {
|
||||
const newSelectedItem =
|
||||
selectedItem < lineItems.length - 1
|
||||
Reference in New Issue
Block a user