Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

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

Open
ayoubkhan558-zz opened this issue May 18, 2021 · 10 comments
Open

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

ayoubkhan558-zz opened this issue May 18, 2021 · 10 comments

Comments

@ayoubkhan558-zz
Copy link

×
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
Copy link

tiomun commented May 24, 2021

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
Copy link

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

@andyasberry
Copy link

Doesn't seem like it ☹️

@andyasberry
Copy link

andyasberry commented Oct 19, 2021

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
Copy link

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

@andyasberry
Copy link

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

#140

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

@andyasberry
Copy link

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

#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
Copy link

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
Copy link

@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
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants