, 'Component'> & {
- Component: AppProps['Component'] & {
- navigationOptions?: NavigationOptions;
- getLayout?: (page: React.ReactNode, options?: NavigationOptions) => React.ReactNode;
- };
-};
-export type { SolitoPage, SolitoNavigationOptions, SolitoCustomNavigationOptions, };
diff --git a/packages/link/node_modules/solito/build/types/solito-page.js b/packages/link/node_modules/solito/build/types/solito-page.js
deleted file mode 100644
index 87b5d989..00000000
--- a/packages/link/node_modules/solito/build/types/solito-page.js
+++ /dev/null
@@ -1,2 +0,0 @@
-export {};
-//# sourceMappingURL=solito-page.js.map
\ No newline at end of file
diff --git a/packages/link/node_modules/solito/build/types/solito-page.js.map b/packages/link/node_modules/solito/build/types/solito-page.js.map
deleted file mode 100644
index 2ef8a256..00000000
--- a/packages/link/node_modules/solito/build/types/solito-page.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"solito-page.js","sourceRoot":"","sources":["../../src/types/solito-page.tsx"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { NextPage } from 'next'\nimport type { AppProps } from 'next/app'\n\ninterface SolitoCustomNavigationOptions {}\n\ninterface SolitoNavigationOptions extends SolitoCustomNavigationOptions {\n previousPagePath?: string | null\n}\n\ntype NavigationOptions =\n | SolitoNavigationOptions\n | ((router?: AppProps['router']) => SolitoNavigationOptions)\n\ntype SolitoPage
= NextPage
& {\n navigationOptions?: NavigationOptions\n getLayout?: (\n page: React.ReactNode,\n options?: NavigationOptions\n ) => React.ReactNode\n}\n\nexport type SolitoAppProps
= Omit, 'Component'> & {\n Component: AppProps['Component'] & {\n navigationOptions?: NavigationOptions\n getLayout?: (\n page: React.ReactNode,\n options?: NavigationOptions\n ) => React.ReactNode\n }\n}\n\nexport type {\n SolitoPage,\n SolitoNavigationOptions,\n SolitoCustomNavigationOptions,\n}\n"]}
\ No newline at end of file
diff --git a/packages/link/node_modules/solito/image/author/index.d.ts b/packages/link/node_modules/solito/image/author/index.d.ts
deleted file mode 100644
index f2532e56..00000000
--- a/packages/link/node_modules/solito/image/author/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../build/image/author'
diff --git a/packages/link/node_modules/solito/image/author/index.js b/packages/link/node_modules/solito/image/author/index.js
deleted file mode 100644
index f2532e56..00000000
--- a/packages/link/node_modules/solito/image/author/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../build/image/author'
diff --git a/packages/link/node_modules/solito/image/expo/index.d.ts b/packages/link/node_modules/solito/image/expo/index.d.ts
deleted file mode 100644
index 0dd8a473..00000000
--- a/packages/link/node_modules/solito/image/expo/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../build/image/expo'
diff --git a/packages/link/node_modules/solito/image/expo/index.js b/packages/link/node_modules/solito/image/expo/index.js
deleted file mode 100644
index 0dd8a473..00000000
--- a/packages/link/node_modules/solito/image/expo/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../build/image/expo'
diff --git a/packages/link/node_modules/solito/image/index.d.ts b/packages/link/node_modules/solito/image/index.d.ts
deleted file mode 100644
index f31cf746..00000000
--- a/packages/link/node_modules/solito/image/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/image/expo'
diff --git a/packages/link/node_modules/solito/image/index.js b/packages/link/node_modules/solito/image/index.js
deleted file mode 100644
index f31cf746..00000000
--- a/packages/link/node_modules/solito/image/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/image/expo'
diff --git a/packages/link/node_modules/solito/image/react-native-fast-image.js b/packages/link/node_modules/solito/image/react-native-fast-image.js
deleted file mode 100644
index acce1629..00000000
--- a/packages/link/node_modules/solito/image/react-native-fast-image.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/image/fast'
diff --git a/packages/link/node_modules/solito/index.d.ts b/packages/link/node_modules/solito/index.d.ts
deleted file mode 100644
index eeef9235..00000000
--- a/packages/link/node_modules/solito/index.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-///
-///
-///
-///
-
-export * from './build'
diff --git a/packages/link/node_modules/solito/link/index.d.ts b/packages/link/node_modules/solito/link/index.d.ts
deleted file mode 100644
index d0f377c8..00000000
--- a/packages/link/node_modules/solito/link/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/link'
diff --git a/packages/link/node_modules/solito/link/index.js b/packages/link/node_modules/solito/link/index.js
deleted file mode 100644
index d0f377c8..00000000
--- a/packages/link/node_modules/solito/link/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/link'
diff --git a/packages/link/node_modules/solito/moti/index.d.ts b/packages/link/node_modules/solito/moti/index.d.ts
deleted file mode 100644
index 87df37db..00000000
--- a/packages/link/node_modules/solito/moti/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/moti'
diff --git a/packages/link/node_modules/solito/moti/index.js b/packages/link/node_modules/solito/moti/index.js
deleted file mode 100644
index 87df37db..00000000
--- a/packages/link/node_modules/solito/moti/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/moti'
diff --git a/packages/link/node_modules/solito/package.json b/packages/link/node_modules/solito/package.json
deleted file mode 100644
index daede056..00000000
--- a/packages/link/node_modules/solito/package.json
+++ /dev/null
@@ -1,62 +0,0 @@
-{
- "name": "solito",
- "version": "3.2.0",
- "scripts": {
- "build": "expo-module build",
- "clean": "expo-module clean",
- "test": "expo-module test",
- "prepare": "expo-module prepare",
- "upgrade-expo": "bun ./scripts/upgrade-examples-expo.ts"
- },
- "devDependencies": {
- "@babel/preset-env": "^7.20.2",
- "@babel/preset-typescript": "^7.18.6",
- "@react-navigation/bottom-tabs": "^6.0.9",
- "@react-navigation/drawer": "^6.1.8",
- "@react-navigation/native": "^6.0.6",
- "@react-navigation/native-stack": "^6.2.5",
- "@types/jest": "^29.2.3",
- "@types/node": "^18.11.9",
- "@types/react": "^18.0.7",
- "@types/react-native": "^0.70.0",
- "concurrently": "^7.6.0",
- "eslint-config-nando": "^1.1.0",
- "expo-image": "^1.0.0",
- "expo-module-scripts": "^2.0.0",
- "jest": "^29.3.1",
- "moti": "^0.17.1",
- "next": "13.0.1",
- "react-native-fast-image": "^8.6.3"
- },
- "resolutions": {
- "@types/react": "^18.0.7",
- "react": "18.2.0",
- "react-dom": "18.2.0"
- },
- "license": "MIT",
- "bugs": {
- "url": "/~https://github.com/nandorojo/solito/issues"
- },
- "homepage": "/~https://github.com/nandorojo/solito.git#readme",
- "main": "build/index.js",
- "types": "index.d.ts",
- "sideEffects": false,
- "publishConfig": {
- "access": "public"
- },
- "author": {
- "email": "fernando@wearptos.com",
- "name": "Fernando Rojo",
- "url": "https://fernandotherojo.co"
- },
- "files": [
- "build/**/*",
- "index.d.ts",
- "src/**/*",
- "link/**/*",
- "router/**/*",
- "moti/**/*",
- "image/**/*"
- ],
- "packageManager": "yarn@1.22.19"
-}
diff --git a/packages/link/node_modules/solito/router/index.d.ts b/packages/link/node_modules/solito/router/index.d.ts
deleted file mode 100644
index fe366271..00000000
--- a/packages/link/node_modules/solito/router/index.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/router'
diff --git a/packages/link/node_modules/solito/router/index.js b/packages/link/node_modules/solito/router/index.js
deleted file mode 100644
index fe366271..00000000
--- a/packages/link/node_modules/solito/router/index.js
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../build/router'
diff --git a/packages/link/node_modules/solito/src/helpers/merge-refs.ts b/packages/link/node_modules/solito/src/helpers/merge-refs.ts
deleted file mode 100644
index 0cd5929b..00000000
--- a/packages/link/node_modules/solito/src/helpers/merge-refs.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-// credit: /~https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx
-export function mergeRefs(
- refs: Array | React.LegacyRef>
-): React.RefCallback {
- return (value) => {
- refs.forEach((ref) => {
- if (typeof ref === 'function') {
- ref(value)
- } else if (ref != null) {
- ;(ref as React.MutableRefObject).current = value
- }
- })
- }
-}
diff --git a/packages/link/node_modules/solito/src/helpers/use-stable-callback.ts b/packages/link/node_modules/solito/src/helpers/use-stable-callback.ts
deleted file mode 100644
index a0869210..00000000
--- a/packages/link/node_modules/solito/src/helpers/use-stable-callback.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { useRef, useMemo, useEffect } from 'react'
-
-/**
- * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
- * prop or avoid re-executing effects when passed as a dependency
- */
-function useStableCallback any>(
- callback: T | undefined
-): T {
- const callbackRef = useRef(callback)
-
- useEffect(() => {
- callbackRef.current = callback
- })
-
- // /~https://github.com/facebook/react/issues/19240
- return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, [])
-}
-
-export { useStableCallback }
diff --git a/packages/link/node_modules/solito/src/image/author/index.ts b/packages/link/node_modules/solito/src/image/author/index.ts
deleted file mode 100644
index 21ce334c..00000000
--- a/packages/link/node_modules/solito/src/image/author/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export type { SolitoImageProps } from '../image.types'
-
-export * from '../create-solito-image'
-export * from '../use-solito-image'
diff --git a/packages/link/node_modules/solito/src/image/context.tsx b/packages/link/node_modules/solito/src/image/context.tsx
deleted file mode 100644
index 006223f2..00000000
--- a/packages/link/node_modules/solito/src/image/context.tsx
+++ /dev/null
@@ -1,27 +0,0 @@
-import { ContextType, createContext, useContext, useState } from 'react'
-
-import { imageConfigDefault } from './helpers'
-
-const SolitoImageContext =
- createContext>(imageConfigDefault)
-
-export const SolitoImageProvider = ({
- children,
- ...rest
-}: {
- children: React.ReactNode
-} & ContextType) => {
- const parent = useContext(SolitoImageContext)
- const [context] = useState(() => ({
- ...parent,
- ...rest,
- }))
-
- return (
-
- {children}
-
- )
-}
-
-export const useSolitoImageContext = () => useContext(SolitoImageContext)
diff --git a/packages/link/node_modules/solito/src/image/create-solito-image.tsx b/packages/link/node_modules/solito/src/image/create-solito-image.tsx
deleted file mode 100644
index 0338f1be..00000000
--- a/packages/link/node_modules/solito/src/image/create-solito-image.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import React, { ComponentType, createElement, forwardRef } from 'react'
-
-import { SolitoImageProps } from './image.types'
-import { useSolitoImage } from './use-solito-image'
-
-export function createSolitoImage<
- C extends ComponentType>
->(Component: C) {
- return forwardRef, SolitoImageProps>(function Img(
- props,
- ref
- ) {
- const imageProps = useSolitoImage(props)
- return createElement(Component, { ...imageProps, ref } as any)
- })
-}
diff --git a/packages/link/node_modules/solito/src/image/default-loader.ts b/packages/link/node_modules/solito/src/image/default-loader.ts
deleted file mode 100644
index b59bd989..00000000
--- a/packages/link/node_modules/solito/src/image/default-loader.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { Platform } from 'react-native'
-import { ImageConfigComplete } from './types'
-
-export type ImageLoaderProps = {
- src: string
- width: number
- quality?: number
-}
-
-export type ImageLoaderPropsWithConfig = ImageLoaderProps & {
- config: Readonly
-}
-
-export function defaultLoader({
- config,
- src,
- width,
- quality,
-}: ImageLoaderPropsWithConfig): string {
- if (process.env.NODE_ENV !== 'production') {
- const missingValues = []
-
- // these should always be provided but make sure they are
- if (!src) missingValues.push('src')
- if (!width) missingValues.push('width')
-
- if (missingValues.length > 0) {
- throw new Error(
- `Solito Image requires ${missingValues.join(
- ', '
- )} to be provided. Make sure you pass them as props to the \`solito/image\` component. Received: ${JSON.stringify(
- { src, width, quality }
- )}`
- )
- }
-
- if (src.startsWith('/') && !config.nextJsURL) {
- throw new Error(
- `[solito/image] Please add the "nextJsURL" prop to your to use relative paths.
-
-Error due to image source "${src}".`
- )
- }
- }
-
- if (src.startsWith('/') && src.endsWith('.svg')) {
- // relative SVG paths are raw
- return `${config.nextJsURL}${src}`
- }
-
- if (src.startsWith('http')) {
- return src
- }
-
- if (src.startsWith('file://')) {
- return src
- }
-
- return `${config.nextJsURL}${config.path}?url=${encodeURIComponent(
- src
- )}&w=${width}&q=${quality || 75}`
-}
-
-// We use this to determine if the import is the default loader
-// or a custom loader defined by the user in next.config.js
-// defaultLoader.__next_img_default = true
diff --git a/packages/link/node_modules/solito/src/image/expo/image.tsx b/packages/link/node_modules/solito/src/image/expo/image.tsx
deleted file mode 100644
index 6feae24d..00000000
--- a/packages/link/node_modules/solito/src/image/expo/image.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { Image } from 'expo-image'
-import { forwardRef } from 'react'
-
-import { SolitoImageProps } from '../image.types'
-import { useSolitoImage } from '../use-solito-image'
-
-const SolitoImage = forwardRef(function Img(
- props,
- ref
-) {
- const {
- onLoadingComplete,
- resizeMode = 'contain',
- ...imageProps
- } = useSolitoImage(props)
-
- return (
- onLoadingComplete(e.source))}
- ref={ref}
- // @ts-expect-error expo-image has weird types
- style={imageProps.style}
- contentPosition={props.contentPosition}
- />
- )
-})
-
-export default SolitoImage
diff --git a/packages/link/node_modules/solito/src/image/expo/image.web.tsx b/packages/link/node_modules/solito/src/image/expo/image.web.tsx
deleted file mode 100644
index e8000dfa..00000000
--- a/packages/link/node_modules/solito/src/image/expo/image.web.tsx
+++ /dev/null
@@ -1,152 +0,0 @@
-// Add client directive once we implement onLayout
-import {
- ImageContentPosition,
- ImageContentPositionObject,
- ImageContentPositionString,
- ImageContentPositionValue,
-} from 'expo-image'
-import NextImage from 'next/image'
-import { forwardRef } from 'react'
-import { Image, ImageResizeMode, StyleSheet } from 'react-native'
-// @ts-expect-error missing types
-import { unstable_createElement } from 'react-native-web'
-
-// import useElementLayout from 'react-native-web/dist/modules/useElementLayout'
-// import { mergeRefs } from '../../helpers/merge-refs'
-import { useSolitoImageContext } from '../context'
-import { SolitoImageProps } from '../image.types'
-
-const SolitoImage = forwardRef(function SolitoImage(
- { resizeMode = 'contain', fill, style, onLayout, ...props },
- ref
-) {
- const { loader } = useSolitoImageContext()
- // add back onLayout when this is solved: /~https://github.com/vercel/next.js/discussions/43267
- // const localRef = useRef(null)
- // useElementLayout(
- // // /~https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/View/index.js#L88
- // localRef,
- // onLayout
- // )
- return unstable_createElement(NextImage, {
- ...props,
- // ref: mergeRefs([ref, localRef]),
- loader: props.loader ?? loader,
- fill,
- style: [
- fill && StyleSheet.absoluteFill,
- {
- objectFit: objectFitFromResizeMode(resizeMode),
- objectPosition: getObjectPositionFromContentPositionObject(
- resolveContentPosition(props.contentPosition)
- ),
- },
- style,
- ],
- })
-})
-
-export default SolitoImage
-
-// FORKED FROM EXPO IMAGE
-
-/**
- * It resolves a stringified form of the `contentPosition` prop to an object,
- * which is the only form supported in the native code.
- *
- * /~https://github.com/expo/expo/blob/baea6e76d0c6f865885aa2fb1c8f7732c119c300/packages/expo-image/src/utils.ts#L53
- */
-function resolveContentPosition(
- contentPosition?: ImageContentPosition
-): ImageContentPositionObject {
- if (typeof contentPosition === 'string') {
- const contentPositionStringMappings: Record<
- ImageContentPositionString,
- ImageContentPositionObject
- > = {
- center: { top: '50%', left: '50%' },
- top: { top: 0, left: '50%' },
- right: { top: '50%', right: 0 },
- bottom: { bottom: 0, left: '50%' },
- left: { top: '50%', left: 0 },
- 'top center': { top: 0, left: '50%' },
- 'top right': { top: 0, right: 0 },
- 'top left': { top: 0, left: 0 },
- 'right center': { top: '50%', right: 0 },
- 'right top': { top: 0, right: 0 },
- 'right bottom': { bottom: 0, right: 0 },
- 'bottom center': { bottom: 0, left: '50%' },
- 'bottom right': { bottom: 0, right: 0 },
- 'bottom left': { bottom: 0, left: 0 },
- 'left center': { top: '50%', left: 0 },
- 'left top': { top: 0, left: 0 },
- 'left bottom': { bottom: 0, left: 0 },
- }
- const contentPositionObject = contentPositionStringMappings[contentPosition]
-
- if (!contentPositionObject) {
- console.warn(
- `[expo-image]: Content position "${contentPosition}" is invalid`
- )
- return contentPositionStringMappings.center
- }
- return contentPositionObject
- }
- return contentPosition ?? { top: '50%', left: '50%' }
-}
-function ensureUnit(value: string | number) {
- const trimmedValue = String(value).trim()
- if (trimmedValue.endsWith('%')) {
- return trimmedValue
- }
- return `${trimmedValue}px`
-}
-
-type KeysOfUnion = T extends T ? keyof T : never
-
-function getObjectPositionFromContentPositionObject(
- contentPosition?: ImageContentPositionObject
-): string {
- const resolvedPosition = { ...contentPosition } as Record<
- KeysOfUnion,
- ImageContentPositionValue
- >
- if (!resolvedPosition) {
- return '50% 50%'
- }
- if (resolvedPosition.top == null && resolvedPosition.bottom == null) {
- resolvedPosition.top = '50%'
- }
- if (resolvedPosition.left == null && resolvedPosition.right == null) {
- resolvedPosition.left = '50%'
- }
-
- return (
- (['top', 'bottom', 'left', 'right'] as const)
- .map((key) => {
- if (key in resolvedPosition) {
- return `${key} ${ensureUnit(resolvedPosition[key])}`
- }
- return ''
- })
- .join(' ') || '50% 50%'
- )
-}
-// END FORKED FROM EXPO IMAGE
-
-const objectFitFromResizeMode = (resizeMode: ImageResizeMode) => {
- if (resizeMode === 'cover') {
- return 'cover'
- }
- if (resizeMode === 'contain') {
- return 'contain'
- }
- if (resizeMode === 'stretch') {
- return 'fill'
- }
- if (resizeMode === 'center') {
- return 'none'
- }
-
- throw new Error(`[solito/image] Invalid resizeMode: ${resizeMode}`)
-}
diff --git a/packages/link/node_modules/solito/src/image/expo/index.ts b/packages/link/node_modules/solito/src/image/expo/index.ts
deleted file mode 100644
index 06bd2c16..00000000
--- a/packages/link/node_modules/solito/src/image/expo/index.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import SolitoImage from './image'
-
-export { SolitoImage }
-
-export { SolitoImageProvider } from '../context'
diff --git a/packages/link/node_modules/solito/src/image/fast/fast.tsx b/packages/link/node_modules/solito/src/image/fast/fast.tsx
deleted file mode 100644
index e19babae..00000000
--- a/packages/link/node_modules/solito/src/image/fast/fast.tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { ComponentProps } from 'react'
-import FastImage from 'react-native-fast-image'
-
-import { SolitoImageProps } from '../image.types'
-import { useSolitoImage } from '../use-solito-image'
-
-export default function SolitoFastImage(
- props: Omit &
- Pick, 'style' | 'resizeMode'>
-) {
- const { source, resizeMode, onLoadingComplete, style, ...imageProps } =
- useSolitoImage(props as SolitoImageProps)
-
- return (
- onLoadingComplete(e.nativeEvent))}
- // @ts-expect-error this is fine
- style={style}
- {...imageProps}
- />
- )
-}
diff --git a/packages/link/node_modules/solito/src/image/fast/fast.web.tsx b/packages/link/node_modules/solito/src/image/fast/fast.web.tsx
deleted file mode 100644
index 890401b7..00000000
--- a/packages/link/node_modules/solito/src/image/fast/fast.web.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from '../expo/image.web'
diff --git a/packages/link/node_modules/solito/src/image/fast/index.ts b/packages/link/node_modules/solito/src/image/fast/index.ts
deleted file mode 100644
index 7fb3525a..00000000
--- a/packages/link/node_modules/solito/src/image/fast/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import SolitoImage from './fast'
-
-export { SolitoImage }
-export { SolitoImageProvider } from '../context'
diff --git a/packages/link/node_modules/solito/src/image/helpers.test.ts b/packages/link/node_modules/solito/src/image/helpers.test.ts
deleted file mode 100644
index d5c2c4ac..00000000
--- a/packages/link/node_modules/solito/src/image/helpers.test.ts
+++ /dev/null
@@ -1,117 +0,0 @@
-import { resolveSourceFromImgAttributes } from './helpers'
-
-describe('resolveSourceFromImgAttributes', () => {
- test('picks from max-width', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 100,
- height: 100,
- },
- srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,
- sizes: `(max-width: 600px) 480px, 800px`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy-480w.jpg')
- })
-
- test('trims excess space', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 100,
- height: 100,
- },
- srcSet: `elva-fairy-480w.jpg 480w,
-
- elva-fairy-800w.jpg 800w`,
- sizes: `(max-width: 600px) 480px,
- 800px`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy-480w.jpg')
- })
-
- test('picks from min-width', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 700,
- height: 700,
- },
- srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,
- sizes: `(min-width: 600px) 480px, 800px`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy-480w.jpg')
- })
-
- test('100vw size is treated as dimensions width', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 700,
- height: 700,
- },
- srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,
- sizes: `100vw`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy-800w.jpg')
- })
-
- test('100vw falls back to src', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 900,
- height: 900,
- },
- srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,
- sizes: `100vw`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy.jpg')
- })
-
- test('falls back to last value in sizes', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 700,
- height: 700,
- },
- srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,
- sizes: `(max-width: 600px) 480px, 800px`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy-800w.jpg')
- })
-
- test('uses src if missing rest', () => {
- expect(
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 700,
- height: 700,
- },
- src: 'elva-fairy.jpg',
- }).uri
- ).toBe('elva-fairy.jpg')
- })
-
- test('throws for 1x, 2x', () => {
- expect(
- () =>
- resolveSourceFromImgAttributes({
- dimensions: {
- width: 700,
- height: 700,
- },
- srcSet: `elva-fairy-480w.jpg 1x, elva-fairy-800w.jpg 2x`,
- sizes: `(max-width: 600px) 480px, 800px`,
- src: 'elva-fairy.jpg',
- }).uri
- ).toThrow()
- })
-})
diff --git a/packages/link/node_modules/solito/src/image/helpers.ts b/packages/link/node_modules/solito/src/image/helpers.ts
deleted file mode 100644
index 179c1bdb..00000000
--- a/packages/link/node_modules/solito/src/image/helpers.ts
+++ /dev/null
@@ -1,268 +0,0 @@
-import type NextImage from 'next/image'
-import type { ImageResizeMode } from 'react-native'
-import { defaultLoader } from './default-loader'
-
-import { ImageConfig, ImageConfigComplete } from './types'
-
-export type ImageLoaderProps = {
- src: string
- width: number
- quality?: number
-}
-
-function getWidths(
- { deviceSizes, allSizes }: ImageConfig,
- width: number | undefined,
- sizes: string | undefined
-): { widths: number[]; kind: 'w' | 'x' } {
- if (sizes) {
- // Find all the "vw" percent sizes used in the sizes prop
- const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g
- const percentSizes = []
- for (let match; (match = viewportWidthRe.exec(sizes)); match) {
- percentSizes.push(parseInt(match[2], 10))
- }
- if (percentSizes.length) {
- const smallestRatio = Math.min(...percentSizes) * 0.01
- return {
- widths: allSizes.filter((s) => s >= deviceSizes[0] * smallestRatio),
- kind: 'w',
- }
- }
- return { widths: allSizes, kind: 'w' }
- }
- if (typeof width !== 'number') {
- return { widths: deviceSizes, kind: 'w' }
- }
-
- const widths = [
- ...new Set(
- // > This means that most OLED screens that say they are 3x resolution,
- // > are actually 3x in the green color, but only 1.5x in the red and
- // > blue colors. Showing a 3x resolution image in the app vs a 2x
- // > resolution image will be visually the same, though the 3x image
- // > takes significantly more data. Even true 3x resolution screens are
- // > wasteful as the human eye cannot see that level of detail without
- // > something like a magnifying glass.
- // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html
- [width, width * 2 /*, width * 3*/].map(
- (w) => allSizes.find((p) => p >= w) || allSizes[allSizes.length - 1]
- )
- ),
- ]
- return { widths, kind: 'x' }
-}
-
-type GenImgAttrsData = {
- config: ImageConfig
- src: string
- unoptimized: boolean
- loader: typeof defaultLoader
- // | NonNullable['loader']>
- width?: number
- quality?: number
- sizes?: string
-}
-
-type GenImgAttrsResult = {
- src: string
- srcSet: string | undefined
- sizes: string | undefined
-}
-
-export function getInt(x: unknown): number | undefined {
- if (typeof x === 'number' || typeof x === 'undefined') {
- return x
- }
- if (typeof x === 'string' && /^[0-9]+$/.test(x)) {
- return parseInt(x, 10)
- }
- return NaN
-}
-
-export function generateImgAttrs({
- config,
- src,
- unoptimized,
- width,
- quality,
- sizes,
- loader,
-}: GenImgAttrsData): GenImgAttrsResult {
- if (unoptimized) {
- return { src, srcSet: undefined, sizes: undefined }
- }
-
- const { widths, kind } = getWidths(config, width, sizes)
- const last = widths.length - 1
-
- return {
- sizes: !sizes && kind === 'w' ? '100vw' : sizes,
- srcSet: widths
- .map(
- (w, i) =>
- `${loader({ src, quality, width: w, config })} ${
- kind === 'w' ? w : i + 1
- }${kind}`
- )
- .join(', '),
-
- // It's intended to keep `src` the last attribute because React updates
- // attributes in order. If we keep `src` the first one, Safari will
- // immediately start to fetch `src`, before `sizes` and `srcSet` are even
- // updated by React. That causes multiple unnecessary requests if `srcSet`
- // and `sizes` are defined.
- // This bug cannot be reproduced in Chrome or Firefox.
- src: loader({ quality, width: widths[last], src, config }),
- }
-}
-
-export const resolveSourceFromImgAttributes = ({
- src,
- srcSet,
- sizes,
- dimensions,
-}: {
- src: string
- srcSet?: string
- sizes?: string
- dimensions: {
- width: number
- height: number
- }
-}): { uri: string } => {
- try {
- if (srcSet) {
- const getVw = (size: string) => {
- return (parseInt(size.replace('vw', ''), 10) * dimensions.width) / 100
- }
- const getPix = (size: string) => {
- return parseInt(size.replace('px', ''), 10)
- }
- const getVwOrPix = (size: string) => {
- if (size.includes('vw')) {
- return getVw(size)
- }
- return getPix(size)
- }
- const getSize = (size: string): number => {
- if (size.includes(')')) {
- return getVwOrPix(size.split(')')[1])
- }
- if (size.endsWith('vw')) {
- return getVw(size)
- }
- return getPix(size)
- }
-
- const sizeSet = sizes?.split(',') ?? []
-
- let size = getSize(sizeSet[sizeSet.length - 1] || `100vw`)
- for (let sizeChunk of sizeSet) {
- sizeChunk = sizeChunk.trim()
-
- // regex to check for (min-width: or (max-width:
- const mediaQueryRegex = /(\(min-width:|\(max-width:)/
- const mediaQueryCondition = mediaQueryRegex.test(sizeChunk)
-
- if (mediaQueryCondition) {
- // the string looks like this: (max-width: 600px) 480px
- // extract pixels from media query, and then say if it's min or max-width
- // finally, get the pixels to the right as the actual sizeValue
-
- const minOrMax = sizeChunk.includes('min') ? 'min' : 'max'
- const heightOrWidth = sizeChunk.includes('-height')
- ? 'height'
- : 'width'
-
- const sizeString = sizeChunk
- .replace(mediaQueryRegex, '')
- .split(')')[1]
- .trim()
-
- const mediaQuerySize = sizeString.includes('px')
- ? parseInt(sizeString.replace('px', ''), 10)
- : sizeString.includes('vw')
- ? (parseInt(sizeString.replace('vw', ''), 10) / 100) *
- dimensions.width
- : null
-
- if (mediaQuerySize === null) {
- throw new Error(
- '[solito/image] Invalid condition passed to sizes (${sizes}). ${size} does not end in px or vw'
- )
- }
-
- let matches = false
-
- if (minOrMax === 'min') {
- matches = dimensions[heightOrWidth] >= mediaQuerySize
- } else if (minOrMax === 'max') {
- matches = dimensions[heightOrWidth] <= mediaQuerySize
- }
-
- if (matches) {
- size = mediaQuerySize
- break
- }
- }
- }
-
- const sources = srcSet.split(', ').map((source) => {
- const [sourceUrl, size] = source.trim().split(' ')
-
- if (size.endsWith('x')) {
- // throw new Error(
- // `[solito/image] srcSet does not support x descriptors, but it got "${size}" inside of ${srcSet}`
- // )
-
- // TODO what is the right way to handle 1x, 2x sizes?
-
- return {
- sourceUrl,
- size: parseInt(size.replace('x', ''), 10) * dimensions.width, // should this use image width?
- }
- }
-
- return {
- sourceUrl,
- size: parseInt(size.replace('w', ''), 10),
- }
- })
-
- const firstSourceThatMatchesforSize = sources.find(
- (source) => source.size >= size
- )
-
- if (firstSourceThatMatchesforSize) {
- return { uri: firstSourceThatMatchesforSize.sourceUrl }
- }
- }
-
- return {
- uri: src,
- }
- } catch (e: any) {
- throw new Error(
- `[solito/image] Error parsing srcSet & sizes: ${
- e?.message || 'unknown error.'
- }. ${JSON.stringify({ src, srcSet, sizes })}`
- )
- }
-}
-
-export const imageConfigDefault: ImageConfigComplete = {
- deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
- imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
- path: '/_next/image',
- // loader: 'default',
- // loaderFile: '',
- // domains: [],
- // disableStaticImages: false,
- // minimumCacheTTL: 60,
- // formats: ['image/webp'],
- // dangerouslyAllowSVG: false,
- // contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`,
- // remotePatterns: [],
- // unoptimized: false,
-}
diff --git a/packages/link/node_modules/solito/src/image/image.types.test.ts b/packages/link/node_modules/solito/src/image/image.types.test.ts
deleted file mode 100644
index 771b30bd..00000000
--- a/packages/link/node_modules/solito/src/image/image.types.test.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import type NextImage from 'next/image'
-
-import { SolitoImageProps } from './image.types'
-
-type NextImageProps = React.ComponentProps
-
-// eslint-disable-next-line @typescript-eslint/no-unused-vars
-const test: Array = [
- {
- src: '',
- height: 100,
- width: 100,
- alt: '',
- },
- {
- unoptimized: true,
- src: '',
- height: 100,
- width: 100,
- alt: '',
- },
- {
- src: null as any as Exclude,
- height: 100,
- width: 100,
- alt: '',
- },
- {
- src: 1,
- alt: '',
- },
-]
diff --git a/packages/link/node_modules/solito/src/image/image.types.ts b/packages/link/node_modules/solito/src/image/image.types.ts
deleted file mode 100644
index c809ec7e..00000000
--- a/packages/link/node_modules/solito/src/image/image.types.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import { ImageContentPosition } from 'expo-image'
-import type NextImage from 'next/image'
-import type { ImageStyle, ImageProps } from 'react-native'
-
-export type AccessibilityProp = key extends `aria-${string}`
- ? key
- : key extends `accessibility${Capitalize}`
- ? key
- : never
-
-type NextImageProps = React.ComponentProps
-
-export type SolitoImageProps = Pick<
- NextImageProps,
- | AccessibilityProp
- | 'alt'
- | 'blurDataURL'
- | 'placeholder'
- | 'loader'
- | 'priority'
- | 'loading'
- | 'sizes'
- | 'quality'
- | 'crossOrigin'
- | 'referrerPolicy'
- | 'quality'
- | 'unoptimized'
-> & {
- style?: ImageStyle
-} & (
- | {
- src: string
- height: number
- width: number
- fill?: false
- }
- | {
- src: string
- height?: number
- width?: number
- fill: true
- }
- | {
- src: Exclude | number
- height?: number
- width?: number
- fill?: boolean
- }
- ) &
- Pick<
- ImageProps,
- 'onLayout' | 'resizeMode' | AccessibilityProp
- > & {
- onLoadingComplete?: (info: { height: number; width: number }) => void
- fill?: boolean
- contentPosition?: ImageContentPosition
- }
diff --git a/packages/link/node_modules/solito/src/image/types.ts b/packages/link/node_modules/solito/src/image/types.ts
deleted file mode 100644
index 61e134d2..00000000
--- a/packages/link/node_modules/solito/src/image/types.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-export type ImageConfigComplete = {
- deviceSizes: number[]
- imageSizes: number[]
- /**
- * Example: `https://beatgig.com` or `http://localhost:3000`
- *
- * This is the URL to your Next.js app, used on iOS & Android to resolve relative URLs.
- *
- * For example, if you have `public/image.png` in your Next.js app, and your URL is `https://beatgig.com`,
- * then you can use `` and it will get the image from the next.js site.
- *
- * Docs: https://solito.dev/usage/image#solitoimageprovider-
- */
- nextJsURL?: `http:${string}` | `https:${string}`
- /**
- * You probably shouldn't touch this. It's only used on native to get your images.
- *
- * Default: `'/_next/image'`. You must set nextJsURL for this to work.
- */
- path?: string
- loader?: (info: { src: string; width: number; quality: number }) => string
-}
-
-export type ImageConfig = ImageConfigComplete & {
- allSizes: number[]
-}
diff --git a/packages/link/node_modules/solito/src/image/use-solito-image.ts b/packages/link/node_modules/solito/src/image/use-solito-image.ts
deleted file mode 100644
index 44391a45..00000000
--- a/packages/link/node_modules/solito/src/image/use-solito-image.ts
+++ /dev/null
@@ -1,162 +0,0 @@
-import { ImageStyle } from 'expo-image'
-import { useMemo, useSyncExternalStore } from 'react'
-import { ImageProps, Dimensions, StyleSheet } from 'react-native'
-
-import { useSolitoImageContext } from './context'
-import { defaultLoader } from './default-loader'
-import {
- generateImgAttrs,
- getInt,
- imageConfigDefault,
- resolveSourceFromImgAttributes,
-} from './helpers'
-import { SolitoImageProps } from './image.types'
-import { ImageConfig } from './types'
-
-export type UseSolitoImage = Pick<
- ImageProps,
- | Extract
- | 'progressiveRenderingEnabled'
- | 'source'
- | 'accessible'
- | 'onLayout'
-> & {
- onLoadingComplete?: (info: { height: number; width: number }) => void
- style: Array
-}
-
-export function useSolitoImage({
- src,
- loader,
- width,
- height,
- quality = 75,
- crossOrigin,
- referrerPolicy,
- alt,
- fill,
- onLoadingComplete,
- loading,
- priority,
- placeholder,
- blurDataURL,
- sizes,
- style,
- onLayout,
- unoptimized,
- ...props
-}: SolitoImageProps): UseSolitoImage {
- const contextConfig = useSolitoImageContext()
- const config = useMemo(() => {
- const c = { ...imageConfigDefault, ...contextConfig }
- const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b)
- const deviceSizes = c.deviceSizes.sort((a, b) => a - b)
- return { ...c, allSizes, deviceSizes }
- }, [contextConfig])
-
- const headers: { [key in string]: string } = {}
- if (crossOrigin === 'use-credentials') {
- headers['Access-Control-Allow-Credentials'] = 'true'
- }
- if (referrerPolicy != null) {
- headers['Referrer-Policy'] = referrerPolicy
- }
-
- const uri = useSyncExternalStore(
- (callback) => {
- const subscription = Dimensions.addEventListener('change', callback)
-
- return () => subscription?.remove()
- },
- () => {
- const dimensions = Dimensions.get('window')
-
- if (typeof src == 'string') {
- const attrs = generateImgAttrs({
- src,
- config,
- loader: ({ config: _, ...opts }) => {
- if (loader) {
- return loader(opts)
- }
- if (config.loader) {
- return config.loader({
- quality: Number(quality ?? 75),
- src: opts.src,
- width: opts.width,
- })
- }
- return defaultLoader({ ...opts, config })
- },
- unoptimized: Boolean(unoptimized),
- quality: getInt(quality || 75),
- sizes,
- width: getInt(width || 400),
- })
- const { uri } = resolveSourceFromImgAttributes({
- ...attrs,
- dimensions,
- })
-
- return uri
- }
- return undefined
- }
- )
-
- const source = useMemo(() => {
- const headers: { [key in string]: string } = {}
- if (crossOrigin === 'use-credentials') {
- headers['Access-Control-Allow-Credentials'] = 'true'
- }
- if (referrerPolicy != null) {
- headers['Referrer-Policy'] = referrerPolicy
- }
- if (typeof uri == 'string') {
- return {
- uri,
- height,
- width,
- headers,
- cache: priority ? 'force-cache' : 'default',
- }
- }
- return src as number
- }, [uri, src, height, width, priority, referrerPolicy, crossOrigin])
-
- return {
- ...props,
- progressiveRenderingEnabled: true,
- onLoadingComplete,
- source,
- accessible: Boolean(alt),
- onLayout,
- style: [
- fill
- ? StyleSheet.absoluteFill
- : {
- height,
- width,
- },
- style,
- ] as any,
-
- // adapter for older versions of RN
- // /~https://github.com/facebook/react-native/blob/main/Libraries/Image/Image.android.js#L169-L194
- accessibilityLabel: props['aria-label'] ?? alt,
- accessibilityState: {
- busy: booleanish(props['aria-busy']),
- checked: booleanish(props['aria-checked']),
- disabled: booleanish(props['aria-disabled']),
- expanded: booleanish(props['aria-expanded']),
- selected: booleanish(props['aria-selected']),
- },
- }
-}
-
-function booleanish(value?: Value) {
- // this should get upstreamed in RN
- return (
- value === 'true' ? true : value === 'false' ? false : value
- ) as Exclude
-}
diff --git a/packages/link/node_modules/solito/src/index.ts b/packages/link/node_modules/solito/src/index.ts
deleted file mode 100644
index 5c3de9a7..00000000
--- a/packages/link/node_modules/solito/src/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './types/solito-page'
-export * from './middleware/provider'
-export * from './params'
diff --git a/packages/link/node_modules/solito/src/link/core.tsx b/packages/link/node_modules/solito/src/link/core.tsx
deleted file mode 100644
index d0e41613..00000000
--- a/packages/link/node_modules/solito/src/link/core.tsx
+++ /dev/null
@@ -1,90 +0,0 @@
-import React from 'react'
-import type { ComponentProps, ComponentType } from 'react'
-import { Platform } from 'react-native'
-
-import { openURL } from './linking'
-import { NextLink } from './next-link'
-import { useLink } from './use-custom-link'
-
-export type LinkCoreProps = {
- children: React.ReactNode
-} & Omit<
- ComponentProps,
- 'passHref' | 'replace' | 'legacyBehavior'
-> &
- (
- | {
- replace?: false
- experimental?: undefined
- }
- | {
- replace: true
- experimental?: {
- nativeBehavior: 'stack-replace'
- isNestedNavigator: boolean
- }
- }
- )
-
-function LinkCore({
- children,
- href,
- as,
- componentProps,
- Component,
- replace,
- experimental,
- ...props
-}: LinkCoreProps & {
- Component: ComponentType
- componentProps?: any
-}) {
- if (Platform.OS === 'web') {
- return (
-
- {children}
-
- )
- }
- // eslint-disable-next-line react-hooks/rules-of-hooks
- const linkTo = useLink({
- href,
- as,
- replace,
- experimental,
- })
- return (
- {
- componentProps?.onPress?.(e)
- const link = as || href
- if (e?.defaultPrevented) return
- // Handles external URLs
- if (typeof link === 'string' && isAbsoluteUrl(link)) {
- openURL(link)
- } else {
- linkTo.onPress(e)
- }
- }}
- >
- {children}
-
- )
-}
-
-// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1
-// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3
-const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/
-// Source - /~https://github.com/vercel/next.js/blob/77b5f79a4dff453abb62346bf75b14d859539b81/packages/next/shared/lib/utils.ts#L313
-const isAbsoluteUrl = (url: string) => ABSOLUTE_URL_REGEX.test(url)
-
-export { LinkCore }
diff --git a/packages/link/node_modules/solito/src/link/index.tsx b/packages/link/node_modules/solito/src/link/index.tsx
deleted file mode 100644
index 541110dc..00000000
--- a/packages/link/node_modules/solito/src/link/index.tsx
+++ /dev/null
@@ -1,4 +0,0 @@
-export * from './core'
-export * from './text-link'
-export * from './link'
-export * from './use-custom-link'
diff --git a/packages/link/node_modules/solito/src/link/link.tsx b/packages/link/node_modules/solito/src/link/link.tsx
deleted file mode 100644
index 8653c374..00000000
--- a/packages/link/node_modules/solito/src/link/link.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-'use client'
-import { Platform, Pressable, ViewProps, View } from 'react-native'
-
-import { LinkCore, LinkCoreProps } from './core'
-
-type LinkProps = LinkCoreProps & { viewProps?: ViewProps }
-
-function Link({ viewProps, ...props }: LinkProps) {
- return (
-
- )
-}
-
-export { Link }
-export type { LinkProps }
diff --git a/packages/link/node_modules/solito/src/link/linking.ts b/packages/link/node_modules/solito/src/link/linking.ts
deleted file mode 100644
index 98f2161f..00000000
--- a/packages/link/node_modules/solito/src/link/linking.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { Linking } from 'react-native'
-
-export const openURL = (url: string) => Linking.openURL(url)
diff --git a/packages/link/node_modules/solito/src/link/linking.web.ts b/packages/link/node_modules/solito/src/link/linking.web.ts
deleted file mode 100644
index 573a05c5..00000000
--- a/packages/link/node_modules/solito/src/link/linking.web.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-// noop, not supported on web
-export const openURL = (url: string) => {}
diff --git a/packages/link/node_modules/solito/src/link/next-link.tsx b/packages/link/node_modules/solito/src/link/next-link.tsx
deleted file mode 100644
index eae0325d..00000000
--- a/packages/link/node_modules/solito/src/link/next-link.tsx
+++ /dev/null
@@ -1,5 +0,0 @@
-import type Link from 'next/link'
-
-export const NextLink = (() => {
- return <>>
-}) as any as typeof Link
diff --git a/packages/link/node_modules/solito/src/link/next-link.web.tsx b/packages/link/node_modules/solito/src/link/next-link.web.tsx
deleted file mode 100644
index 0ea20cc8..00000000
--- a/packages/link/node_modules/solito/src/link/next-link.web.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { default as NextLink } from 'next/link'
diff --git a/packages/link/node_modules/solito/src/link/text-link.tsx b/packages/link/node_modules/solito/src/link/text-link.tsx
deleted file mode 100644
index 34accc13..00000000
--- a/packages/link/node_modules/solito/src/link/text-link.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-'use client'
-import { TextProps, Text } from 'react-native'
-
-import { LinkCore, LinkCoreProps } from './core'
-
-type TextLinkProps = LinkCoreProps & { textProps?: TextProps }
-
-function TextLink({ textProps, ...props }: TextLinkProps) {
- return (
-
- )
-}
-
-export { TextLink }
-export type { TextLinkProps }
diff --git a/packages/link/node_modules/solito/src/link/use-custom-link.tsx b/packages/link/node_modules/solito/src/link/use-custom-link.tsx
deleted file mode 100644
index 6ce4dda5..00000000
--- a/packages/link/node_modules/solito/src/link/use-custom-link.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { GestureResponderEvent, Platform } from 'react-native'
-
-import { useRouter } from '../router'
-import { LinkCoreProps } from './core'
-
-export type UseLinkProps = Pick<
- LinkCoreProps,
- 'as' | 'shallow' | 'href' | 'scroll' | 'replace' | 'experimental'
->
-
-export function useLink({
- href,
- as,
- shallow,
- scroll,
- replace,
- experimental,
-}: UseLinkProps) {
- const router = useRouter()
-
- // /~https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/useLinkProps.tsx#L64
- const onPress = (
- e?: React.MouseEvent | GestureResponderEvent
- ) => {
- let shouldHandle = false
-
- if (Platform.OS !== 'web' || !e) {
- shouldHandle = e ? !e.defaultPrevented : true
- } else if (
- !e.defaultPrevented && // onPress prevented default
- // @ts-expect-error: these properties exist on web, but not in React Native
- !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys
- // @ts-expect-error: these properties exist on web, but not in React Native
- (e.button == null || e.button === 0) && // ignore everything but left clicks
- // @ts-expect-error: these properties exist on web, but not in React Native
- [undefined, null, '', 'self'].includes(e.currentTarget?.target) // let browser handle "target=_blank" etc.
- ) {
- e.preventDefault()
- shouldHandle = true
- }
-
- if (shouldHandle) {
- if (href === '#') {
- // this is a way on web to stay on the same page
- // useful for conditional hrefs
- return
- }
- if (replace) {
- router.replace(href, as, { shallow, scroll, experimental })
- } else {
- router.push(href, as, {
- shallow,
- scroll,
- })
- }
- }
- }
-
- return {
- accessibilityRole: 'link' as const,
- onPress,
- href: router.parseNextPath(as || href),
- }
-}
diff --git a/packages/link/node_modules/solito/src/middleware/context.tsx b/packages/link/node_modules/solito/src/middleware/context.tsx
deleted file mode 100644
index fa5d2437..00000000
--- a/packages/link/node_modules/solito/src/middleware/context.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import { useLinkTo } from '@react-navigation/native'
-import { createContext } from 'react'
-
-import { MiddlewareContextType } from './types'
-
-export const MiddlewareContext = createContext({
- useLinkTo,
- // useLinkProps,
-})
diff --git a/packages/link/node_modules/solito/src/middleware/context.web.tsx b/packages/link/node_modules/solito/src/middleware/context.web.tsx
deleted file mode 100644
index dc566e91..00000000
--- a/packages/link/node_modules/solito/src/middleware/context.web.tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { createContext } from 'react'
-
-import { MiddlewareContextType } from './types'
-
-function error() {
- throw new Error(
- '[solito] useLinkTo should not be called on Web. Is next/router defined?'
- )
-}
-
-export const MiddlewareContext = createContext({
- useLinkTo() {
- return error
- },
-})
diff --git a/packages/link/node_modules/solito/src/middleware/provider.tsx b/packages/link/node_modules/solito/src/middleware/provider.tsx
deleted file mode 100644
index 5577e987..00000000
--- a/packages/link/node_modules/solito/src/middleware/provider.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from 'react'
-
-import { MiddlewareContext } from './context'
-import { MiddlewareContextType } from './types'
-
-type Props = {
- middleware: MiddlewareContextType
-}
-
-export function SolitoProvider({
- children,
- middleware,
-}: { children: React.ReactNode } & Props) {
- return (
-
- {children}
-
- )
-}
diff --git a/packages/link/node_modules/solito/src/middleware/types.ts b/packages/link/node_modules/solito/src/middleware/types.ts
deleted file mode 100644
index 9270e68d..00000000
--- a/packages/link/node_modules/solito/src/middleware/types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import type { useLinkTo } from '@react-navigation/native'
-
-export type MiddlewareContextType = {
- useLinkTo?: typeof useLinkTo
-}
diff --git a/packages/link/node_modules/solito/src/moti/index.tsx b/packages/link/node_modules/solito/src/moti/index.tsx
deleted file mode 100644
index 6bbafd20..00000000
--- a/packages/link/node_modules/solito/src/moti/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export * from './link'
diff --git a/packages/link/node_modules/solito/src/moti/link.tsx b/packages/link/node_modules/solito/src/moti/link.tsx
deleted file mode 100644
index e34f5dbf..00000000
--- a/packages/link/node_modules/solito/src/moti/link.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { MotiPressableProps, MotiPressable } from 'moti/interactions'
-import React, { forwardRef } from 'react'
-import type { View } from 'react-native'
-
-import { useLink, UseLinkProps } from '../link/use-custom-link'
-
-export type MotiLinkProps = UseLinkProps &
- Omit<
- MotiPressableProps,
- // you can't pass any props that will be overridden by useLink
- | keyof UseLinkProps
- | keyof Pick, 'href' | 'accessibilityRole'>
- >
-
-export const MotiLink = forwardRef((props, ref) => {
- const { onPress, ...linkProps } = useLink(props)
-
- return (
- {
- // @ts-expect-error no event argument
- // we let users pass an onPress prop, in case they want to preventDefault()
- props.onPress?.(e)
-
- onPress?.(e)
- }}
- ref={ref}
- />
- )
-})
-
-MotiLink.displayName = 'MotiLink'
diff --git a/packages/link/node_modules/solito/src/params/index.tsx b/packages/link/node_modules/solito/src/params/index.tsx
deleted file mode 100644
index 686d4fd5..00000000
--- a/packages/link/node_modules/solito/src/params/index.tsx
+++ /dev/null
@@ -1,348 +0,0 @@
-/* eslint-disable react-hooks/rules-of-hooks */
-// From https://gist.github.com/nandorojo/052887f99bb61b54845474f324aa41cc
-
-import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
-import { Platform } from 'react-native'
-
-import { useNavigation } from '../router/use-navigation'
-import Router from './router'
-import { useRoute } from './use-route'
-import { useRouter } from './use-router'
-
-function useStable(value: T) {
- const ref = useRef(value)
- useEffect(() => {
- ref.current = value
- }, [value])
-
- return ref
-}
-
-function useStableCallback any>(
- callback: T | undefined
-): T {
- const callbackRef = useRef(callback)
-
- useEffect(() => {
- callbackRef.current = callback
- })
-
- // /~https://github.com/facebook/react/issues/19240
- return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, [])
-}
-
-type Config<
- Props extends Record,
- Required extends boolean,
- ParsedType,
- InitialValue
-> = (Required extends false
- ? {
- parse?: (value?: string | string[]) => ParsedType
- }
- : {
- parse: (value?: string | string[]) => ParsedType
- }) & {
- stringify?: (value: ParsedType) => string
- initial: InitialValue
- paramsToClearOnSetState?: (keyof Props)[]
-}
-
-type Params<
- Props extends Record = Record,
- Name extends keyof Props = keyof Props,
- NullableUnparsedParsedType extends Props[Name] | undefined =
- | Props[Name]
- | undefined,
- ParseFunction extends
- | undefined
- | ((
- value?: string | string[]
- ) => NonNullable) = (
- value?: string | string[]
- ) => NonNullable,
- InitialValue = NullableUnparsedParsedType | undefined,
- ParsedType = InitialValue extends undefined
- ? NullableUnparsedParsedType
- : ParseFunction extends undefined
- ? NullableUnparsedParsedType
- : NonNullable
-> = NonNullable extends string
- ?
- | [name: Name, config: Config]
- | [name: Name]
- : [name: Name, config: Config]
-
-type Returns<
- Props extends Record = Record,
- Name extends keyof Props = keyof Props,
- NullableUnparsedParsedType extends Props[Name] | undefined =
- | Props[Name]
- | undefined,
- ParseFunction extends
- | undefined
- | ((
- value?: string | string[]
- ) => NonNullable) = (
- value?: string | string[]
- ) => NonNullable,
- InitialValue = NullableUnparsedParsedType | undefined,
- ParsedType = InitialValue extends undefined
- ? NullableUnparsedParsedType
- : ParseFunction extends undefined
- ? NullableUnparsedParsedType
- : NonNullable
-> = readonly [
- state: ParsedType | InitialValue,
- setState: (value: ParsedType, options?: SetStateOptions) => void
-]
-
-type SetStateOptions = {
- /**
- * Override whether this function calls `Router.push` or `Router.replace`.
- *
- * By default, `Router.push` is called if the query parameter already exists in the URL.
- */
- webBehavior?: 'push' | 'replace'
-}
-
-export function createParam<
- Props extends Record = Record
->() {
- function useParam<
- Name extends keyof Props,
- NullableUnparsedParsedType extends Props[Name] | undefined =
- | Props[Name]
- | undefined,
- ParseFunction extends
- | undefined
- | ((
- value?: string | string[]
- ) => NonNullable) = (
- value?: string | string[]
- ) => NonNullable,
- InitialValue = NullableUnparsedParsedType | undefined,
- ParsedType = InitialValue extends undefined
- ? NullableUnparsedParsedType
- : ParseFunction extends undefined
- ? NullableUnparsedParsedType
- : NonNullable
- >(
- ...[name, maybeConfig]: Params<
- Props,
- Name,
- NullableUnparsedParsedType,
- ParseFunction,
- InitialValue,
- ParsedType
- >
- ): Returns<
- Props,
- Name,
- NullableUnparsedParsedType,
- ParseFunction,
- InitialValue,
- ParsedType
- > {
- const {
- parse = (value?: string | string[]) => value,
- initial,
- stringify = (value: ParsedType) => `${value}`,
- paramsToClearOnSetState,
- } = maybeConfig || {}
- const nextRouter = useRouter()
- const nativeRoute = useRoute()
- const nativeNavigation = useNavigation()
- const nativeStateFromParams = (nativeRoute?.params as any)?.[
- name
- ] as ParsedType
-
- const [nativeStateFromReact, setNativeStateFromReact] = useState<
- ParsedType | InitialValue
- >(() => nativeStateFromParams ?? (initial as InitialValue))
-
- const setNativeStateFromParams = useCallback((value: ParsedType) => {
- nativeNavigation?.setParams({
- [name]: value,
- })
- }, [])
-
- const nativeState = nativeRoute
- ? nativeStateFromParams
- : nativeStateFromReact
- const setNativeState = nativeRoute
- ? setNativeStateFromParams
- : setNativeStateFromReact
-
- const stableStringify = useStableCallback(stringify)
- const stableParse = useStableCallback(parse)
- const stableParamsToClear = useStable(paramsToClearOnSetState)
-
- const initialValue = useRef(initial)
- const hasSetState = useRef(false)
-
- const setState = useCallback(
- (value: ParsedType, options?: SetStateOptions) => {
- hasSetState.current = true
- const { pathname, query } = Router
- const newQuery = { ...query }
- if (value != null && (value as any) !== '') {
- newQuery[name as string] = stableStringify(value)
- } else {
- delete newQuery[name as string]
- }
-
- if (stableParamsToClear.current) {
- for (const paramKey of stableParamsToClear.current) {
- delete newQuery[paramKey as string]
- }
- }
-
- const willChangeExistingParam =
- query[name as string] && newQuery[name as string]
-
- let action = willChangeExistingParam ? Router.replace : Router.push
-
- if (options?.webBehavior) {
- action = Router[options.webBehavior]
- }
-
- action(
- {
- pathname,
- query: newQuery,
- },
- undefined,
- {
- shallow: true,
- }
- )
- },
- [name, stableStringify, stableParamsToClear]
- )
-
- const webParam = nextRouter?.query?.[name as string]
-
- const state = useMemo(() => {
- let state: ParsedType
- if (webParam === undefined && !hasSetState.current) {
- state = initialValue.current as any
- } else {
- state = stableParse(webParam) as ParsedType
- }
- return state
- }, [stableParse, webParam])
-
- if (Platform.OS !== 'web') {
- if (!nativeRoute) {
- console.error(
- `[solito] useParam('${
- name as string
- }') called when there is no React Navigation route available. In a future version, this will throw an error. Please fix this by only calling useParam() inside of a React Navigation route. For now, Solito will fallback to using React state.`
- )
- }
- return [nativeState, setNativeState]
- }
-
- return [state, setState]
- }
-
- type UpdateOptions = {
- web?: {
- replace?: boolean
- }
- }
-
- function useUpdateParams(): (
- props: Partial,
- options?: UpdateOptions
- ) => void {
- const nativeNavigation = useNavigation()
-
- const setNativeStateFromParams = useCallback((value: Partial) => {
- nativeNavigation?.setParams(value)
- }, [])
-
- const setWebState = useCallback(
- (value: Partial, options?: UpdateOptions) => {
- const { pathname, query } = Router
- const newQuery = { ...query, ...value }
- for (const key in value) {
- if (value[key] == null || value[key] === '') {
- delete newQuery[key]
- }
- }
-
- const action = options?.web?.replace ? Router.replace : Router.push
-
- action(
- {
- pathname,
- query: newQuery,
- },
- undefined,
- {
- shallow: true,
- }
- )
- },
- []
- )
-
- return Platform.select({
- web: setWebState,
- default: setNativeStateFromParams,
- })
- }
-
- function useParams(): {
- params: Props
- setParams: (value: Partial, options?: SetStateOptions) => void
- } {
- if (Platform.OS !== 'web') {
- const nativeRoute = useRoute()
- const nativeNavigation = useNavigation()
-
- return {
- params: nativeRoute?.params as Props,
- setParams: useCallback(
- (params) => nativeNavigation?.setParams(params),
- [nativeNavigation]
- ),
- }
- }
- const nextRouter = useRouter()
-
- return {
- params: nextRouter?.query as Props,
- setParams: useCallback((params, options) => {
- const { pathname, query } = Router
- const newQuery = { ...query, ...params }
- for (const key in params) {
- if (params[key] == null || params[key] === '') {
- delete newQuery[key]
- }
- }
-
- const action = Router[options?.webBehavior ?? 'push']
-
- action(
- {
- pathname,
- query: newQuery,
- },
- undefined,
- {
- shallow: true,
- }
- )
- }, []),
- }
- }
-
- return {
- useParam,
- useUpdateParams,
- useParams,
- }
-}
diff --git a/packages/link/node_modules/solito/src/params/router.ts b/packages/link/node_modules/solito/src/params/router.ts
deleted file mode 100644
index babe0038..00000000
--- a/packages/link/node_modules/solito/src/params/router.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import type Router from 'next/router'
-
-export default undefined as any as typeof Router
diff --git a/packages/link/node_modules/solito/src/params/router.web.ts b/packages/link/node_modules/solito/src/params/router.web.ts
deleted file mode 100644
index 135039c6..00000000
--- a/packages/link/node_modules/solito/src/params/router.web.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { default } from 'next/router'
diff --git a/packages/link/node_modules/solito/src/params/use-route.ts b/packages/link/node_modules/solito/src/params/use-route.ts
deleted file mode 100644
index 236c2c32..00000000
--- a/packages/link/node_modules/solito/src/params/use-route.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { NavigationRouteContext } from '@react-navigation/native'
-import { useContext } from 'react'
-
-export const useRoute = () => useContext(NavigationRouteContext)
diff --git a/packages/link/node_modules/solito/src/params/use-route.web.ts b/packages/link/node_modules/solito/src/params/use-route.web.ts
deleted file mode 100644
index 0b2270fb..00000000
--- a/packages/link/node_modules/solito/src/params/use-route.web.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const useRoute = () => undefined
diff --git a/packages/link/node_modules/solito/src/params/use-router.ts b/packages/link/node_modules/solito/src/params/use-router.ts
deleted file mode 100644
index cc8964a4..00000000
--- a/packages/link/node_modules/solito/src/params/use-router.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { NextRouter } from 'next/router'
-
-export const useRouter = () => undefined as NextRouter | undefined
diff --git a/packages/link/node_modules/solito/src/params/use-router.web.ts b/packages/link/node_modules/solito/src/params/use-router.web.ts
deleted file mode 100644
index 5c4df31f..00000000
--- a/packages/link/node_modules/solito/src/params/use-router.web.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { useRouter as _useRouter } from 'next/router';
-
-export const useRouter = () => _useRouter();
\ No newline at end of file
diff --git a/packages/link/node_modules/solito/src/router/index.ts b/packages/link/node_modules/solito/src/router/index.ts
deleted file mode 100644
index f83be7ee..00000000
--- a/packages/link/node_modules/solito/src/router/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './parse-next-path'
-export * from './use-router'
diff --git a/packages/link/node_modules/solito/src/router/next-router.ts b/packages/link/node_modules/solito/src/router/next-router.ts
deleted file mode 100644
index 7c937aab..00000000
--- a/packages/link/node_modules/solito/src/router/next-router.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import Router from 'next/router'
-
-export const NextRouter: typeof Router | undefined = Router
diff --git a/packages/link/node_modules/solito/src/router/next-router.web.ts b/packages/link/node_modules/solito/src/router/next-router.web.ts
deleted file mode 100644
index c7306e94..00000000
--- a/packages/link/node_modules/solito/src/router/next-router.web.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const NextRouter = undefined
diff --git a/packages/link/node_modules/solito/src/router/parse-next-path.ts b/packages/link/node_modules/solito/src/router/parse-next-path.ts
deleted file mode 100644
index f8f80a87..00000000
--- a/packages/link/node_modules/solito/src/router/parse-next-path.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import type { NextRouter } from 'next/router'
-
-const parseNextPath = (from: Parameters[0]) => {
- let path = (typeof from == 'string' ? from : from.pathname) || ''
-
- // replace each instance of [key] with the corresponding value from query[key]
- // this ensures we're navigating to the correct URL
- // it currently ignores [[...param]]
- // but I can't see why you would use this with RN + Next.js
- if (typeof from == 'object' && from.query && typeof from.query == 'object') {
- const query = { ...from.query }
- for (const key in query) {
- if (path.includes(`[${key}]`)) {
- path = path.replace(`[${key}]`, `${query[key] ?? ''}`)
- delete query[key]
- } else if (path.includes(`[...${key}]`)) {
- const values = query[key]
- if (Array.isArray(values)) {
- path = path.replace(`[...${key}]`, values.join('/'))
- delete query[key]
- }
- }
- }
- if (Object.keys(query).length) {
- path += '?'
- for (const key in query) {
- if (query[key] != null) {
- path += `${key}=${query[key]}&`
- }
- }
- if (path.endsWith('&') || path.endsWith('?')) {
- path = path.slice(0, -1)
- }
- }
- }
-
- return path
-}
-
-export { parseNextPath }
diff --git a/packages/link/node_modules/solito/src/router/replace-helpers.ts b/packages/link/node_modules/solito/src/router/replace-helpers.ts
deleted file mode 100644
index a6e733ee..00000000
--- a/packages/link/node_modules/solito/src/router/replace-helpers.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import {
- StackActions,
- getStateFromPath,
- getActionFromState,
-} from '@react-navigation/native'
-// THIS IS DANGEROUS
-// IT ONLY WORKS ON NATIVE BECAUSE NATIVE USES THE SRC FOLDER CURRENTLY.
-// THIS IS SUPER UNSAFE
-// WE SHOULD BE USING THE EXPOSED VARIABLE
-// see: /~https://github.com/react-navigation/react-navigation/discussions/10517
-// PR: /~https://github.com/react-navigation/react-navigation/pull/10604
-import LinkingContext from '@react-navigation/native/src/LinkingContext'
-
-export { LinkingContext, StackActions, getStateFromPath, getActionFromState }
diff --git a/packages/link/node_modules/solito/src/router/replace-helpers.web.ts b/packages/link/node_modules/solito/src/router/replace-helpers.web.ts
deleted file mode 100644
index 10c3aafb..00000000
--- a/packages/link/node_modules/solito/src/router/replace-helpers.web.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { createContext } from 'react'
-
-const LinkingContext = createContext({
- options: undefined,
-})
-
-let StackActions, getStateFromPath, getActionFromState
-
-export { LinkingContext, StackActions, getStateFromPath, getActionFromState }
diff --git a/packages/link/node_modules/solito/src/router/use-link-to.ts b/packages/link/node_modules/solito/src/router/use-link-to.ts
deleted file mode 100644
index 48343d6a..00000000
--- a/packages/link/node_modules/solito/src/router/use-link-to.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { useLinkTo as useNativeLinkTo } from '@react-navigation/native'
-import { useContext } from 'react'
-
-import { MiddlewareContext } from '../middleware/context'
-
-export function useLinkTo() {
- const hook = useContext(MiddlewareContext).useLinkTo ?? useNativeLinkTo
-
- return hook()
-}
diff --git a/packages/link/node_modules/solito/src/router/use-link-to.web.ts b/packages/link/node_modules/solito/src/router/use-link-to.web.ts
deleted file mode 100644
index e72860ba..00000000
--- a/packages/link/node_modules/solito/src/router/use-link-to.web.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-const noOp = () => {
- throw new Error(
- '[use-link-to] is not supported on the web. Something went wrong if you called this.'
- )
-}
-
-/**
- * @deprecated imported from the wrong file. Use `use-link-to` instead.
- */
-export const useLinkTo = () => noOp
diff --git a/packages/link/node_modules/solito/src/router/use-navigation.ts b/packages/link/node_modules/solito/src/router/use-navigation.ts
deleted file mode 100644
index 3351c11a..00000000
--- a/packages/link/node_modules/solito/src/router/use-navigation.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import {
- NavigationContext,
- NavigationContainerRefContext,
-} from '@react-navigation/core'
-import { useContext } from 'react'
-
-export const useNavigation = () => {
- const root = useContext(NavigationContainerRefContext)
- const navigation = useContext(NavigationContext)
-
- if (navigation === undefined && root === undefined) {
- throw new Error(
- "Couldn't find a navigation object. Is your component inside NavigationContainer?"
- )
- }
-
- return navigation !== null && navigation !== void 0 ? navigation : root
-}
diff --git a/packages/link/node_modules/solito/src/router/use-navigation.web.ts b/packages/link/node_modules/solito/src/router/use-navigation.web.ts
deleted file mode 100644
index 6a0e758f..00000000
--- a/packages/link/node_modules/solito/src/router/use-navigation.web.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const useNavigation = () => undefined
diff --git a/packages/link/node_modules/solito/src/router/use-next-router.ts b/packages/link/node_modules/solito/src/router/use-next-router.ts
deleted file mode 100644
index 33fbd678..00000000
--- a/packages/link/node_modules/solito/src/router/use-next-router.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import type { useRouter } from 'next/router'
-
-export const useNextRouter = (): ReturnType | undefined =>
- undefined
diff --git a/packages/link/node_modules/solito/src/router/use-next-router.web.ts b/packages/link/node_modules/solito/src/router/use-next-router.web.ts
deleted file mode 100644
index 40a2dc5f..00000000
--- a/packages/link/node_modules/solito/src/router/use-next-router.web.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { useRouter as useNextRouter } from 'next/router'
diff --git a/packages/link/node_modules/solito/src/router/use-router.ts b/packages/link/node_modules/solito/src/router/use-router.ts
deleted file mode 100644
index 84164d18..00000000
--- a/packages/link/node_modules/solito/src/router/use-router.ts
+++ /dev/null
@@ -1,139 +0,0 @@
-import type { NextRouter as NextRouterType } from 'next/router'
-import { useContext, useMemo } from 'react'
-import { Platform } from 'react-native'
-
-import { parseNextPath } from './parse-next-path'
-import {
- getActionFromState,
- getStateFromPath,
- LinkingContext,
- StackActions,
-} from './replace-helpers'
-import { useLinkTo } from './use-link-to'
-import { useNavigation } from './use-navigation'
-import { useNextRouter } from './use-next-router'
-
-// copied from next/router to appease typescript error
-// if we don't manually write this here, then we get some ReturnType error on build
-// 🤷♂️
-interface TransitionOptions {
- shallow?: boolean
- locale?: string | false
- scroll?: boolean
-}
-
-export function useRouter() {
- const linkTo = useLinkTo()
- const navigation = useNavigation()
-
- const nextRouter = useNextRouter()
-
- const linking = useContext(LinkingContext)
-
- return useMemo(
- () => ({
- push: (
- url: Parameters[0],
- as?: Parameters[1],
- transitionOptions?: TransitionOptions
- ) => {
- if (Platform.OS === 'web') {
- nextRouter?.push(url, as, transitionOptions)
- } else {
- const to = parseNextPath(as || url)
-
- if (to) {
- linkTo(to)
- }
- }
- },
- replace: (
- url: Parameters[0],
- as?: Parameters[1],
- transitionOptions?: TransitionOptions & {
- experimental?:
- | {
- nativeBehavior?: undefined
- }
- | {
- nativeBehavior: 'stack-replace'
- isNestedNavigator: boolean
- }
- }
- ) => {
- if (Platform.OS === 'web') {
- nextRouter?.replace(url, as, transitionOptions)
- } else {
- const to = parseNextPath(as || url)
-
- if (to) {
- if (
- transitionOptions?.experimental?.nativeBehavior ===
- 'stack-replace'
- ) {
- if (linking?.options) {
- // custom logic to create a replace() from a URL on native
- // /~https://github.com/react-navigation/react-navigation/discussions/10517
- const { options } = linking
-
- const state = options?.getStateFromPath
- ? options.getStateFromPath(to, options.config)
- : getStateFromPath(to, options?.config)
-
- if (state) {
- const action = getActionFromState(state, options?.config)
-
- if (action !== undefined) {
- if (
- 'payload' in action &&
- action.payload &&
- 'name' in action.payload &&
- action.payload.name
- ) {
- const { name, params } = action.payload
- if (
- transitionOptions?.experimental?.isNestedNavigator &&
- params &&
- 'screen' in params &&
- params.screen
- ) {
- navigation?.dispatch(
- StackActions.replace(
- params.screen,
- params.params as object | undefined
- )
- )
- } else {
- navigation?.dispatch(StackActions.replace(name, params))
- }
- } else {
- navigation?.dispatch(action)
- }
- } else {
- navigation?.reset(state)
- }
- }
- } else {
- // fallback in case the linking context didn't work
- console.warn(`[solito] replace("${to}") faced an issue. You should still see your new screen, but it probably didn't replace the previous one. This may be due to a breaking change in React Navigation.
- Please open an issue at /~https://github.com/nandorojo/solito and report how this happened. Thanks!`)
- linkTo(to)
- }
- } else {
- linkTo(to)
- }
- }
- }
- },
- back: () => {
- if (Platform.OS === 'web') {
- nextRouter?.back()
- } else {
- navigation?.goBack()
- }
- },
- parseNextPath,
- }),
- [linkTo, navigation]
- )
-}
diff --git a/packages/link/node_modules/solito/src/types/solito-page.tsx b/packages/link/node_modules/solito/src/types/solito-page.tsx
deleted file mode 100644
index 2db5daab..00000000
--- a/packages/link/node_modules/solito/src/types/solito-page.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-/* eslint-disable @typescript-eslint/ban-types */
-import type { NextPage } from 'next'
-import type { AppProps } from 'next/app'
-
-interface SolitoCustomNavigationOptions {}
-
-interface SolitoNavigationOptions extends SolitoCustomNavigationOptions {
- previousPagePath?: string | null
-}
-
-type NavigationOptions =
- | SolitoNavigationOptions
- | ((router?: AppProps['router']) => SolitoNavigationOptions)
-
-type SolitoPage = NextPage
& {
- navigationOptions?: NavigationOptions
- getLayout?: (
- page: React.ReactNode,
- options?: NavigationOptions
- ) => React.ReactNode
-}
-
-export type SolitoAppProps
= Omit, 'Component'> & {
- Component: AppProps['Component'] & {
- navigationOptions?: NavigationOptions
- getLayout?: (
- page: React.ReactNode,
- options?: NavigationOptions
- ) => React.ReactNode
- }
-}
-
-export type {
- SolitoPage,
- SolitoNavigationOptions,
- SolitoCustomNavigationOptions,
-}
diff --git a/yarn.lock b/yarn.lock
index 054c6044..378fc04b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -63,7 +63,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/core@npm:7.21.4":
+"@babel/core@npm:^7.1.0, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.17.9, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.0, @babel/core@npm:^7.20.2, @babel/core@npm:^7.7.5, @babel/core@npm:~7.21.0":
version: 7.21.4
resolution: "@babel/core@npm:7.21.4"
dependencies:
@@ -1522,7 +1522,7 @@ __metadata:
languageName: node
linkType: hard
-"@babel/runtime@npm:7.21.0":
+"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.14.5, @babel/runtime@npm:^7.17.2, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.6, @babel/runtime@npm:^7.18.9, @babel/runtime@npm:^7.19.4, @babel/runtime@npm:^7.20.0, @babel/runtime@npm:^7.20.1, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4":
version: 7.21.0
resolution: "@babel/runtime@npm:7.21.0"
dependencies:
@@ -11569,7 +11569,7 @@ __metadata:
react-native-screens: ^3.20.0
react-native-svg: ^13.4.0
react-native-web: ^0.18.12
- typescript: ^5.0.3
+ typescript: ^5.0.4
languageName: unknown
linkType: soft
@@ -16801,6 +16801,8 @@ __metadata:
next-images: ^1.8.4
next-transpile-modules: ^10.0.0
raf: ^3.4.1
+ react: ^18.2.0
+ react-dom: ^18.2.0
react-native: ^0.71.6
react-native-web: ^0.18.12
react-native-web-lite: 1.15.14
@@ -18893,7 +18895,7 @@ __metadata:
languageName: node
linkType: hard
-"react-native-web@npm:^0.18.9":
+"react-native-web@npm:0.18.12":
version: 0.18.12
resolution: "react-native-web@npm:0.18.12"
dependencies:
@@ -19029,7 +19031,7 @@ __metadata:
languageName: node
linkType: hard
-"react-refresh@npm:^0.14.0":
+"react-refresh@npm:0.14.0":
version: 0.14.0
resolution: "react-refresh@npm:0.14.0"
checksum: dc69fa8c993df512f42dd0f1b604978ae89bd747c0ed5ec595c0cc50d535fb2696619ccd98ae28775cc01d0a7c146a532f0f7fb81dc22e1977c242a4912312f4
@@ -19889,8 +19891,10 @@ __metadata:
app: "*"
react: ^18.2.0
react-dom: ^18.2.0
+ react-native: ^0.71.6
+ react-native-web: 0.18.12
storybook: ^7.0.5
- typescript: 5.0.3
+ typescript: 5.0.4
languageName: unknown
linkType: soft
@@ -20972,7 +20976,7 @@ __metadata:
eslint: ^8.21.0
prettier: ^2.7.1
turbo: ^1.8.8
- typescript: ^5.0.3
+ typescript: ^5.0.4
languageName: unknown
linkType: soft
@@ -21250,7 +21254,7 @@ __metadata:
babel-jest: ^28.1.3
jest: ^28.1.3
jest-expo: ^46.0.1
- typescript: ^5.0.3
+ typescript: ^5.0.4
languageName: unknown
linkType: soft
@@ -21745,17 +21749,7 @@ __metadata:
languageName: node
linkType: hard
-"typescript@npm:5.0.3":
- version: 5.0.3
- resolution: "typescript@npm:5.0.3"
- bin:
- tsc: bin/tsc
- tsserver: bin/tsserver
- checksum: 3cce0576d218cb4277ff8b6adfef1a706e9114a98b4261a38ad658a7642f1b274a8396394f6cbff8c0ba852996d7ed2e233e9b8431d5d55ac7c2f6fea645af02
- languageName: node
- linkType: hard
-
-"typescript@npm:^5.0.3, typescript@npm:^5.0.4":
+"typescript@npm:5.0.4":
version: 5.0.4
resolution: "typescript@npm:5.0.4"
bin:
@@ -21765,17 +21759,7 @@ __metadata:
languageName: node
linkType: hard
-"typescript@patch:typescript@5.0.3#~builtin":
- version: 5.0.3
- resolution: "typescript@patch:typescript@npm%3A5.0.3#~builtin::version=5.0.3&hash=85af82"
- bin:
- tsc: bin/tsc
- tsserver: bin/tsserver
- checksum: 5580367025ff7ee1f2a61e5affdbddccfe6e893bc662aa33fefdbf12de7e493173fa7d47475e9e15121828691004c4ed13bcd115e57866baed97b54c60954e1c
- languageName: node
- linkType: hard
-
-"typescript@patch:typescript@^5.0.3#~builtin, typescript@patch:typescript@^5.0.4#~builtin":
+"typescript@patch:typescript@npm%3A5.0.4#~builtin":
version: 5.0.4
resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=85af82"
bin: