diff --git a/src/components/KeyboardDismissingFlatList/index.js b/src/components/KeyboardDismissingFlatList/index.js deleted file mode 100644 index 0ca8504d96ab..000000000000 --- a/src/components/KeyboardDismissingFlatList/index.js +++ /dev/null @@ -1,51 +0,0 @@ -import React, {useRef, useEffect, useCallback} from 'react'; -import {FlatList, Keyboard} from 'react-native'; -import * as DeviceCapabilities from '../../libs/DeviceCapabilities'; - -function KeyboardDismissingFlatList(props) { - const isScreenTouched = useRef(false); - - useEffect(() => { - if (!DeviceCapabilities.canUseTouchScreen()) { - return; - } - - const touchStart = () => { - isScreenTouched.current = true; - }; - - const touchEnd = () => { - isScreenTouched.current = false; - }; - - // We're setting `isScreenTouched` in this listener only for web platforms with touchscreen (mWeb) where - // we want to dismiss the keyboard only when the list is scrolled by the user and not when it's scrolled programmatically. - document.addEventListener('touchstart', touchStart); - document.addEventListener('touchend', touchEnd); - - return () => { - document.removeEventListener('touchstart', touchStart); - document.removeEventListener('touchend', touchEnd); - }; - }, []); - - const onScroll = useCallback(() => { - // Only dismiss the keyboard whenever the user scrolls the screen - if (!isScreenTouched.current) { - return; - } - Keyboard.dismiss(); - }, []); - - return ( - - ); -} - -KeyboardDismissingFlatList.displayName = 'KeyboardDismissingFlatList'; - -export default KeyboardDismissingFlatList; diff --git a/src/components/KeyboardDismissingFlatList/index.native.js b/src/components/KeyboardDismissingFlatList/index.native.js deleted file mode 100644 index 97297528ac77..000000000000 --- a/src/components/KeyboardDismissingFlatList/index.native.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import {FlatList, Keyboard} from 'react-native'; - -function KeyboardDismissingFlatList(props) { - return ( - Keyboard.dismiss()} - /> - ); -} - -KeyboardDismissingFlatList.displayName = 'KeyboardDismissingFlatList'; - -export default KeyboardDismissingFlatList;