question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

V7 getByText no longer find translation string

See original GitHub issue

Describe the bug

In our codebase, we implement translation with jsLingui and have code like this:

// trivial implementation of Trans

const Trans = (message) => message;

const Component = () => (
    <Text>
      <Trans>There was a problem fetching data.</Trans>
    </Text>
)

Trans would render a string. Previously, getByText("There was a problem fetching data.") would return a match and it no longer does

Expected behavior

getByText("There was a problem fetching data.") should return a match

Steps to Reproduce

See above

Screenshots

debug() would render

        <Text>
          There was a problem fetching data.
        </Text>

Versions

  npmPackages:
    @testing-library/react-native: ^7.0.2 => 7.0.2
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2
    react-test-renderer: 16.11.0 => 16.11.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
jbolotincommented, Oct 28, 2020

Experiencing this as well with react-intl

1reaction
dattarzadeh-evidationcommented, Oct 30, 2020

We are possibly experiencing this as well. We are using i18n-js and expo-localization. We are on react-native v0.63.3.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - getByText doesn't find the element
When false, matches substrings and is not case-sensitive. exact has no effect on regex or function arguments. In most cases using a regex ......
Read more >
gettext v0.20.0
Extract for more information on the extraction process. POT files are just template files and the translations in them do not actually contain...
Read more >
ByText
This will search for all elements that have a text node with textContent matching the given TextMatch . <a href="/about"> ...
Read more >
Translating localization strings
The Localize string dialog shows the content of the string in the default language, and you can fill in a translation for all...
Read more >
How to Test React Components: the Complete Guide
I found this to be true as well for React testing. ... Unlike your react components, your tests are not executed in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found