toggle not working in Android.
See original GitHub issueDescribe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Use TouchableWithoutFeedback
onPress
I am toggling withthis.pickerRef.current.togglePicker(false)
Expected behavior
Should open the picker
Screenshots
null
Additional details
- Device: Android
- OS: 10
- react-native-picker-select version: 8.0.4
- react-native version: 0.63.3
- expo sdk version: [ n/a]
Reproduction and/or code sample
<RNPickerSelect
disabled={!editable}
onValueChange={(v) => this.handleValueChange(v)}
value={selectedValue}
style={{ maxHeight: 0 }}
ref={this.pickerRef}
onUpArrow={this.onArrowUp}
InputAccessoryView={this.InputAccessoryView}
onDownArrow={this.onDownArrow}
style={{
chevronUp: {
fontSize: 0,
color: 'white',
},
}}
items={values}>
<View style={{ height: 0 }}></View>
</RNPickerSelect>
<TouchableWithoutFeedback
onPress={() => {
console.log('toogle');
this.pickerRef.current.togglePicker(false);
}}>
<View style={[styles.inputContainer, style]}>
{selectedValue.trim().length > 0 ? (
<>
<Text style={styles.labelStyle}>{placeholder}</Text>
<Text style={styles.textInputStyle}>{label}</Text>
</>
) : (
<>
<Text style={styles.labelStyle}>{placeholder}</Text>
</>
)}
</View>
</TouchableWithoutFeedback>
</>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:6
Top Results From Across the Web
Toggle button not toggling on Android - Stack Overflow
ToggleButton s, like all CompoundButton s, take care of their own checked state upon clicking. Your OnClickListener is counteracting that ...
Read more >Shell.Current.FlyoutIsPresented = true does not toggle the first ...
Run the attached example. Tap on the "Toggle Flyout" button. Nothing happens. Swipe flyout manually. Tap on the "Toggle Flyout" button again.
Read more >Known Tasker Issues And Workarounds - joaoapps.com
Google has changed the way Android works for apps that target API 29, so Tasker can't toggle wifi anymore. Check here for more...
Read more >Mouse Toggle not working on Chromecast after update to ...
The mouse toggle functionality stopped working after i updated the Chromecast with Google Tv to the new Android 12. The mouse pointer pops...
Read more >navbar dropdown toggling not working
*Expected behavior*When I click the outside of dropdown menu, it should be disappeared. *Actual behavior*Still show.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hasnaina-entertainer this should work. As per this commit https://github.com/react-native-picker/picker/pull/258 (thanks @mateusz1913)
Short answer (Android only)
and then
To make this work for Android & iOS you can do something like this
and then
I got message for
pickerProps={{ ref: this.pickerRef }}
: Type ‘{ ref: React.MutableRefObject<undefined>; }’ is not assignable to type ‘CustomPickerProps’. Also, I tried @bacarybruno solution and I always getCannot read properly "openPicker" of null
.