react-native-bottom-sheet icon indicating copy to clipboard operation
react-native-bottom-sheet copied to clipboard

Android does not scroll

Open mehderilker opened this issue 4 years ago • 14 comments

Hi,

Works great on iOS devices when I use it with the @gorhom/react-native-wheely repo. But it does not scroll on Android devices.

IOS Working:

https://user-images.githubusercontent.com/26353461/151627950-7855d5b6-8a77-4e2c-a1e3-58ff56fb1560.mp4

Android Not Working:

https://user-images.githubusercontent.com/26353461/151628009-64e37565-75b8-4540-b166-acd81cba0297.mp4

Example Code:

import React, {useCallback,useRef,useMemo) from 'react'
import BottomSheet, {
  BottomSheetView
} from '@gorhom/bottom-sheet';
import WheelPicker from 'react-native-wheely';
const Example = () => {
  const snapPoints = useMemo(() => ['30%', '50%', '60%', '90%'], []);
  const renderBackdrop = useCallback(
    props => (
      <BottomSheetBackdrop
        disappearsOnIndex={-1}
        appearsOnIndex={0}
        {...props}
      />
    ),
    [],
  );

  const ref = useRef(null);
const handleSheetChanges = useCallback(index => {
    console.log('handleSheetChange', index);
  }, []);
  const handleSnapPress = useCallback((index, refId) => {
    console.log('handleSnapPress', index, refId);
    ref.current?.snapToIndex(index);
  }, []);
  const handleClosePress = useCallback(refId => {
    ref.current?.close();
  }, []);

return(
<View>
   <BottomSheet
        index={1}
        backdropComponent={backdropComponent}
        animateOnMount={true}
        enablePanDownToClose={true}
        keyboardBehavior="extend"
        handleIndicatorStyle={{
          backgroundColor: '#E4E7EC',
          width: scale(70),
        }}
        handleStyle={{backgroundColor: '#F9FAFB', borderRadius: 10}}
        ref={ref}
        snapPoints={snapPoints}
        onChange={handleSheetChanges}>
         <BottomSheetView>
  <WheelPicker
          selectedIndex={selectedIndex}
          containerStyle={styles.container}
          selectedIndicatorStyle={styles.selectedIndicator}
          itemTextStyle={styles.itemText}
          itemStyle={styles.item}
          options={options}
          onChange={onChange}
        />
  </BottomSheetView>

    </BottomSheet>
    </View>
)
}

Dependency

"@gorhom/bottom-sheet": "^4.1.5",
   "react-native-reanimated": "^2.3.1",
   "react-native-gesture-handler": "^2.1.1",
   "react-native-wheely": "^0.3.2",

mehderilker avatar Jan 28 '22 22:01 mehderilker

@mehderilker: hello! :wave:

This issue is being automatically closed because it does not follow the issue template.

github-actions[bot] avatar Jan 28 '22 22:01 github-actions[bot]

Have you solved it?

ftzi avatar Feb 23 '22 03:02 ftzi

I am facing the same issue

kunal-oxl avatar Mar 02 '22 07:03 kunal-oxl

Have you solved it?

No, I couldn't solve it.

mehderilker avatar Mar 02 '22 10:03 mehderilker

worked for me by wrapping with gestureHandlerRootHOC from react-native-gesture-handler

cresenciof avatar Apr 17 '22 06:04 cresenciof

worked for me by wrapping with gestureHandlerRootHOC from react-native-gesture-handler

Wrapping what? I tried to do this and now I have a GestureView covering half the screen making this solution unusable.

balloman avatar Apr 27 '22 03:04 balloman

worked for me by wrapping with gestureHandlerRootHOC from react-native-gesture-handler

Wrapping what? I tried to do this and now I have a GestureView covering half the screen making this solution unusable.

Ok, I was able to fix this by wrapping the entire screen component in gestureHandlerRootHOC

balloman avatar Apr 27 '22 22:04 balloman

worked for me by wrapping with gestureHandlerRootHOC from react-native-gesture-handler

Wrapping what? I tried to do this and now I have a GestureView covering half the screen making this solution unusable.

Ok, I was able to fix this by wrapping the entire screen component in gestureHandlerRootHOC

that's it, sorry a bit late, this is how it worked for me:

const ExploreScreen = gestureHandlerRootHOC(() => {
    ...
    return (
      <BottomSheet
        enableHandlePanningGesture={true}
        enableContentPanningGesture={true}
        ... 
        >
         <BottomSheetFlatList .... />
      </BottomSheet>
    );
 });

cresenciof avatar Apr 28 '22 02:04 cresenciof

Why this solution works?

ftzi avatar Apr 28 '22 05:04 ftzi

worked for me by wrapping with gestureHandlerRootHOC from react-native-gesture-handler

Wrapping what? I tried to do this and now I have a GestureView covering half the screen making this solution unusable.

Ok, I was able to fix this by wrapping the entire screen component in gestureHandlerRootHOC

This didnt work for me and neither did using the BottomSheetFlatlist. When I use it the list is blank, though I do see it passing data to each render item.

jorgegvallejo avatar Jul 11 '22 01:07 jorgegvallejo

for me, i have to wrapping the entire screen component in gestureHandlerRootHOC and setting enableContentPanningGesture={false}

brianlaw033 avatar Nov 22 '22 06:11 brianlaw033

I try to wrap the App component in gestureHandlerRootHOC and it works

levanthuanmy avatar Jan 19 '23 09:01 levanthuanmy

gestureHandlerRootHOC = wrap app by GestureHandleRootView though

fukemy avatar Mar 14 '23 07:03 fukemy

enableContentPanningGesture={false} on BottomSheet worked for me 👍

dan-herasymov avatar Apr 17 '23 19:04 dan-herasymov