From 7ce943ef3bf6e3c3b74bbcdbe0e125e3843e8924 Mon Sep 17 00:00:00 2001 From: Alejandro Paredes Alva Date: Wed, 14 Mar 2018 13:04:41 -0700 Subject: [PATCH] Adds _lineHeight = NAN; to RCTTextAttributes Summary: On iOS, when the parent Text contains the `lineHeight` style prop, and the children are also Text components they don't inherit the lineHeight prop. This is for **iOS** only. Create a react-native project with React Native 0.54.0 or 0.54.1 and change the app to: ```js import React, { Component } from 'react'; import { StyleSheet, Text, View } from 'react-native'; type Props = {}; export default class App extends Component { render() { return ( I am bold and orange, I am bold and red, I am bold and blue, I am bold and purple, I am bold and yellow, I am bold and pink ); } } const styles = StyleSheet.create({ container: { backgroundColor: 'black', flex: 1, justifyContent: 'center', padding: 50, }, }); ``` It displays: ![iphone - 2018-03-12 at 21 51 53](https://user-images.githubusercontent.com/480605/37308941-b56f082e-263f-11e8-9c23-892f77077169.png) But should look like: ![iphone - 2018-03-12 at 21 48 15](https://user-images.githubusercontent.com/480605/37308784-4efaddf2-263f-11e8-992b-ee0b6bb9a97b.png) New <Text> iOS https://github.com/facebook/react-native/commit/2716f53 [IOS] [MINOR] [Text] - Inherit lineheight Closes https://github.com/facebook/react-native/pull/18340 Differential Revision: D7276655 Pulled By: shergin fbshipit-source-id: 0fe26536bb74da77be8405911fc699a622bc0b2f --- Libraries/Text/RCTTextAttributes.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index 6427e303158bb9..d74e0ab7611b57 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -21,6 +21,7 @@ - (instancetype)init if (self = [super init]) { _fontSize = NAN; _letterSpacing = NAN; + _lineHeight = NAN; _textDecorationStyle = NSUnderlineStyleSingle; _fontSizeMultiplier = NAN; _alignment = NSTextAlignmentNatural;