diff --git a/demos/react/.gitignore b/demos/react/.gitignore
index c23b6db..228ee28 100644
--- a/demos/react/.gitignore
+++ b/demos/react/.gitignore
@@ -1,3 +1,4 @@
SheetJS
.next
static/shim.js
+public/shim.js
diff --git a/demos/react/Makefile b/demos/react/Makefile
index 92f449f..da7d7f9 100644
--- a/demos/react/Makefile
+++ b/demos/react/Makefile
@@ -4,9 +4,9 @@ react: init ## Simple server for react and clones
.PHONY: next
next: init ## next.js demo
- mkdir -p pages static
+ mkdir -p pages public
cat nexthdr.js sheetjs.js > pages/sheetjs.js
- cp ../../shim.js static/shim.js
+ cp ../../shim.js public/shim.js
next
.PHONY: native
diff --git a/demos/react/nexthdr.js b/demos/react/nexthdr.js
index 4224974..9d56421 100644
--- a/demos/react/nexthdr.js
+++ b/demos/react/nexthdr.js
@@ -1,2 +1,3 @@
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import XLSX from 'xlsx';
+import React from 'react';
\ No newline at end of file
diff --git a/demos/react/pages/index.js b/demos/react/pages/index.js
index 0ae8f28..ce781fd 100644
--- a/demos/react/pages/index.js
+++ b/demos/react/pages/index.js
@@ -1,12 +1,12 @@
import Head from 'next/head'
-import SheetJSApp from './sheetjs.js'
-export default () => (
+import SheetJSApp from './sheetjs'
+const Index = () => (
-
+
SheetJS React Demo
-
+
@@ -19,4 +19,5 @@ export default () => (
-)
+);
+export default Index;
\ No newline at end of file
diff --git a/demos/react/react-native.js b/demos/react/react-native.js
index b0913db..ef2d933 100644
--- a/demos/react/react-native.js
+++ b/demos/react/react-native.js
@@ -1,16 +1,16 @@
/* xlsx.js (C) 2013-present SheetJS -- http://sheetjs.com */
import XLSX from 'xlsx';
import React, { Component } from 'react';
-import {
- AppRegistry,
- StyleSheet,
- Text,
- View,
- Button,
- Alert,
- Image,
- ScrollView,
- TouchableWithoutFeedback
+import {
+ AppRegistry,
+ StyleSheet,
+ Text,
+ View,
+ Button,
+ Alert,
+ Image,
+ ScrollView,
+ TouchableWithoutFeedback
} from 'react-native';
import { Table, Row, Rows, TableWrapper } from 'react-native-table-component';
@@ -78,7 +78,7 @@ export default class SheetJS extends Component {
}).catch((err) => { Alert.alert("exportFile Error", "Error " + err.message); });
};
- render() {
+ render() {
return (
@@ -105,7 +105,7 @@ export default class SheetJS extends Component {
- );
+ );
};
};
diff --git a/demos/react/sheetjs.js b/demos/react/sheetjs.js
index 0581e1d..cdb0237 100644
--- a/demos/react/sheetjs.js
+++ b/demos/react/sheetjs.js
@@ -11,11 +11,10 @@ function SheetJSApp() {
const handleFile = (file) => {
const reader = new FileReader();
- const rABS = !!reader.readAsBinaryString;
reader.onload = (e) => {
/* Parse data */
- const bstr = e.target.result;
- const wb = XLSX.read(bstr, {type:rABS ? 'binary' : 'array'});
+ const ab = e.target.result;
+ const wb = XLSX.read(ab, {type:'array'});
/* Get first worksheet */
const wsname = wb.SheetNames[0];
const ws = wb.Sheets[wsname];
@@ -25,7 +24,7 @@ function SheetJSApp() {
setData(data);
setCols(make_cols(ws['!ref']))
};
- if(rABS) reader.readAsBinaryString(file); else reader.readAsArrayBuffer(file);
+ reader.readAsArrayBuffer(file);
}
const exportFile = () => {
@@ -70,9 +69,9 @@ function DragDropFile({ handleFile, children }) {
};
return (
-