Skip to content

Instantly share code, notes, and snippets.

View nandorojo's full-sized avatar

Fernando Rojo nandorojo

View GitHub Profile
@nandorojo
nandorojo / expo-ts49.md
Last active February 27, 2023 15:58
How to use TypeScript 4.9 `satisfies` with Expo SDK 47
@nandorojo
nandorojo / next.config.js
Last active January 13, 2023 19:33
next config
const withPlugins = require('next-compose-plugins')
const getTranspiledPackages = () => {
const path = require('path')
const fs = require('fs')
const node_modules = path.resolve(__dirname, '../..', 'node_modules')
const monorepoScope = '@beatgig'
@nandorojo
nandorojo / make-plugin.ts
Last active August 20, 2023 05:55
Add Type Safety to Expo config plugins
import { ConfigPlugin } from '@expo/config-plugins'
export const makePlugin = <F extends ConfigPlugin<any>, A extends Parameters<F>[1]>(
f: F,
a: A
): [F, A] => {
return [f, a]
}
@nandorojo
nandorojo / grid.tsx
Last active July 31, 2022 18:24
React Native Grid with Dripsy
import React from 'react'
import { View, useDripsyTheme, useResponsiveValue, Theme as DripsyTheme } from 'dripsy'
import { pickChild } from './pick-child'
type Props = {
/**
* Number of columns that should appear. If you want different columns at different screen sizes, use an array of numbers.
*/
columns?: number | number[]
children: React.ReactNode
@nandorojo
nandorojo / gist.ts
Created July 18, 2022 18:28
field.ts
export function useSellerBookingRequestPersonalized() {
const getArtistsWhoMaybeCouldBid = ({ artists, bookingRequest }) => {
return artists?.filter((artist) =>
bookingRequest?.artist_ids?.includes(artist.id)
);
};
const getAreAllMyBidsRejected = ({ artists, bookingRequest }) => {
const artistsWhoMaybeCouldBid = getArtistsWhoMaybeCouldBid({
artists,
@nandorojo
nandorojo / readme.md
Last active June 24, 2022 00:47
How to restart an Expo / Next.js app

If you need to restart a React Native app, and you're using Expo, then this gist will help you do it.

It also comes with web support.

Keep in mind, this will only work if you're using a custom dev client from Expo. If you aren't, then you should delete lines 11-13, and you won't be able to restart the app in dev mode.

@nandorojo
nandorojo / index.tsx
Last active March 5, 2024 13: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 October 16, 2023 16:20
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 April 1, 2024 18:40
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'