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

[PickerIOS] Indicator line missing #14442

Closed
louietan opened this issue Jun 10, 2017 · 11 comments
Closed

[PickerIOS] Indicator line missing #14442

louietan opened this issue Jun 10, 2017 · 11 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@louietan
Copy link

Description

Hi, you all!

When I'm trying to make a custom component by combining several PickerIOS components, I found a strange behavior on PickerIOS that the indicator lines sometimes are disappeared. Just like this:

Reproduction Steps and Sample Code

Here is my code. It can't be reproduced using Snack, so I created a repo https://github.com/louietan/PickerIOSIssue, my code is in file index.ios.js

Pushing that "toggle pickers" again and again, you will find that the indicators of the last one or two pickers sometimes displayed but sometimes disappeared.

import React, { Component } from 'react';
import {
  AppRegistry,
  Button,
  PickerIOS,
  View
} from 'react-native';

export default class PickerIOSIssue extends Component {
  constructor(props) {
    super(props)
    
    this.state = { showPickers: true }
  }
    
  times(repeat, cb) {
    let result = []
    for(let i = 0; i < repeat; ++i) result.push(i)
    return result.map(cb)
  }

  render() {
    return (
      <View style={{flex: 1, flexDirection: 'column', marginTop: 50}}>
	
        <Button title='toggle pickers' onPress={() => this.setState({showPickers: !this.state.showPickers})} />

        {this.state.showPickers &&
        <View style={{ flexDirection: 'row'}}>
          { this.times(3, index => (
            <PickerIOS key={index}
                       style={{flex: 1}}>
                {this.times(100, index => (
                  <PickerIOS.Item key={index} value={index} label={index.toString()} />
                ))}
            </PickerIOS>
          ))}
        </View>}

      </View>
    );
  }
}

AppRegistry.registerComponent('PickerIOSIssue', () => PickerIOSIssue);

Additional Information

  • React Native version: 0.45.1
  • Platform: iOS 10.2 (virtual device, but also exists in a real device, I'll provide the version later)
  • Development Operating System: macOS
@pvinis
Copy link
Contributor

pvinis commented Jun 12, 2017

try with this #13342

@louietan
Copy link
Author

Thank you @pvinis ! it worked for me.

@louietan
Copy link
Author

@pvinis , could you explain the rationale behind this?

@pvinis
Copy link
Contributor

pvinis commented Jun 25, 2017

well, to be honest, https://stackoverflow.com/questions/39564660/uipickerview-selection-indicator-not-visible-in-ios10.

i know its not the best, but it works, until apple or we figure out what the real problem is.

@ignatevdev
Copy link

Experiencing the same issue over here.
Indicator lines disappear and reappear randomly in Simulator and on my iphone as well

@pvinis
Copy link
Contributor

pvinis commented Jul 24, 2017

did you try my fix/fork/branch/pr?

@ignatevdev
Copy link

@pvinis Tried to apply those changes locally and it fixed the problem. But one can't rely on local changes of modules, since they will be overwritten on any clean install and your PR was closed :(

Hope dev team will merge the fix somehow

@pvinis
Copy link
Contributor

pvinis commented Jul 24, 2017

i know, and thats why i ask, so maybe it can be merged finally :D

@pvinis
Copy link
Contributor

pvinis commented Jul 24, 2017

actually, i tried rntester on master now, and it seems to be fixed.

@ignatevdev
Copy link

Well, I tried a clean install yesterday with 0.46.4, it didn't help. Event 0.47-rc-4 didn't help either, but I will try once again

@pull-bot
Copy link

pull-bot commented Oct 9, 2017

Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally!

If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:

  • Does the issue still reproduce on the latest release candidate? Post a comment with the version you tested.
  • If so, is there any information missing from the bug report? Post a comment with all the information required by the issue template.
  • Is there a pull request that addresses this issue? Post a comment with the PR number so we can follow up.

If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution.

@hramos hramos added the Icebox label Oct 9, 2017
@hramos hramos closed this as completed Oct 9, 2017
facebook-github-bot pushed a commit that referenced this issue Jul 21, 2018
Summary:
This PR is based on #13342 by pvinis and fixes #14442.

As suggested in the discussion on the PR mentioned above, I moved the code from `React/Views/RCTPickerManager.m` to the `initWithFrame` function in `React/Views/RCTPicker.m` and verified that it still fixes the problem.

Before the change in this PR the selection indicator lines are missing when the Picker is initially added to the View and only appear after changing to a different Tab and back. This happens both in the Simulator and my real device (iPhone 6S on iOS 11.3).

![beforechange](https://user-images.githubusercontent.com/7568362/38824104-7b294cae-41a8-11e8-8609-7a647ab3adb8.png)

After the change, the indicator lines always appear. I did not notice any side effects of this change when playing around with the Picker in different configurations.

![afterchange](https://user-images.githubusercontent.com/7568362/38824109-82a5b382-41a8-11e8-8af3-ca07c8b2c30e.png)

#13342 also fixes this issue but appears to be inactive.

[IOS] [BUGFIX] [PickerIOS] - Fixed missing selection indicator lines
Pull Request resolved: #18885

Differential Revision: D8945483

Pulled By: hramos

fbshipit-source-id: 2b6c6f42559691530b062503feb24bc305f4a8af
@facebook facebook locked as resolved and limited conversation to collaborators Oct 9, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants