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.

Warning: Failed prop type: Invalid prop `textStyle` of type `array` supplied to `Cell`, expected `object`.

See original GitHub issue

Warning: Failed prop type: Invalid prop textStyle of type array supplied to Cell, expected object. Cell in Row (created by App) in RCTView (created by View) in View (created by Table) in Table (created by App) in RCTView (created by View) in View (created by App) in App (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:16
  • Comments:14

github_iconTop GitHub Comments

9reactions
AfterFXcommented, May 28, 2022

@Moglie2817 for now you can simply update your package.json file to include @slice312’s fork (I don’t think we’ll be able to use the tagged versions from this repo as the original creator has stopped maintaining, see README). To do this, just replace this line in your dependencies:

"dependencies": {
    ...
    "react-native-table-component": "https://github.com/slice312/react-native-table-component.git"
    ...
}

You should be able to just yarn or npm install and it’ll work. Hope this helps!

Thank you! Works.

7reactions
gbuiltcommented, Feb 26, 2022

Inside Rows.js line 29:

// textStyle={[cellTextStyle && cellTextStyle(item), textStyle]}   // This throws browser Warning: Failed prop type: Invalid prop `textStyle` of type `array` supplied to `Cell`, expected `object`.
textStyle={cellTextStyle && cellTextStyle(item), textStyle}.  // This seems to resolve the error without adverse effects. But I didn't quite follow what cellTextStyle() as a function is doing. Needs more research.

UPDATE:

After a little more research, I don’t think the above will work when there is a cellTextStyle passed in. But this below will work properly:

if (!!cellTextStyle) {
      textStyle = {...cellTextStyle(item), ...textStyle};
}

That properly extends the object. (But it makes we question which should go first to override the other…?) And then, in the <Cell ... tag we pass that as itself as an object, not an array:

// textStyle={[cellTextStyle && cellTextStyle(item), textStyle]}   // This throws browser Warning: Failed prop type: Invalid prop `textStyle` of type `array` supplied to `Cell`, expected `object`.
textStyle={textStyle} 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Failed prop type: Invalid prop `textStyle` of type ...
this is my code which going to create a table, it is working well but every time its showing me the (Warning: Failed...
Read more >
failed prop type: invalid prop `rows` of type `object` supplied to ...
Warning : Failed prop type: Invalid prop rows of type object supplied to ForwardRef(DataGrid), expected array.` Solution I believe the problem is in...
Read more >
How To Customize React Components with Props
PropTypes are a simple type system to check that data matches the expected types during runtime. They serve as both documentation and an...
Read more >
How to Use PropTypes in React - freeCodeCamp
Props are the read-only properties that are shared between components to give the unidirectional flow of React a dynamic touch. They're mainly ...
Read more >
Invalid prop `textStyle` of type `array` supplied to `Cell ...
Coding example for the question Warning: Failed prop type: Invalid prop `textStyle` of type `array` supplied to `Cell`, expected `object`-React Native.
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