mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
* fix(mobile): install crypto polyfills before all other module inits @noble/hashes and @noble/ciphers capture globalThis.crypto once at module-load time. Since the viem 2.52.2 resolution bump, viem/ox share those exact module instances with the WalletConnect stack, and in release bundles they could initialize before the polyfills in _layout.tsx ran — permanently breaking WalletKit init/pairing with "crypto.getRandomValues must be defined" (dev bundles were unaffected, which is why the bug only surfaced on TestFlight). Move the WalletConnect compat and quick-crypto polyfill imports to the top of index.js so they beat every other module initialization. * refactor(mobile): consolidate platform polyfills into src/platform/polyfills.ts Review feedback on #8256: instead of splitting polyfills between index.js (crypto) and _layout.tsx (fetch, intl), gather all of them in one module imported first in the app entry. The crypto-first ordering constraint is documented in that single place. --------- Co-authored-by: Hanzo Dev <[email protected]>
23 lines
756 B
JavaScript
23 lines
756 B
JavaScript
// Must stay the first import — see the ordering constraints in polyfills.ts.
|
|
import '@/src/platform/polyfills'
|
|
|
|
// Initialize all background notification handlers early - must be self-contained, no app dependencies
|
|
import '@/src/services/notifications/backgroundHandlers'
|
|
|
|
// changed to the below syntax, because on my machine I was failing to build
|
|
// the release version
|
|
// https://github.com/expo/expo/issues/27299#issuecomment-2138722853
|
|
|
|
import { registerRootComponent } from 'expo'
|
|
|
|
// import 'expo-router/entry'
|
|
import { ExpoRoot } from 'expo-router'
|
|
|
|
// Must be exported or Fast Refresh won't update the context
|
|
export function App() {
|
|
const ctx = require.context('./src/app')
|
|
return <ExpoRoot context={ctx} />
|
|
}
|
|
|
|
registerRootComponent(App)
|