--- title: React Native sidebar_label: React Native description: Build data-intensive mobile apps with React Native. Seamlessly integrate spreadsheets into your app using SheetJS. Securely process and generate Excel files in the field. pagination_prev: demos/static/index pagination_next: demos/desktop/index sidebar_position: 1 sidebar_custom_props: summary: React + Native Rendering --- # Sheets on the Go with React Native import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; export const r = {style: {color:"red"}}; export const g = {style: {color:"green"}}; export const y = {style: {color:"gold"}}; export const gr = {style: {color:"gray"}}; [React Native](https://reactnative.dev/) is a mobile app framework. It builds iOS and Android apps that use JavaScript for describing layouts and events. [SheetJS](https://sheetjs.com) is a JavaScript library for reading and writing data from spreadsheets. This demo uses React Native and SheetJS to process and generate spreadsheets. We'll explore how to load SheetJS in a React Native app in a few ways: - ["Fetching Remote Data"](#fetching-remote-data) uses the built-in `fetch` to download and parse remote workbook files. - ["Local Files"](#local-files) uses native libraries to read and write files on the device. The "Local Files" example creates an app that looks like the screenshots below:
iOS | Android |
---|---|
![iOS screenshot](pathname:///mobile/rnios3.png) | ![Android screenshot](pathname:///mobile/rnand3.png) |
Spreadsheet | Array of Arrays |
---|---|
![`pres.xlsx` data](pathname:///pres.png) | ```js [ ["Name", "Index"], ["Bill Clinton", 42], ["GeorgeW Bush", 43], ["Barack Obama", 44], ["Donald Trump", 45], ["Joseph Biden", 46] ] ``` |
Before | After |
---|---|
![before screenshot](pathname:///reactnative/andfetch1.png) | ![after screenshot](pathname:///reactnative/andfetch2.png) |
Before | After |
---|---|
![before screenshot](pathname:///reactnative/iosfetch1.png) | ![after screenshot](pathname:///reactnative/iosfetch2.png) |
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.**This is a known bug in React Native!** If an emulator is installed, run the following command: ```bash npx react-native doctor ``` Under `Android`, there will be one error:
Android {`\n`} {` `}✖ Adb - No devices and/or emulators connected. Please create emulator with Android Studio or connect Android device.Press `f` and a list of available emulators will be shown. Select the emulator (typically the last line) and press Enter.
✔ Select the device / emulator you want to use › Emulator Pixel_3a_API_34 (disconnected)The text in green is the name of the virtual device (`Pixel_3a_API_34` in this example). Run the following command to manually start the emulator: ```bash $ANDROID_HOME/tools/emulator -avd Pixel_3a_API_34 ``` (replace `Pixel_3a_API_34` with the name of the virtual device) To confirm React Native detects the emulator, run the following command again: ```bash npx react-native doctor ``` ::: 8) Download