Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Disable Control Buttons #530

Closed
SSTPIERRE2 opened this issue Aug 23, 2017 · 5 comments
Closed

Cannot Disable Control Buttons #530

SSTPIERRE2 opened this issue Aug 23, 2017 · 5 comments

Comments

@SSTPIERRE2
Copy link
Contributor

SSTPIERRE2 commented Aug 23, 2017

Which OS ?

iOS

Version

Which versions are you using:

  • react-native-swiper v? ^1.5.10
  • react-native v0.?.? 0.44.0

Expected behaviour

Ability to use some prop to selectively disable either control button (specifically to match the scrollEnabled={false} use case).

Actual behaviour

Cannot disable either control button by any means.

How to reproduce it>

To help us, please fork this component, modify one example in examples folder to reproduce your issue and include link here.

<Swiper
        showsButtons
        nextButton={<TouchableOpacity style={{ zIndex: 1 }} disabled><Image source=
                             {nextButtonImage} /></TouchableOpacity>}
        prevButton={<Image source={prevButtonImage} style={{ alignItems: 'center' }} />}
        scrollEnabled={false}
        loop={false}
      >
        <ComponentWithDisabledButtonUntilSomeConditionIsMet />
        <Component 2 />
</Swiper>

Steps to reproduce

  1. Create a basic swiper and a couple basic slides to test
  2. Initially disable scrolling for the swiper
  3. Attempt to match the control buttons to this behavior by disabling the forward button

My Use Case

Basically, I have a slide in a swiper where the user can only proceed to the next slide if they meet a certain condition, so I need to selectively disable the nextButton.

I can see in the source code that the reason the code above to reproduce doesn't work is because the custom element you pass in becomes wrapped in a touchable which you cannot modify to disable, so I'm happy to PR a quick new prop if you'd like :)

@SSTPIERRE2
Copy link
Contributor Author

Please ignore the first reference. I mistakenly PR'd to my own forked repo!

@SSTPIERRE2
Copy link
Contributor Author

Looking for some review, please and thank you! I'll add any documentation or anything else I may have missed, just let me know.

@SSTPIERRE2
Copy link
Contributor Author

@leecade anybody out there? haha

@SSTPIERRE2
Copy link
Contributor Author

@arribbar Hello there I noticed you're active on here, would you like to check out my small proposition?

@arribbar
Copy link
Collaborator

arribbar commented Sep 8, 2017

#531 merged now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants