Skip to content

[PickerIOS] Indicator line missing #14442

@louietan

Description

@louietan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions