question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Headless component not working as expected on real device

See original GitHub issue

Describe the bug The wrapped component feature seems to work fine on a simulator, but doesn’t work on a real device (tested on pixel 2, and galaxy 9+). in a simulator I’m able to tap on my component wrapped by RNPickerSelect, and the picker comes up, however on a real android device, it doesn’t seem to work, or it works, but sporadically, it works on both real and simulated iPhones.

To Reproduce

Here is some test code that I’ve been using:

import React, { Component } from 'react';
import {
  View,
  Text,
} from 'react-native';

import RNPickerSelect from 'react-native-picker-select';

export default class MyComponent extends Component {
  constructor(props) {
    super(props);

    this.state = {
      pickerList: null
    };
  }
  render() {
    return (
        <KeyboardAvoidingView
          style={styles.container}
          behavior="padding"
          enabled
        >
           <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
              <View style={{flex:1}}>
                <RNPickerSelect
                  placeholder={{}}
                  items={MyList} // insert whatever elements you want in the picker this doesn't seem to change the issue
                  onValueChange={(itemValue, itemIndex) => {
                    this.setState({
                      prop: 'pickerList',
                      value: itemValue
                    });
                  }}
                  c >
                <View style={{height:height * 0.5}}>
                  <Text>
                    Test Text where I should be able to touch to get things to happen
                  </Text>
                </View>
              </RNPickerSelect>
              <View style={{flex:1}}>
                <Text>test</Text>
              </View>
            </View>

          </TouchableWithoutFeedback>
        </KeyboardAvoidingView>
    );
  }
}
const pickerSelectStyles = StyleSheet.create({
  viewContainer: {
    flex:1,
    backgroundColor: 'purple',
  },
  headlessAndroidContainer: {
    backgroundColor: 'purple',
    flex:1
  }
});

Expected behavior I expect to have two equal divs, one purple and one white. I should be able to click on the purple section and the picker pops up, I should be able to click on the white section and nothing happens.

Screenshots If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device (real): Pixel 2, Galaxy S9+, Iphone 6s
  • Device (Simulated): Pixel 2, iPhone Xs,
  • OS: Android 9 (pi) samsung experience 8, iOS 8
  • react-native-picker-select version: ^4.4.0
  • react-native version: 0.54.4
  • react version: [e.g. 16.3]

Hopefully this helps or is already solved somewhere. Thanks!

edit: Updated to hopefully make more clear how I’m using this component. I’ll try and provide a working example when I have a bit more time.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
spot1000commented, Oct 26, 2018

So… I feel a little silly… It seems that the newest version of the code (version 5) fixes this issue. or at least on the 1 android device that I just tested it on.

0reactions
spot1000commented, Nov 2, 2018

Yeah, seems to be that you just can’t have this component wrapped in a touchablewithoutFeedback tag, which you should probably never have to do I think? I think it probably has something to do with the fact that you probably should have touchablewithoutfeedback as a child of a touchablewithoutfeedback parent.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using React-native-picker-select headless component
This is working as expected on a simulator, but not on a real android device. on a real device, it seems that I'm...
Read more >
Headless components in React and why I stopped using a UI ...
In this blog post I'll explain the problems we encounter when working with major UI libraries and the solution for those problems -...
Read more >
Using Headless Mode in the Java SE Platform - Oracle
The Java SE platform contains headless mode capabilities -- a system configuration in which the display device, keyboard, or mouse is lacking.
Read more >
Headless JS - React Native
Headless JS is a way to run tasks in JavaScript while your app is ... The function passed to setTimeout does not always...
Read more >
Run React Native background tasks with Headless JS
Headless JS is a way to run JavaScript tasks in the background. ... I prefer testing on a real device, so for instance,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found