callstack / callstack/react-native-paper

Focus a Searchbar in a Menu component hides the modal in expo-web

Đang mở
#4,606 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug Menu
Ngôn ngữ chính
TypeScript
Star
14.5k
Fork
2.2k
Merge trung bình
5 ngày 23 giờ
Pull request đã merge (30 ngày)
12

Mô tả

### Current behaviour
I have a search bar into a menu tag, clicking on it makes the full menu modal disappear.
This is an issue happening on `5.13.1`.

On the version`5.12.5` we had a similar issue where the `dismiss` of the modal was fired after clicking on the SearchBar, but we had added a flag to check if the search bar was focused or not and that made the job.

### Expected behavior
Clicking on the search bar shall not fire `onBlur` and not hide the modal at all

### How to reproduce?

This is the relevant part of the code, not the full file

```
const [showCountryPicker, setShowCountryPicker] = useState(false)
const [isSearchFocused, setIsSearchFocused] = useState(false)
console.log('showCountryPicker', showCountryPicker)
return (
{
console.log('dismiss', { isSearchFocused, showCountryPicker })

// Only dismiss if search isn't focused
if (!isSearchFocused) {
setShowCountryPicker(false)
}
}}
anchor={
{
console.log('touchStart')
setShowCountryPicker(true)
}
: undefined
}
right={
{
console.log('onPress')
setShowCountryPicker(!showCountryPicker)
}}
/>
}
dense
mode="outlined"
/>
}>
{
console.log('onFocus')
setIsSearchFocused(true)
}}
/>


)
```

### Preview

### What have you tried so far?
Trying to prevent the events on blur.

### Your Environment

I can reproduce this in my local machine and in the staging server

| software | version
| --------------------- | -------
|react-native-web | ~0.19.13
| react-native | 0.73.6
| react-native-paper | 5.13.1
| node | v21.6.2
| pnpm | 8.11.0
| expo sdk | ~50.0.21

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.