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

iOS: Enable views to be nested within <Text> #7304

Closed
wants to merge 2 commits into from

Commits on May 7, 2016

  1. iOS: Enable views to be nested within <Text>

    Previously, only Text and Image could be nested within Text. Now, any
    view can be nested within Text. One restriction of this feature is
    that developers must give inline views a width and a height via
    the style prop.
    
    Previously, inline Images were supported by using iOS's built-in support
    for rendering images with an NSAttributedString via NSTextAttachment.
    However, NSAttributedString doesn't support rendering arbitrary views.
    
    This change adds support for nesting views within Text by creating one
    NSTextAttachment per inline view. The NSTextAttachments act as placeholders.
    They are set to be the size of the corresponding view. After the text is
    laid out, we query the text system to find out where it has positioned each
    NSTextAttachment. We then position the views to be at those locations.
    
    This commit also contains a change in RCTShadowText.m
    _setParagraphStyleOnAttributedString:heightOfTallestSubview:. It now only sets
    lineHeight, textAlign, and writingDirection when they've actually changed. This
    avoids unnecessarily dirtying the shadow tree which is important in some inline
    view scenarios.
    Adam Comella committed May 7, 2016
    Configuration menu
    Copy the full SHA
    98d75ff View commit details
    Browse the repository at this point in the history

Commits on May 9, 2016

  1. Adjust vertical alignment of inline views

    The vertical alignment should now be consistent
    with how iOS vertically positions an inline
    image rendered with an NSTextAttachment.
    Adam Comella committed May 9, 2016
    Configuration menu
    Copy the full SHA
    2aef442 View commit details
    Browse the repository at this point in the history