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.

ListItem typescript error with 2.3.0

See original GitHub issue

Explain what you did (Required)

Tried to follow the upgrade guide for 2.3.0. Im upgrading from 2.1.0.

Changed my old code:

<ListItem
    title="Edit message"
    leftIcon={{ name: 'edit' }}
    onPress={() => {
      setMenu(false)
      setEditing(true)
    }}
/>

to:

<ListItem
      onPress={() => {
        setMenu(false)
        setEditing(true)
      }}
        >
      <ListItem.Content>
        <Icon name="edit" />
        <ListItem.Title>Edit message</ListItem.Title>
      </ListItem.Content>
</ListItem>

Expected behavior (Required)

Successful typescript compile.

Describe the bug (Required)

Got a typescript error:

Property 'Content' does not exist on type 'typeof ListItem'.  TS2339

214 |           <ListItem.Content>
    |                     ^

I also get the same error for ListItem.Title:

Property 'Title' does not exist on type 'typeof ListItem'. TS2339

To Reproduce (Required)

We highly recommend that you re-create the bug on Snack. If not, list the steps that a reviewer can take to reproduce the behaviour:

Screenshots (Required)

Your Environment (Required):

software version
react-native-elements 2.3.0
react-native 0.63.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
M-Jascommented, Jan 28, 2021

@flyingcircle If the Raw Text lint rule was some random obscure rule I’d 100% remove it, but its not. I can’t be the only person with this rule on and passing text into the ListItem.Text component. The React Native Elements core hasn’t shut it off. Thanks for the quick response 👋

1reaction
M-Jascommented, Jan 28, 2021

I know this is closed but I’m still seeing this issue for ListItem.Title & ListItem.Subtitle for passing raw text. My components work and the text is visible, but the lint warning is gross. Any suggestions?

            <ListItem>
              <ListItem.Content>
                 // Lint Error: Raw text (Office) cannot be used outside of a <Text> tageslint(react-native/no-raw-text)
                <ListItem.Title >Office</ListItem.Title>
                <ListItem.Subtitle >Address</ListItem.Subtitle>
              </ListItem.Content>
            </ListItem>
Read more comments on GitHub >

github_iconTop Results From Across the Web

error in typescript for each loop syntax - Stack Overflow
it's just a linting error, it's telling you to use const instead of let in that for because you are never reassining prop...
Read more >
Upgrading to 15.5.x causes TS2559 errors to appear in ...
After upgrading from 15.4.x to 15.5.x, a large number of TS2559 errors appear in the Error List window and offending types are underlined...
Read more >
Write efficient, error-free and safe regular expressions in ...
Hello JavaScript and TypeScript developers, We just released a set of rules to help you write efficient, error-free, and safe regular ...
Read more >
knex - npm
Latest version: 2.3.0, last published: 4 months ago. ... TypeScript icon, indicating that this package has built-in type declarations. 2.3.0 ...
Read more >
Swagger Codegen Documentation
2.3.0 (upcoming minor release), TBD, 1.0, 1.1, 1.2, 2.0, Minor releases with breaking ... To get a list of languages supported by 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