Skip to content

Commit

Permalink
Blur inserter search when keyboard closes (#34278)
Browse files Browse the repository at this point in the history
Co-authored-by: jhnstn <[email protected]>
  • Loading branch information
jhnstn and jhnstn authored Aug 25, 2021
1 parent 6897116 commit 2b3e162
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions packages/components/src/search-control/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TouchableOpacity,
Platform,
useColorScheme,
Keyboard,
} from 'react-native';

/**
Expand Down Expand Up @@ -116,12 +117,18 @@ function SearchControl( {
setCurrentStyles( futureStyles );
}, [ isActive, isDark ] );

useEffect(
() => () => {
useEffect( () => {
const keyboardHideSubscription = Keyboard.addListener(
'keyboardDidHide',
() => {
onCancel();
}
);
return () => {
clearTimeout( onCancelTimer.current );
},
[]
);
keyboardHideSubscription.remove();
};
}, [] );

const {
'search-control__container': containerStyle,
Expand Down

0 comments on commit 2b3e162

Please sign in to comment.