React Native Support
Polyfill Missing Base64 Decode
Section titled “Polyfill Missing Base64 Decode”In an environment like React Native (running JSCore) that does not support atob or btoa, a polyfill is needed.
Follow these steps to implement the polyfill and enable full compatibility with the Nhost SDK
-
Install
base-64:npm install base-64 -
In the
index.jsfile, which is the entry point for React Native applications, add the following import and global assignment:import 'react-native-gesture-handler';import { AppRegistry } from 'react-native';import App from './src/root';import { name as appName } from './app.json';import { decode as atob } from 'base-64'; // Import decode functionglobal.atob = atob; // Assign atob to global for polyfillAppRegistry.registerComponent(appName, () => App);