Skip to content

Instantly share code, notes, and snippets.

View nandorojo's full-sized avatar

Fernando Rojo nandorojo

View GitHub Profile
@nandorojo
nandorojo / index.tsx
Last active February 24, 2025 02:07
LayoutView: Moti + Framer Motion + React Native (+ Web)
import { MotiView } from 'moti'
import { styled } from 'dripsy'
import { LayoutViewProps } from './types'
import { Layout } from 'react-native-reanimated'
const LayoutView = ({ state, layout, ...props }: LayoutViewProps) => (
<MotiView
state={state}
layout={
layout === false
@nandorojo
nandorojo / preview.yml
Last active April 1, 2025 16:10
Create EAS Update Preview on each commit
name: Expo Preview
on:
push:
branches: [dev*, preview*]
paths:
- "**.ts"
- "**.tsx"
- "**.js"
- "**.json"
- "**.jsx"
@nandorojo
nandorojo / animate-height.tsx
Last active October 13, 2024 08:41
Moti Animate Height
import { StyleSheet } from 'react-native'
import Animated, {
useAnimatedStyle,
useSharedValue,
withTiming,
} from 'react-native-reanimated'
import { AnimateHeightProps } from './index.types'
const transition = { duration: 200 } as const
@nandorojo
nandorojo / index.tsx
Last active December 9, 2021 17:47
Expo Apple Auth
import type {
AppleAuthenticationButtonStyle,
AppleAuthenticationButtonType,
AppleAuthenticationUserDetectionStatus,
AppleAuthenticationButtonProps,
AppleAuthenticationCredential,
AppleAuthenticationSignInOptions,
} from 'expo-apple-authentication'
import { Image, Platform, Pressable, StyleSheet, Text } from 'react-native'
import { useEffect } from 'react'
@nandorojo
nandorojo / links.tsx
Created November 29, 2021 19:34
React Native + Next.js Link Components
@nandorojo
nandorojo / autocomplete.md
Last active November 16, 2021 21:41
Taming TypeScript autoimport in a monorepo

Taming TypeScript autoimport in a monorepo

Context

TypeScript's VSCode plugin doesn't use transitive dependencies for autoimport.

This means that, in a given subpackage, you have to list all the dependencies you want it to be able to autoimport.

That is, TypeScript will look in your package.json, not your node_modules folder to know what to autoimport.

@nandorojo
nandorojo / README.md
Last active February 17, 2025 08:31
Expo + Next.js Query Param state

Expo + Next.js Query Params State 🦦

A typical use-case on web for maintaining React State is your URL's query parameters. It lets users refresh pages & share links without losing their spot in your app.

URL-as-state is especially useful on Next.js, since next/router will re-render your page with shallow navigation.

This gist lets you leverage the power of URL-as-state, while providing a fallback to React state for usage in React Native apps.

It's essentially a replacement for useState.

@nandorojo
nandorojo / Hoverable.ts
Last active February 15, 2023 12:37
React Native Web Hoverability (with react-native-reanimated)
// credit to https://gist.github.com/ianmartorell/32bb7df95e5eff0a5ee2b2f55095e6a6
// this file was repurosed from there
// via this issue https://gist.github.com/necolas/1c494e44e23eb7f8c5864a2fac66299a
// because RNW's pressable doesn't bubble events to parent pressables: https://github.com/necolas/react-native-web/issues/1875
/* eslint-disable no-inner-declarations */
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment'
let isEnabled = false
@nandorojo
nandorojo / moti-images.tsx
Last active August 17, 2021 22:08
Moti Animated Images (from BeatGig's native home screen)
import { MotiView, AnimatePresence } from 'moti'
import { View } from 'dripsy'
import React, { useMemo, memo } from 'react'
import { StyleSheet } from 'react-native'
import FastImage from 'react-native-fast-image'
import { useIsFocused } from '@react-navigation/native'
type ArtistCardProps = {
artists: Record<'profile_image' | 'id', string>[]
cellWidth: string
@nandorojo
nandorojo / binary.yml
Last active August 13, 2021 02:45
Expo Release GH Actions
name: Build Binary App
on:
push:
branches: [binary-release, binary-beta]
workflow_dispatch:
inputs:
platform:
default: 'ios'
description: 'Could be "ios", "android", or "all"'
required: true