From 28c1c88ef7edf6146201f906db2aa88c6dfde899 Mon Sep 17 00:00:00 2001 From: Alin Panaitiu Date: Wed, 23 Aug 2017 20:27:48 -0700 Subject: [PATCH] Adjust row height by font size in PickerIOS Summary: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. There is a problem where setting a bigger fontSize in PickerItem style clips the top and bottom of the text. This solves that problem by computing the row height using the font size. Create a PickerIOS component and set a larger font size (e.g. 50). The row height will grow accordingly. Example with `fontSize=50`: [Screenshot](http://i.imgur.com/YwK5fOc.png) Closes https://github.com/facebook/react-native/pull/13513 Differential Revision: D5692124 Pulled By: shergin fbshipit-source-id: 4629403e37ad68cdbc0b17b48ba924a77e133078 --- React/Views/RCTPicker.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/React/Views/RCTPicker.m b/React/Views/RCTPicker.m index d29dd2e414c..b9ac79387bd 100644 --- a/React/Views/RCTPicker.m +++ b/React/Views/RCTPicker.m @@ -70,6 +70,10 @@ numberOfRowsInComponent:(__unused NSInteger)component return [RCTConvert NSString:_items[row][@"label"]]; } +- (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component { + return _font.pointSize + 19; +} + - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component