Comments (9)
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.
@clamiax did you manage to try that with Pressable?
from picker.
@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.
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.
hi @donatas-vindzigalskis, can you try wrapping picker component with touchable components like TouchableHighlight
?
from picker.
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.
@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.
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.
🎉 This issue has been resolved in version 1.16.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from picker.
Related Issues (20)
- Picker 2.6+ transforms numeric values to strings HOT 4
- Selected value jumps back to first value when "Done" is tapped - Picker library v2.6.1, iOS only HOT 3
- @react-native-picker/picker could not be found within the project or in these directories
- react-native 0.71.8 with @react-native-picker/picker HOT 3
- can't remove gray background on IOS picker HOT 1
- On iOS, the value selected in onValueChange comes in null
- Picker Item is not listed on IOS HOT 10
- Border styles is not working HOT 2
- the problem of selectionColor HOT 3
- New version(2.7.0) compile time issue in android | Keeps app crashing HOT 3
- Facing Error when create debug app build: public record ReactPickerLocalData(int height) { ^ (use -source 16 or higher to enable records) HOT 4
- Error after npm run android HOT 2
- Run Android triggers Execution failed for task ':app:mergeLibDexDebug'
- how to disable font scaling of @react-native-picker/picker HOT 1
- Attempt to invoke interface method 'com.facebook.react.bridge.ReadableNativeMap com.facebook.react.uimanager.StateWrapper.getStateData()' on a null object reference HOT 2
- onValueChange callback has its arg only accepting string type now HOT 5
- enabled={false} not working on ios HOT 1
- Unable to close the selector without selecting item.
- Invariant Violation: requireNativeComponent: "RNCAndroidDialogPicker" was not found in the UIManager. HOT 2
- invariant Violation: requireNativeComponent: "RNCAndroidDialogPicker" was not found in the UIManager
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picker.