Skip to content

Instantly share code, notes, and snippets.

View nandorojo's full-sized avatar

Fernando Rojo nandorojo

View GitHub Profile
@nandorojo
nandorojo / expo-next-webpack5.md
Last active July 23, 2021 13:25
Expo + Next.js + Webpack 5

Here are my attempts to use webpack 5 with Expo's Next.js integration.

Next v10.2 uses webpack5 by default. However, this breaks @expo/next-adapater.

Relevant PR

In order to test / reproduce this, I added this PR to my Expo + Next.js monorepo starter: nandorojo/expo-next-monorepo#1

HTML Webpack Plugin

@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
@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 / 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 / links.tsx
Created November 29, 2021 19:34
React Native + Next.js Link Components
@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 / 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 / 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 / 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 / _app.tsx
Last active August 2, 2022 16:12
React Native Web + Next.js Scroll Restoration
// pages/_app.js
import ReactNativeNextJsScrollRestore from '../react-native-next-scroll-restore'
import { useEffect } from 'react'
function MyApp({ Component, pageProps }) {
useEffect(() => {
const unsubscribe = ReactNativeNextJsScrollRestore.initialize()
return () => {