microsoft / microsoft/react-native-windows

Nesting non-Text Components in Text is Unsupported

Open
#6,315 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API: Completion Area: Text enhancement Workstream: Component Parity
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

We try to QI the child to xaml::Documents::Inline and fail

void TextViewManager::AddView(const XamlView &parent, const XamlView &child, int64_t index) {
  auto textBlock(parent.as<xaml::Controls::TextBlock>());
  auto childInline(child.as<winrt::Inline>());
  textBlock.Inlines().InsertAt(static_cast<uint32_t>(index), childInline);
}

Can be reproed by clicking on the bookmarks button in the redesigned RNTester when none are present, when trying to render this component.

const EmptyState = () => (
  <View style={styles.emptyContainer}>
    <View style={styles.emptyContainerInner}>
      <Image
        source={require('../assets/empty.png')}
        resizeMode="contain"
        style={styles.emptyImage}
      />
      <View>
        <Text style={styles.heading}>Bookmarks are empty</Text>
        <Text style={styles.subheading}>
          Please tap the{' '}
          <Image
            source={require('../assets/bookmark-outline-gray.png')}
            resizeMode="contain"
            style={styles.bookmarkIcon}
          />{' '}
          icon to bookmark examples.
        </Text>
      </View>
    </View>
  </View>
);

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by clicking the bookmarks button in the redesigned RNTester when no bookmarks are present, using the EmptyState example in the issue. Start at TextViewManager::AddView and trace the child conversion and insertion into TextBlock.Inlines(); done means this empty state renders without the reported failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
desktop-dev, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.