Jacse / react-native-app-intro-slider

Simple and configurable app introduction slider for react native
MIT License
1.65k stars 330 forks source link

Event handlers do not work with custom buttons #255

Open bamoha opened 2 years ago

bamoha commented 2 years ago

This is a nice project, but whenever I place a custom render button for skip, next and done, the event to skip or go to the next slide stops working.

const renderTexts = (val) => {
        return (
            <Button variant="unstyled" color="amber.500">{val}</Button>
        )
    }

<AppIntroSlider
      data={slides}
      renderItem={RenderItem}
      onSkip={onSkip}
      onDone={onSkip}
      renderSkipButton={() => renderTexts('Skip')}
      renderDoneButton={() => renderTexts('Done')}
      renderNextButton={() => renderTexts('Next')}
      showSkipButton={true}
      dotStyle={{ backgroundColor: customTheme["color-black"] }}
  />
AhmedRyad22 commented 1 year ago

the same issue in here

himangshuswadesh commented 1 year ago

@bamoha Use View component instead of Button, and style the View component accordingly

 const renderTexts = (val) => {
        return (
            <View>{val}</View>
        )
    }

<AppIntroSlider
      data={slides}
      renderItem={RenderItem}
      onSkip={() => console.log("on Skip")}
      onDone={() => console.log("on Done")}
      renderSkipButton={() => renderTexts('Skip')}
      renderDoneButton={() => renderTexts('Done')}
      renderNextButton={() => renderTexts('Next')}
      showSkipButton={true}
      dotStyle={{ backgroundColor: customTheme["color-black"] }}
  />
Faiz42 commented 9 months ago

@bamoha Use View component instead of Button, and style the View component accordingly

 const renderTexts = (val) => {
        return (
            <View>{val}</View>
        )
    }

<AppIntroSlider
      data={slides}
      renderItem={RenderItem}
      onSkip={() => console.log("on Skip")}
      onDone={() => console.log("on Done")}
      renderSkipButton={() => renderTexts('Skip')}
      renderDoneButton={() => renderTexts('Done')}
      renderNextButton={() => renderTexts('Next')}
      showSkipButton={true}
      dotStyle={{ backgroundColor: customTheme["color-black"] }}
  />

I think you forgot the Text element as we can't render text directly inside View

MaanLad commented 3 weeks ago

Does the solution function correctly? And if not, which other libraries have you utilized in place of react-native-app-intro-slider?