dohooo / react-native-table-component

🌱Build table for react native
MIT License
730 stars 188 forks source link

TypeError: Cannot read property 'style' of undefined #141

Open ayoubkhan558-zz opened 3 years ago

ayoubkhan558-zz commented 3 years ago

× TypeError: Cannot read property 'style' of undefined Module.D:\OnGoing Projects\FinanceReactNativeDesign\node_modules\react-native-table-component\components\cell.js D:/OnGoing Projects/FinanceReactNativeDesign/node_modules/react-native-table-component/components/cell.js:6

image

tiomun commented 3 years ago

Also have this issue. Just installed this module, and tried to use Example1 shown here: https://www.npmjs.com/package/react-native-table-component and received the same error.

aliwhosane commented 2 years ago

Going through the same issue. Is this repo still being maintained?

andyasberry commented 2 years ago

Doesn't seem like it ☹️

andyasberry commented 2 years ago

We are using this package and the fix suggested in #138 seemed simple enough (thanks to the author of that PR!!!). I don't have hopes that a fix will be published anytime soon (last publish ~2 yrs ago), so I went full pirate and forked the repo, applied #138 and published that package to npm: https://www.npmjs.com/package/react-native-table-component-2

❗ Please note that we are not intending to maintain/support that package. It's just a workaround to get over this hump. Still, maybe this will help someone else, also.

We are also using TypeScript, and have installed @types/react-native-table-component as a dev dependency. What we ended up doing for TypeScript support is a quick-and-dirty module declaration:

// types/react-native-table-component-2.d.ts
import * as RNTC from '@types/react-native-table-component';

// NOTE: see node_modules/@types/react-native-table-component/index.d.ts
declare module 'react-native-table-component-2' {
    // NOTE: columns
    export interface CellProps extends RNTC.CellProps {};
    export class Cell extends RNTC.Cell {};
    export interface ColProps extends RNTC.ColProps {};
    export class Col extends RNTC.Col {};
    export interface ColsProps extends RNTC.ColsProps {};
    export class Cols extends RNTC.Cols {};

    // NOTE: rows
    export interface RowProps extends RNTC.RowProps {};
    export class Row extends RNTC.Row {};
    export interface RowsProps extends RNTC.RowsProps {};
    export class Rows extends RNTC.Rows {};

    // NOTE: table
    export interface TableProps extends RNTC.TableProps {};
    export class Table extends RNTC.Table {};
    export interface TableWrapperProps extends RNTC.TableWrapperProps {};
    export class TableWrapper extends RNTC.TableWrapper {};
};

and configure TypeScript to recognize it:

// tsconfig.json
{
  ...
  "include": [ ..., "types/**/*.d.ts"]
}
vikash-0741 commented 2 years ago

@andyasberry there's a PR which takes care of typescript changes, can you merge that as well in your pirate package? https://github.com/Gil2015/react-native-table-component/pull/140

andyasberry commented 2 years ago

@andyasberry there's a PR which takes care of typescript changes, can you merge that as well in your pirate package?

https://github.com/Gil2015/react-native-table-component/pull/140

I'll take a look at this today! Thank you!

andyasberry commented 2 years ago

@andyasberry there's a PR which takes care of typescript changes, can you merge that as well in your pirate package?

https://github.com/Gil2015/react-native-table-component/pull/140

I'll take a look at this today! Thank you!

Wasn't able to get to this today but it is on my radar. I'll try again tomorrow. Sorry!

andyasberry commented 2 years ago

I've applied the changes locally from the PR and need to test drive it before publishing. I'll provide an update here once it's published! I probably won't get to it today, but expect to get it done before the weekend is over.

andyasberry commented 2 years ago

@vikashbhalothia this change has been applied and published in v2.0.0 of react-native-table-component-2.

Tested locally in freshly minted Expo managed apps (TypeScript and non-TypeScript).

Chaitra9225 commented 2 years ago

https://www.npmjs.com/package/react-native-table-component-2

Compiled with problems:X

ERROR in ./src/Screens/DC-item-changes/StockCat.js 1:683-722

Module not found: Error: Can't resolve 'react-native-table-component' in '/Users/apple/Desktop/More-Retail/src/Screens/DC-item-changes'

im getting this error now... im using javascript for my development