react-native-table-component icon indicating copy to clipboard operation
react-native-table-component copied to clipboard

TypeError: Cannot read property 'style' of undefined

Open ayoubkhan558-zz opened this issue 4 years ago • 10 comments

× 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

ayoubkhan558-zz avatar May 18 '21 12:05 ayoubkhan558-zz

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.

tiomun avatar May 24 '21 13:05 tiomun

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

aliwhosane avatar Sep 13 '21 13:09 aliwhosane

Doesn't seem like it ☹️

andyasberry avatar Oct 19 '21 15:10 andyasberry

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"]
}

andyasberry avatar Oct 19 '21 21:10 andyasberry

@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

vikash-0741 avatar Feb 01 '22 13:02 vikash-0741

@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 avatar Feb 01 '22 13:02 andyasberry

@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 avatar Feb 02 '22 02:02 andyasberry

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 avatar Feb 02 '22 13:02 andyasberry

@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).

andyasberry avatar Feb 07 '22 14:02 andyasberry

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

Chaitra9225 avatar Feb 09 '22 06:02 Chaitra9225