This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import useNativeSWR from 'swr' | |
import { useRef } from 'react' | |
// inspired by https://github.com/vercel/swr/discussions/456 | |
export default function useSWR(key, fetcher, options = {}) { | |
const { cachePolicy, ...opts } = options | |
const random = useRef(new Date()) | |
return useNativeSWR( | |
() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ConfigInterface, useSWRInfinite } from 'swr' | |
import { useMemo, useCallback, useRef } from 'react' | |
import last from 'lodash.last' | |
import get from 'lodash.get' | |
type PageKeyMaker<Page, Key extends any[]> = ( | |
index: number, | |
previousPageData?: Page | |
/** | |
* Mutable ref object. Set this to `true` before the request and `false` afterwards if the request is fetching more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef } from 'react' | |
export default function useOnChange<T>( | |
value: T, | |
effect: (prev: T, next: T) => void | |
) { | |
const latestValue = useRef(value) | |
const callback = useRef(effect) | |
callback.current = effect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// web | |
import P, { ArrowContainer } from 'react-tiny-popover' | |
import React from 'react' | |
export default ({ | |
visible = false, | |
position, | |
onClose, | |
children, | |
content = null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 () => { |
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
.
In order to test / reproduce this, I added this PR to my Expo + Next.js monorepo starter: nandorojo/expo-next-monorepo#1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { ComponentProps } from 'react' | |
import { ScrollView } from 'react-native' | |
import { useDraggableScroll } from './use-draggable-scroll' | |
export const DraggableScrollView = React.forwardRef< | |
ScrollView, | |
ComponentProps<typeof ScrollView> | |
>(function DraggableScrollView(props, ref) { | |
const { refs } = useDraggableScroll<ScrollView>({ | |
outerRef: ref, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/expo-dev-launcher/plugin/build/withDevLauncher.js b/node_modules/expo-dev-launcher/plugin/build/withDevLauncher.js | |
index 04c1d7d..a166618 100644 | |
--- a/node_modules/expo-dev-launcher/plugin/build/withDevLauncher.js | |
+++ b/node_modules/expo-dev-launcher/plugin/build/withDevLauncher.js | |
@@ -20,7 +20,7 @@ const DEV_LAUNCHER_ON_NEW_INTENT = ` | |
`; | |
const DEV_LAUNCHER_WRAPPED_ACTIVITY_DELEGATE = `DevLauncherController.wrapReactActivityDelegate(this, () -> $1);`; | |
const DEV_LAUNCHER_ANDROID_INIT = 'DevLauncherController.initialize(this, getReactNativeHost());'; | |
-const DEV_LAUNCHER_POD_IMPORT = "pod 'expo-dev-launcher', path: '../node_modules/expo-dev-launcher', :configurations => :debug"; | |
+const DEV_LAUNCHER_POD_IMPORT = "pod 'expo-dev-launcher', path: '../../../node_modules/expo-dev-launcher', :configurations => :debug"; |