Evolu (and Effect, I think) both need polyfills in order to function in React Native when used with expo-router or Metro. Polyfills are needed for TextEncoder and TextDecoder, and for crypto.getRandomValues.
This can be fixed by installing expo-crypto and text-encoding, then writing a polyfill.ts like this:
Evolu (and Effect, I think) both need polyfills in order to function in React Native when used with
expo-router
or Metro. Polyfills are needed for TextEncoder and TextDecoder, and forcrypto.getRandomValues
.This can be fixed by installing
expo-crypto
andtext-encoding
, then writing apolyfill.ts
like this:Then import
polyfill.ts
before any imports of Evolu.Also note that in order to satisfy TS, you will need to make a
react-native-polyfill.d.ts
with the following content:This should really be added to the documentation as part of the necessary setup in order to get things working with Expo or Metro.