Skip to content

Instantly share code, notes, and snippets.

View dannyhw's full-sized avatar
:shipit:

Daniel Williams dannyhw

:shipit:
View GitHub Profile
@dannyhw
dannyhw / ReactCompilerPlugin.ts
Created May 29, 2025 15:35 — forked from sikanhe/ReactCompilerPlugin.ts
React Compiler plugin for ESBuild
import { readFileSync } from "node:fs"
import * as babel from "@babel/core"
import BabelPluginReactCompiler from "babel-plugin-react-compiler"
import type { Plugin } from "esbuild"
import QuickLRU from "quick-lru"
export function ReactCompilerEsbuildPlugin({
filter,
sourceMaps,
runtimeModulePath,
@dannyhw
dannyhw / steps.md
Last active June 2, 2025 21:42
Expo router setup in 2 minutes

Heres how I add React native Storybook to an expo router project in 2 minutes

npm create storybook

choose recommended and then native

npx expo@latest customize metro.config.js
@dannyhw
dannyhw / MarkdownWebview.tsx
Last active July 4, 2024 13:16
react native markdown using webview
import { SafeAreaView, Platform } from 'react-native'
import WebView from "react-native-webview";
const markdown = `
- hello from markdown
- test
---
@dannyhw
dannyhw / index.tsx
Last active May 31, 2024 10:43
a simplified version of using useAnimatedRef and useScrollViewOffset for animating on scroll
import { Stack } from 'expo-router';
import { StyleSheet, Text, View, useWindowDimensions } from 'react-native';
import Animated, {
Extrapolation,
interpolate,
useAnimatedRef,
useAnimatedStyle,
useScrollViewOffset,
} from 'react-native-reanimated';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Animated, {
useAnimatedStyle,
useSharedValue,
withTiming,
} from "react-native-reanimated";
export const CollapsableContainer = ({
children,
expanded,
@dannyhw
dannyhw / publishToMedium.js
Created March 30, 2022 09:23
if you put your integration token in a .env.json you can automatically post a markdown file to medium
#!/usr/bin/env node
const yargs = require("yargs/yargs");
const { hideBin } = require("yargs/helpers");
const { token } = require("./.env.json");
const { URL, URLSearchParams } = require("url");
const fetch = require("node-fetch");
class HTTPResponseError extends Error {
constructor(response, customMessage, ...args) {
super(
@dannyhw
dannyhw / policy
Created January 2, 2022 22:53
policy
no data is stored anywhere other than on your device and it is not shared with any 3rd party or uploaded in any way
@dannyhw
dannyhw / addon_react_native_web.md
Last active July 5, 2022 16:19
draft document about a new react native web addon

Intro

Storybook is a UI development workshop for components and pages. It's used by many teams for all kinds of reasons. You can develop components in isolation, run visual tests and even validate the accessibility of your UI.

Storybook started off web focused and has expanded to many different platforms since then. One of those platforms is React Native.

Storybook for React Native is a catalog of all your components and states, that runs inside your iOS or Android app, on your mobile device. This is great for seeing your React Native components in their production setting, but also has some disadvantages when compared to Storybook's web UI.

That's why I'm excited to announce Storybook for React Native Web, a new complementary approach to developing and sharing React Native components in Storybook.

@dannyhw
dannyhw / setup_expo_rn_sb.sh
Last active December 16, 2022 14:32
React native storybook alpha v6 Expo setup
#!/bin/bash
set -e
APP_NAME=${1:-RNStorybookAlpha}
echo "APP_NAME: $APP_NAME"
npm install --global expo-cli
expo init -t expo-template-blank-typescript $APP_NAME
cd $APP_NAME
expo install @storybook/react-native@next \
@storybook/addon-ondevice-actions@next \
@dannyhw
dannyhw / setup_rn_sb.sh
Last active November 26, 2023 11:14
Setup a new project to test the 6.0 alpha of react native storybook
#!/bin/bash
npx react-native init RnSBSixAlpha --template react-native-template-typescript;
cd RnSBSixAlpha;
yarn add @storybook/react-native@next \
@react-native-async-storage/async-storage \
@storybook/addon-ondevice-actions@next \
@storybook/addon-ondevice-controls@next \
@storybook/addon-ondevice-backgrounds@next \
@storybook/addon-ondevice-notes@next \