Skip to content

Instantly share code, notes, and snippets.

View EvanBacon's full-sized avatar
🥓
Markdown developer

Evan Bacon EvanBacon

🥓
Markdown developer
View GitHub Profile
@EvanBacon
EvanBacon / local-storage-polyfill.ts
Last active November 28, 2024 03:57
Polyfill localStorage in Expo SDK 52
import { Storage } from "expo-sqlite/kv-store";
// localStorage polyfill. Life's too short to not have some storage API.
if (typeof localStorage === "undefined") {
class StoragePolyfill {
/**
* Returns the number of key/value pairs.
*
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Storage/length)
*/
@EvanBacon
EvanBacon / _layout.tsx
Created April 23, 2025 22:23
Loading fonts with React Suspense in Expo
import { SplashScreen } from "expo-router";
import React, { Suspense, useEffect } from "react";
import { Text, View } from "react-native";
import * as Font from "expo-font";
SplashScreen.preventAutoHideAsync();
function SplashFallback() {
@EvanBacon
EvanBacon / CLAUDE.md
Created July 22, 2025 16:43
Expo Router CLAUDE.md file.

Architecture

  • Website: Expo Router website with Tailwind.
  • Native app: Expo Router app with CNG.
  • Backend: Expo API routes WinterTC-compliant. Routes are in src/app/api/ directory. API routes use +api.ts suffix (chat+api.ts).
  • Secrets: Use .env files and API routes for secret management. Never use EXPO_PUBLIC_ prefix for sensitive data.

Code Style

  • Use TypeScript whenever possible.