react-native-pages icon indicating copy to clipboard operation
react-native-pages copied to clipboard

how to disable swipe ?

Open krunaldodiya opened this issue 4 years ago • 1 comments

Hi, this is a nice library, however it would be great if it includes swipeEnabled={false} so that, instead of manually swipe one can use programmatically swiping

krunaldodiya avatar Nov 05 '20 04:11 krunaldodiya

I've achieved this behavior with scrollEnabled prop (undocumented) set to false and the scrollToPage method:

function Onboarding() {
  const pages = useRef(null);

  useEffect(() => {
    pages.current.scrollToPage(2);
  }, []);

  return (
    <View>
      <Pages ref={pages} scrollEnabled={false}>
        <View />
        <View />
        <View />
      </Pages>
    </View>
  );
}

guytepper avatar Jan 16 '21 08:01 guytepper