Coder Social home page Coder Social logo

Comments (9)

DaRizat avatar DaRizat commented on August 15, 2024 2

So I solved this problem for myself by wrapping the Picker component with a view configured like this:

     <View
          onStartShouldSetResponder={() => true}
          onResponderGrant={(event) => /* Handle touched state here */}
     >
         <Picker> ... </Picker>
     </View>

The onResponderGrant event fires when the Picker is touched and from there you can manage the touched state of the input.
I believe the Picker component inherits these listeners itself so there's probably no need for the wrapper View but I had it there for style already so I chose to put the listeners there.

from picker.

villanuevadani avatar villanuevadani commented on August 15, 2024 1

@clamiax did you manage to try that with Pressable?

from picker.

programminPete avatar programminPete commented on August 15, 2024 1

@DaRizat - that worked for me - thank you! Note - I did need to use the wrapper; putting the responder events on the Picker itself didn't trigger

For my case, I have another button to advance screen after setting the value from , but if someone pushed button very quickly after changing the picker it wouldn't set state correctly in time. But using your wrapper technique I was able to disable the button while moving and re-enable once the onValueChange event fired - good stuff! thanks

from picker.

donatas-vindzigalskis avatar donatas-vindzigalskis commented on August 15, 2024

This issue was moved from react-native library, as suggested by @TheSavior 's comment, link to the pull request raised on react native repository.

from picker.

jainkuniya avatar jainkuniya commented on August 15, 2024

hi @donatas-vindzigalskis, can you try wrapping picker component with touchable components like TouchableHighlight?

from picker.

bitsmanent avatar bitsmanent commented on August 15, 2024

hi @donatas-vindzigalskis, can you try wrapping picker component with touchable components like TouchableHighlight?

Just tried and doesn't works. I can't currently try with new Pressable API though.

from picker.

bitsmanent avatar bitsmanent commented on August 15, 2024

@clamiax did you manage to try that with Pressable?

@villanuevadani No, I will need to upgrade my project which I can't do right now.

from picker.

tetianastepova avatar tetianastepova commented on August 15, 2024

I tried it with Pressable and no luck.

Does anyone know any workaround for this?
This is so strange that such an important thing is missing in library that is advised by react-native documentation...

from picker.

Naturalclar avatar Naturalclar commented on August 15, 2024

🎉 This issue has been resolved in version 1.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from picker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.