Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find variable: document

I'm trying to install data grid to my mobile app and i always go step by step in documentation of each library. I installed everyting and it writes me error message

I Tried to google, look to the files of library, but nothing. Noone hasn't have this type of problem as I have :/.

import React from 'react';
import ReactDataGrid from 'react-data-grid';

const columns = [
  { key: 'id', name: 'ID' },
  { key: 'title', name: 'Title' },
  { key: 'count', name: 'Count' } ];

const rows = [{id: 0, title: 'row1', count: 20}, {id: 1, title: 'row1', count: 40}, {id: 2, title: 'row1', count: 60}];

function HelloWorld() {
  return (<ReactDataGrid
  columns={columns}
  rowGetter={i => rows[i]}
  rowsCount={3}
  minHeight={150} />);
}

I did everyting, what is written here: https://github.com/adazzle/react-data-grid https://adazzle.github.io/react-data-grid/docs/quick-start

Is there any way to repair it ? I can send you anything, but i really need it. Thanks a lot for help :)

like image 711
iLukeeY Avatar asked Jun 05 '19 21:06

iLukeeY


2 Answers

This library is intended for web applications that run in the browser. When running in the context of a browser, the document element is available by default.

In React Native, however, the set of elements is different, and this kind of library is probably not going to work.

As an alternative, you can use something like React Native Paper that has a data table component. There are quite a few libraries that offer this kind of functionality for React Native.

like image 64
Kraylog Avatar answered Oct 05 '22 21:10

Kraylog


First and foremost React != React Native This should help you to dig around and will of course help to why the document is not available.

What you need to understand first is the difference between a Web Application and a mobile application.

like image 43
Ujjwal Nepal Avatar answered Oct 05 '22 21:10

Ujjwal Nepal