Skip to content

Commit

Permalink
fix missing selection indicator lines (#18885)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
VSchlattinger authored and facebook-github-bot committed Jul 21, 2018
1 parent b4b594c commit e592d6f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions React/Views/RCTPicker.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ - (instancetype)initWithFrame:(CGRect)frame
_selectedIndex = NSNotFound;
_textAlign = NSTextAlignmentCenter;
self.delegate = self;
[self selectRow:0 inComponent:0 animated:YES]; // Workaround for missing selection indicator lines (see https://stackoverflow.com/questions/39564660/uipickerview-selection-indicator-not-visible-in-ios10)
}
return self;
}
Expand Down

1 comment on commit e592d6f

@pvinis
Copy link
Contributor

@pvinis pvinis commented on e592d6f Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.