Temp action sheet fix for Android

This commit is contained in:
Diego Mello 2024-04-05 09:16:28 -03:00
parent 1c7ee34d03
commit 25b4250ab9
3 changed files with 9 additions and 8 deletions

View File

@ -32,13 +32,14 @@ const ActionSheet = React.memo(
const [data, setData] = useState<TActionSheetOptions>({} as TActionSheetOptions); const [data, setData] = useState<TActionSheetOptions>({} as TActionSheetOptions);
const [isVisible, setVisible] = useState(false); const [isVisible, setVisible] = useState(false);
const animatedContentHeight = useSharedValue(0); const animatedContentHeight = useSharedValue(0);
const animatedHandleHeight = useSharedValue(0); // const animatedHandleHeight = useSharedValue(0);
const animatedDataSnaps = useSharedValue<TActionSheetOptions['snaps']>([]); const animatedDataSnaps = useSharedValue<TActionSheetOptions['snaps']>([]);
const animatedSnapPoints = useDerivedValue(() => { const animatedSnapPoints = useDerivedValue(() => {
if (animatedDataSnaps.value?.length) { if (animatedDataSnaps.value?.length) {
return animatedDataSnaps.value; return animatedDataSnaps.value;
} }
const contentWithHandleHeight = animatedContentHeight.value + animatedHandleHeight.value; // FIXME: review handleHeight
const contentWithHandleHeight = animatedContentHeight.value; // + animatedHandleHeight.value;
// Bottom sheet requires a default value to work // Bottom sheet requires a default value to work
if (contentWithHandleHeight === 0) { if (contentWithHandleHeight === 0) {
return ['25%']; return ['25%'];
@ -152,7 +153,7 @@ const ActionSheet = React.memo(
ref={bottomSheetRef} ref={bottomSheetRef}
// If data.options exist, we calculate snaps to be precise, otherwise we cal // If data.options exist, we calculate snaps to be precise, otherwise we cal
snapPoints={data.options?.length ? snaps : animatedSnapPoints} snapPoints={data.options?.length ? snaps : animatedSnapPoints}
handleHeight={animatedHandleHeight} // handleHeight={animatedHandleHeight}
// We need undefined to enable vertical swipe gesture inside the bottom sheet like in reaction picker // We need undefined to enable vertical swipe gesture inside the bottom sheet like in reaction picker
contentHeight={data.snaps?.length || data.options?.length ? undefined : animatedContentHeight} contentHeight={data.snaps?.length || data.options?.length ? undefined : animatedContentHeight}
animationConfigs={ANIMATION_CONFIG} animationConfigs={ANIMATION_CONFIG}

View File

@ -30,7 +30,7 @@
"dependencies": { "dependencies": {
"@bugsnag/react-native": "^7.10.5", "@bugsnag/react-native": "^7.10.5",
"@codler/react-native-keyboard-aware-scroll-view": "^2.0.1", "@codler/react-native-keyboard-aware-scroll-view": "^2.0.1",
"@gorhom/bottom-sheet": "4.4.5", "@gorhom/bottom-sheet": "^4.6.1",
"@hookform/resolvers": "^2.9.10", "@hookform/resolvers": "^2.9.10",
"@notifee/react-native": "7.8.2", "@notifee/react-native": "7.8.2",
"@nozbe/watermelondb": "0.25.5", "@nozbe/watermelondb": "0.25.5",

View File

@ -2831,10 +2831,10 @@
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==
"@gorhom/bottom-sheet@4.4.5": "@gorhom/bottom-sheet@^4.6.1":
version "4.4.5" version "4.6.1"
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-4.4.5.tgz#b9041b01ce1af9a936e7c0fc1d78f026d759eebe" resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-4.6.1.tgz#e45e2183246e338cf732fe4f8f2c91875b22ddce"
integrity sha512-Z5Z20wshLUB8lIdtMKoJaRnjd64wBR/q8EeVPThrg+skrcBwBPHfUwZJ2srB0rEszA/01ejSJy/ixyd7Ra7vUA== integrity sha512-sXqsYqX1/rAbmCC5fb9o6hwSF3KXriC0EGUGvLlhFvjaEEMBrRKFTNndiluRK1HmpUzazVaYdTm/lLkSiA2ooQ==
dependencies: dependencies:
"@gorhom/portal" "1.0.14" "@gorhom/portal" "1.0.14"
invariant "^2.2.4" invariant "^2.2.4"