react-native-onboarding-swiper icon indicating copy to clipboard operation
react-native-onboarding-swiper copied to clipboard

Replace 'skip' button with 'previous' button

Open bodrius opened this issue 4 years ago • 5 comments

Please answer me, ty

bodrius avatar Nov 10 '20 20:11 bodrius

Please translate your question from Russian into English: https://www.deepl.com/translator

jfilter avatar Nov 10 '20 21:11 jfilter

Is it possible to add a "prev" button?

guadalupeperezb avatar Jan 12 '21 19:01 guadalupeperezb

Not 100% sure, but you may try to set onSkip prop to a function to go the previous page. Something like:

  goPev = () => {
    this.flatList.scrollToIndex({
      animated: true,
      index:
        I18nManager.isRTL && Platform.OS == 'ios'
          ? this.state.currentPage + 1
          : this.state.currentPage - 1,
    });
  };

Otherwise, fork the repo change the skip handling there.

jfilter avatar Jan 14 '21 23:01 jfilter

did anyone find the solution to replace skip into prev btn?

pantpradeep avatar Apr 28 '21 11:04 pantpradeep

You can use

SkipButtonComponent={Skip}

where Skip is your react component.

then define Skip as

const Skip = ({ isLight, skipLabel, ...props }) => ( <TextButton {...props} textSize='font16' textColor='primary' textWeight='regular' onPress={handleOnPrev} style={{ marginLeft: 16, paddingHorizontal: 16 }}> Prev </TextButton> );

my snippet is a custom component but you should get an idea!

and finally you have to attach a state to showSkip={showSkipState}

this state is controlled via the "pageIndexCallback"! when pageIndexCallback return 1 set showSkipState to false! else true.

jeremiahjoyjoseph avatar Jan 07 '22 14:01 jeremiahjoyjoseph