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 crashes unexpectedly on Web

See original GitHub issue

I upgraded React Native Elements to v2.3.1 and expo-cli to 3.25.1. I expected the web application to work with warnings about deprecated props on ListItem but when I start the app in web version an unexpected error occures in ListItem: ListItem.js:41 Uncaught TypeError: Cannot read property 'grey' of undefined at renderIcon (ListItem.js:41) at ListItem (ListItem.js:220)

Here is an example on Snack to reproduce. https://snack.expo.io/yzVlD7RBS

I don’t know if it helps but debugging it turned out the theme.colors.platform (at line 41 of ListItem) object doesn’t contain any “default” property image

These are the lines where I put the breakpoint in the ListItem file and where the error occurs: const renderIcon = (content, theme) => renderNode(Icon, content, { color: Platform.select(theme.colors.platform).grey, size: 24, });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mikehenkencommented, Sep 7, 2020

Really easy fix!

I resolved this locally by adding grey to the theme for platform “default”.

import { ListItem, ThemeProvider} from 'react-native-elements';
const theme = {  
  colors: {
    platform: {
      "default": {
        "grey": "#FFF"
      }
    }
  }
};

<ThemeProvider theme={theme}>
  <ListItem bottomDivider>
    <ListItem.Content>
      <ListItem.Title>
        Tracks
      </ListItem.Title>
    </ListItem.Content>
    <ListItem.Chevron />
  </ListItem>
</ThemeProvider>

Apparently someone put grey0 instead of grey as platform default. IOS & Android use grey, default uses grey0. See: https://github.com/react-native-elements/react-native-elements/blob/ed6e90d55f18f371ce606019c28f937f816ea3a8/src/list/ListItem.js#L41 And https://github.com/react-native-elements/react-native-elements/blob/62066e442e49630bb8490f5eb9f24412024945a1/src/config/colors.js#L8

0reactions
pranshuchittoracommented, Sep 17, 2020

Closing the issue. Fixed in #2561 If the issue still persists then feel free to reopen the issue. Happy Hacking 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Game crashes or closes unexpectedly - Microsoft Support
Explains what to do if a Microsoft game crashes or closes unexpectedly when you try to start the game.
Read more >
9 Ways to Get Chrome to Stop Crashing - Nira
This will show you a list of all the times Chrome crashed and when those crashes took ... Additionally, web browsers don't simply...
Read more >
Fix Chrome if it crashes or won't open - Computer
To fix: Open More More and then Settings. At the bottom, click Advanced and then System. Turn off Use hardware acceleration when available....
Read more >
Tomcat crashes unexpectedly - java - Stack Overflow
Hard JVM crashes (that result in an "err_pid" dump file) are typically attributable to bugs in 1st / 3rd native code libraries, ...
Read more >
Why Do Websites Crash? 7 Reasons Your Site Is Down
Your website is written in code – that's what makes it look and work the way it does. If you made changes to...
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