mirror of
https://github.com/standardnotes/mobile.git
synced 2026-04-19 05:39:20 -04:00
fix: chips not hiding when clicking cancel
This commit is contained in:
@@ -222,7 +222,10 @@ export const NoteList = (props: Props) => {
|
||||
<AndroidSearchBar
|
||||
ref={androidSearchBarInputRef}
|
||||
onChangeText={onChangeSearchText}
|
||||
onCancel={props.onSearchCancel}
|
||||
onCancel={() => {
|
||||
props.onSearchCancel();
|
||||
onSearchBlur();
|
||||
}}
|
||||
onDelete={props.onSearchCancel}
|
||||
onFocus={onSearchFocus}
|
||||
onBlur={onSearchBlur}
|
||||
|
||||
@@ -95,6 +95,10 @@ export const Notes = React.memo(
|
||||
const [includeTrashedNotes, setIncludeTrashedNotes] = useState<boolean>(
|
||||
true
|
||||
);
|
||||
const [
|
||||
protectedTogglingStarted,
|
||||
setProtectedTogglingStarted,
|
||||
] = useState<boolean>(false);
|
||||
const [shouldFocusSearch, setShouldFocusSearch] = useState<boolean>(false);
|
||||
|
||||
// Ref
|
||||
@@ -179,6 +183,17 @@ export const Notes = React.memo(
|
||||
[application, navigation, openNote]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
const removeBlurScreenListener = navigation.addListener('blur', () => {
|
||||
if (protectedTogglingStarted) {
|
||||
setProtectedTogglingStarted(false);
|
||||
setShouldFocusSearch(true);
|
||||
}
|
||||
});
|
||||
|
||||
return removeBlurScreenListener;
|
||||
}, [navigation, protectedTogglingStarted]);
|
||||
|
||||
useEffect(() => {
|
||||
let mounted = true;
|
||||
const removeEditorObserver = application?.editorGroup.addChangeObserver(
|
||||
@@ -264,7 +279,7 @@ export const Notes = React.memo(
|
||||
);
|
||||
|
||||
const toggleIncludeProtected = useCallback(async () => {
|
||||
setShouldFocusSearch(true);
|
||||
setProtectedTogglingStarted(true);
|
||||
|
||||
const includeProtected = !includeProtectedNoteText;
|
||||
const allowToggling = includeProtected
|
||||
|
||||
Reference in New Issue
Block a user