mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Co-authored-by: sarendsen <coding-mosses0z@icloud.com> Co-authored-by: Lance Chant <13349722+lancechant@users.noreply.github.com> Co-authored-by: Gauvain <68083474+Gauvino@users.noreply.github.com>
1.5 KiB
1.5 KiB
Nested Modals with PlatformDropdown
Issue
PlatformDropdowns inside BottomSheetModals don't open on Android.
Solution
-
Add controlled state for each PlatformDropdown:
const [open, setOpen] = useState(false); <PlatformDropdown open={open} onOpenChange={setOpen} // ... /> -
Use
Viewfor triggers, notTouchableOpacity:// ✅ Correct <PlatformDropdown trigger={<View>...</View>} /> // ❌ Wrong - causes nested TouchableOpacity conflicts <PlatformDropdown trigger={<TouchableOpacity>...</TouchableOpacity>} /> -
Add
stackBehavior='push'to parent BottomSheetModal:<BottomSheetModal stackBehavior='push' // ... /> -
Reset dropdown states on modal dismiss:
const handleDismiss = useCallback(() => { setDropdown1Open(false); setDropdown2Open(false); // reset all dropdown states onDismiss?.(); }, [onDismiss]); <BottomSheetModal onDismiss={handleDismiss} // ... />
Why
- PlatformDropdown wraps triggers in TouchableOpacity on Android. Nested TouchableOpacity causes touch event conflicts.
- PlatformDropdown's useEffect should only call
showModal()whenopen === true, not callhideModal()whenopen === false(interferes with parent modals). - Dropdown states must be reset on modal dismiss to prevent them from reopening automatically when parent modal reopens.