Add moduleSuffixes to tsconfig (#11146)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-07-16 22:47:53 +03:00
committed by GitHub
parent a8b963b357
commit 007c21fa8e
82 changed files with 628 additions and 201 deletions
+2 -1
View File
@@ -21,7 +21,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
job: [lint, prettier, typecheck] job:
[lint, prettier, 'typecheck:ios', 'typecheck:android', 'typecheck:web']
steps: steps:
- name: Check out Git repository - name: Check out Git repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
@@ -1,5 +1,14 @@
import {Component} from 'react'
import {type BottomSheetViewProps} from './BottomSheet.types' import {type BottomSheetViewProps} from './BottomSheet.types'
export function BottomSheetNativeComponent(_: BottomSheetViewProps) { export class BottomSheetNativeComponent extends Component<BottomSheetViewProps> {
throw new Error('BottomSheetNativeComponent is not available on web') /*
* Native sheets do not exist on web; there is nothing to dismiss.
*/
static dismissAll = async () => {}
render(): never {
throw new Error('BottomSheetNativeComponent is not available on web')
}
} }
@@ -6,7 +6,15 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
throw new NotImplementedError() throw new NotImplementedError()
} }
export function getReferrerInfo(): ReferrerInfo | null { /*
* Promise-returning for parity with Android, whose native referrer API only
* exposes a promise.
*/
export function getReferrerInfo(): Promise<ReferrerInfo | null> {
return Promise.resolve(getReferrerInfoSync())
}
function getReferrerInfoSync(): ReferrerInfo | null {
const referrer = SharedPrefs.getString('referrer') const referrer = SharedPrefs.getString('referrer')
if (referrer) { if (referrer) {
SharedPrefs.removeValue('referrer') SharedPrefs.removeValue('referrer')
@@ -5,6 +5,6 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
throw new NotImplementedError() throw new NotImplementedError()
} }
export function getReferrerInfo(): ReferrerInfo | null { export function getReferrerInfo(): Promise<ReferrerInfo | null> {
throw new NotImplementedError() throw new NotImplementedError()
} }
@@ -7,7 +7,15 @@ export function getGooglePlayReferrerInfoAsync(): Promise<GooglePlayReferrerInfo
throw new NotImplementedError() throw new NotImplementedError()
} }
export function getReferrerInfo(): ReferrerInfo | null { /*
* Promise-returning for parity with Android, whose native referrer API only
* exposes a promise.
*/
export function getReferrerInfo(): Promise<ReferrerInfo | null> {
return Promise.resolve(getReferrerInfoSync())
}
function getReferrerInfoSync(): ReferrerInfo | null {
if ( if (
Platform.OS === 'web' && Platform.OS === 'web' &&
// for ssr // for ssr
+4 -1
View File
@@ -62,7 +62,10 @@
"lint": "oxlint --quiet src modules", "lint": "oxlint --quiet src modules",
"lint-native": "swiftlint ./modules && ktlint ./modules", "lint-native": "swiftlint ./modules && ktlint ./modules",
"lint-native:fix": "swiftlint --fix ./modules && ktlint --format ./modules", "lint-native:fix": "swiftlint --fix ./modules && ktlint --format ./modules",
"typecheck": "tsgo --project ./tsconfig.check.json", "typecheck": "pnpm run typecheck:ios && pnpm run typecheck:android && pnpm run typecheck:web",
"typecheck:ios": "tsgo --project ./tsconfig.check.ios.json",
"typecheck:android": "tsgo --project ./tsconfig.check.android.json",
"typecheck:web": "tsgo --project ./tsconfig.check.web.json",
"e2e:mock-server": "cd dev-env && pnpm start", "e2e:mock-server": "cd dev-env && pnpm start",
"e2e:build": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios", "e2e:build": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:ios",
"e2e:build-android": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:android", "e2e:build-android": "EXPO_PUBLIC_ENV=e2e NODE_ENV=test RN_SRC_EXT=e2e.ts,e2e.tsx expo run:android",
+12
View File
@@ -55,3 +55,15 @@ index 06829bd00dbded262e1871aaf6db3ae0cfa9d1b1..1b158185a6d7e907aa18ddc806902fcc
invalidate(); invalidate();
} }
diff --git a/lib/typescript/ReactNativeSVG.web.d.ts b/lib/typescript/ReactNativeSVG.web.d.ts
deleted file mode 100644
index e2001975fa97398fb159d2f85f45d067200f575b..0000000000000000000000000000000000000000
diff --git a/lib/typescript/ReactNativeSVG.web.d.ts.map b/lib/typescript/ReactNativeSVG.web.d.ts.map
deleted file mode 100644
index c81af4416af5ee3eaca77b51bfc2952b30d49c8a..0000000000000000000000000000000000000000
diff --git a/lib/typescript/elements.web.d.ts b/lib/typescript/elements.web.d.ts
deleted file mode 100644
index cf4083fbf749b2b002fb649d80b33ac74763847b..0000000000000000000000000000000000000000
diff --git a/lib/typescript/elements.web.d.ts.map b/lib/typescript/elements.web.d.ts.map
deleted file mode 100644
index 29602aa47ad903bc7aaa111462a61dd862c4476d..0000000000000000000000000000000000000000
+12 -12
View File
@@ -231,7 +231,7 @@ patchedDependencies:
react-native-keyboard-controller@1.21.8: ac52bf7502ff3ad34a8594b5e1a916b96bf87a2523b6abc87c31f03607d52271 react-native-keyboard-controller@1.21.8: ac52bf7502ff3ad34a8594b5e1a916b96bf87a2523b6abc87c31f03607d52271
react-native-pager-view@6.8.0: 0979d6fe1e2fa43b2784cc0b5e0ff0117d53b53423e85ee5855eefdc41a00108 react-native-pager-view@6.8.0: 0979d6fe1e2fa43b2784cc0b5e0ff0117d53b53423e85ee5855eefdc41a00108
react-native-reanimated@3.19.1: 97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6 react-native-reanimated@3.19.1: 97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6
react-native-svg@15.12.1: 31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9 react-native-svg@15.12.1: ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310
react-native-uitextview@1.4.0: 62de26caadfc39d1bdff204cdc03a705c0cd343999825e06d8c0c120de06cc99 react-native-uitextview@1.4.0: 62de26caadfc39d1bdff204cdc03a705c0cd343999825e06d8c0c120de06cc99
react-native-view-shot@4.0.3: a2457dc30a82cc8c21f371a6f860d9396d450a2a1b4265b1a4ee13bdb24d3268 react-native-view-shot@4.0.3: a2457dc30a82cc8c21f371a6f860d9396d450a2a1b4265b1a4ee13bdb24d3268
react-native@0.81.5: 2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194 react-native@0.81.5: 2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194
@@ -642,10 +642,10 @@ importers:
version: 6.8.0(patch_hash=0979d6fe1e2fa43b2784cc0b5e0ff0117d53b53423e85ee5855eefdc41a00108)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) version: 6.8.0(patch_hash=0979d6fe1e2fa43b2784cc0b5e0ff0117d53b53423e85ee5855eefdc41a00108)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-progress: react-native-progress:
specifier: bluesky-social/react-native-progress specifier: bluesky-social/react-native-progress
version: https://codeload.github.com/bluesky-social/react-native-progress/tar.gz/5a372f4f2ce5feb26f4f47b6a4d187ab9b923ab4(react-native-svg@15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)) version: https://codeload.github.com/bluesky-social/react-native-progress/tar.gz/5a372f4f2ce5feb26f4f47b6a4d187ab9b923ab4(react-native-svg@15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))
react-native-qrcode-styled: react-native-qrcode-styled:
specifier: ^0.3.3 specifier: ^0.3.3
version: 0.3.3(react-native-svg@15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) version: 0.3.3(react-native-svg@15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-reanimated: react-native-reanimated:
specifier: 3.19.1 specifier: 3.19.1
version: 3.19.1(patch_hash=97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6)(@babel/core@7.29.0)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) version: 3.19.1(patch_hash=97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6)(@babel/core@7.29.0)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
@@ -657,7 +657,7 @@ importers:
version: 4.24.0(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) version: 4.24.0(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-svg: react-native-svg:
specifier: 15.12.1 specifier: 15.12.1
version: 15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) version: 15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-uitextview: react-native-uitextview:
specifier: ^1.4.0 specifier: ^1.4.0
version: 1.4.0(patch_hash=62de26caadfc39d1bdff204cdc03a705c0cd343999825e06d8c0c120de06cc99)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) version: 1.4.0(patch_hash=62de26caadfc39d1bdff204cdc03a705c0cd343999825e06d8c0c120de06cc99)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
@@ -696,7 +696,7 @@ importers:
version: 2.0.7(react-dom@19.1.0(react@19.1.0))(react@19.1.0) version: 2.0.7(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
sonner-native: sonner-native:
specifier: 0.21.0 specifier: 0.21.0
version: 0.21.0(patch_hash=4bcd0da0fec32e943460e6e788a9e4adf601b507d2dfd0c8246a6c8c74d8f638)(4e42d15c94c2c56af69d343a007eb893) version: 0.21.0(patch_hash=4bcd0da0fec32e943460e6e788a9e4adf601b507d2dfd0c8246a6c8c74d8f638)(0ed429160839218d22ac63d892397351)
tippy.js: tippy.js:
specifier: ^6.3.7 specifier: ^6.3.7
version: 6.3.7 version: 6.3.7
@@ -17082,18 +17082,18 @@ snapshots:
react: 19.1.0 react: 19.1.0
react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0) react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0)
react-native-progress@https://codeload.github.com/bluesky-social/react-native-progress/tar.gz/5a372f4f2ce5feb26f4f47b6a4d187ab9b923ab4(react-native-svg@15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)): react-native-progress@https://codeload.github.com/bluesky-social/react-native-progress/tar.gz/5a372f4f2ce5feb26f4f47b6a4d187ab9b923ab4(react-native-svg@15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)):
dependencies: dependencies:
prop-types: 15.8.1 prop-types: 15.8.1
react-native-svg: 15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-svg: 15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-qrcode-styled@0.3.3(react-native-svg@15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0): react-native-qrcode-styled@0.3.3(react-native-svg@15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0))(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
dependencies: dependencies:
qrcode: 1.5.4 qrcode: 1.5.4
react: 19.1.0 react: 19.1.0
react-fast-compare: 3.2.2 react-fast-compare: 3.2.2
react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0) react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0)
react-native-svg: 15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-svg: 15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-reanimated@3.19.1(patch_hash=97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6)(@babel/core@7.29.0)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0): react-native-reanimated@3.19.1(patch_hash=97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6)(@babel/core@7.29.0)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
dependencies: dependencies:
@@ -17127,7 +17127,7 @@ snapshots:
react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0) react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0)
warn-once: 0.1.1 warn-once: 0.1.1
react-native-svg@15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0): react-native-svg@15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0):
dependencies: dependencies:
css-select: 5.2.2 css-select: 5.2.2
css-tree: 1.1.3 css-tree: 1.1.3
@@ -17677,7 +17677,7 @@ snapshots:
uuid: 8.3.2 uuid: 8.3.2
websocket-driver: 0.7.4 websocket-driver: 0.7.4
sonner-native@0.21.0(patch_hash=4bcd0da0fec32e943460e6e788a9e4adf601b507d2dfd0c8246a6c8c74d8f638)(4e42d15c94c2c56af69d343a007eb893): sonner-native@0.21.0(patch_hash=4bcd0da0fec32e943460e6e788a9e4adf601b507d2dfd0c8246a6c8c74d8f638)(0ed429160839218d22ac63d892397351):
dependencies: dependencies:
react: 19.1.0 react: 19.1.0
react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0) react-native: 0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0)
@@ -17685,7 +17685,7 @@ snapshots:
react-native-reanimated: 3.19.1(patch_hash=97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6)(@babel/core@7.29.0)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-reanimated: 3.19.1(patch_hash=97a1967f37a4213fbab59e1fd59a1bf859b5efc79af5e1b528a47fe488e6c5d6)(@babel/core@7.29.0)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-safe-area-context: 5.6.2(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-safe-area-context: 5.6.2(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-screens: 4.24.0(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-screens: 4.24.0(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
react-native-svg: 15.12.1(patch_hash=31401fa6ff01498773afb51a7b066821c471eb3e71b0764a10017938beed49e9)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0) react-native-svg: 15.12.1(patch_hash=ae309e9542214f5ae54935e253dedd236765feedac7be343f81d532d7fe09310)(react-native@0.81.5(patch_hash=2656ac6deb71b92a4df4af4593d13ace6a5740936432e5e7e8ef32bc3cd05194)(@babel/core@7.29.0)(@types/react@19.1.17)(react@19.1.0))(react@19.1.0)
sonner@2.0.7(react-dom@19.1.0(react@19.1.0))(react@19.1.0): sonner@2.0.7(react-dom@19.1.0(react@19.1.0))(react@19.1.0):
dependencies: dependencies:
+9 -8
View File
@@ -1003,14 +1003,15 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
}) })
if (IS_WEB) { if (IS_WEB) {
const referrerInfo = Referrer.getReferrerInfo() void Referrer.getReferrerInfo().then(referrerInfo => {
if (referrerInfo && referrerInfo.hostname !== 'bsky.app') { if (referrerInfo && referrerInfo.hostname !== 'bsky.app') {
ax.metric('deepLink:referrerReceived', { ax.metric('deepLink:referrerReceived', {
to: window.location.href, to: window.location.href,
referrer: referrerInfo?.referrer, referrer: referrerInfo?.referrer,
hostname: referrerInfo?.hostname, hostname: referrerInfo?.hostname,
}) })
} }
})
} }
// temp, just testing // temp, just testing
+25 -2
View File
@@ -2,8 +2,9 @@ import {type StyleProp, type ViewStyle} from 'react-native'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import * as Menu from '#/components/Menu' import * as Menu from '#/components/Menu'
import {type TriggerProps as MenuTriggerProps} from '#/components/Menu/types'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {type AuxiliaryViewProps} from './types' import {type AuxiliaryViewProps, type TriggerProps} from './types'
export { export {
ContainerItem, ContainerItem,
@@ -16,7 +17,6 @@ export {
ItemText, ItemText,
LabelText, LabelText,
Root, Root,
Trigger,
useMenuContext as useContextMenuContext, useMenuContext as useContextMenuContext,
useMenuControl as useContextMenuControl, useMenuControl as useContextMenuControl,
} from '#/components/Menu' } from '#/components/Menu'
@@ -30,14 +30,37 @@ export function AuxiliaryView({}: AuxiliaryViewProps) {
return null return null
} }
/*
* On web the context menu is just a Menu; contentLabel, onTap, style, and
* swipeGesture only apply to the native press-and-hold presentation.
*/
export function Trigger({children, label, hint, role}: TriggerProps) {
return (
<Menu.Trigger label={label} hint={hint} role={role}>
{/*
* Menu supplies the same web-arm child props shape as ContextMenu's
* TriggerChildProps; only the native arms of the two unions differ,
* and those never occur here.
*/}
{children as unknown as MenuTriggerProps['children']}
</Menu.Trigger>
)
}
export function Outer({ export function Outer({
children, children,
label, label,
align: _align,
style, style,
onCloseAutoFocus, onCloseAutoFocus,
}: { }: {
children: React.ReactNode children: React.ReactNode
label?: string label?: string
/**
* Native positions the menu against the message bubble explicitly; the web
* dropdown is anchored by radix, so this is accepted only for parity.
*/
align?: 'left' | 'right'
style?: StyleProp<ViewStyle> style?: StyleProp<ViewStyle>
onCloseAutoFocus?: (event: Event) => void onCloseAutoFocus?: (event: Event) => void
}) { }) {
+32 -6
View File
@@ -12,6 +12,7 @@ import {
type GestureResponderEvent, type GestureResponderEvent,
type LayoutChangeEvent, type LayoutChangeEvent,
Pressable, Pressable,
type ScrollView,
type StyleProp, type StyleProp,
View, View,
type ViewStyle, type ViewStyle,
@@ -24,6 +25,7 @@ import {RemoveScrollBar} from 'react-remove-scroll-bar'
import {logger} from '#/logger' import {logger} from '#/logger'
import {useA11y} from '#/state/a11y' import {useA11y} from '#/state/a11y'
import {useDialogStateControlContext} from '#/state/dialogs' import {useDialogStateControlContext} from '#/state/dialogs'
import {type ListMethods} from '#/view/com/util/List'
import {atoms as a, flatten, useBreakpoints, useTheme, web} from '#/alf' import {atoms as a, flatten, useBreakpoints, useTheme, web} from '#/alf'
import {Button, ButtonIcon} from '#/components/Button' import {Button, ButtonIcon} from '#/components/Button'
import {Context} from '#/components/Dialog/context' import {Context} from '#/components/Dialog/context'
@@ -224,11 +226,21 @@ export function Inner({
) )
} }
export const ScrollableInner = Inner /*
* There is no inner ScrollView on web - the ref is accepted for parity with
* the native variant and never attached, so native-only scrolling code in
* shared callers stays a no-op here.
*/
export function ScrollableInner({
ref: _ref,
...props
}: DialogInnerProps & {ref?: React.Ref<ScrollView>}) {
return <Inner {...props} />
}
export const InnerFlatList = forwardRef< export const InnerFlatList = forwardRef<
FlatList, ListMethods,
FlatListProps<any> & {label: string} & { FlatListProps<any> & {label?: string} & {
webInnerStyle?: StyleProp<ViewStyle> webInnerStyle?: StyleProp<ViewStyle>
webInnerContentContainerStyle?: StyleProp<ViewStyle> webInnerContentContainerStyle?: StyleProp<ViewStyle>
footer?: React.ReactNode footer?: React.ReactNode
@@ -247,7 +259,11 @@ export const InnerFlatList = forwardRef<
const {gtMobile} = useBreakpoints() const {gtMobile} = useBreakpoints()
return ( return (
<Inner <Inner
label={label} /*
* Most shared callers cannot pass a label since the native variant has
* no such prop; aria-label is simply absent for them, as before.
*/
label={label as string}
style={[ style={[
a.overflow_hidden, a.overflow_hidden,
a.px_0, a.px_0,
@@ -256,7 +272,13 @@ export const InnerFlatList = forwardRef<
]} ]}
contentContainerStyle={[a.h_full, a.px_0, webInnerContentContainerStyle]}> contentContainerStyle={[a.h_full, a.px_0, webInnerContentContainerStyle]}>
<FlatList <FlatList
ref={ref} /*
* The FlatList instance satisfies the (web) ListMethods interface
* shared callers hold their refs as, except scrollToTop, which no
* platform-agnostic caller can use since the native ListMethods
* (FlatList) lacks it too.
*/
ref={ref as React.Ref<FlatList>}
style={[a.h_full, gtMobile ? a.px_2xl : a.px_xl, style]} style={[a.h_full, gtMobile ? a.px_2xl : a.px_xl, style]}
{...props} {...props}
/> />
@@ -321,7 +343,11 @@ export function Close() {
) )
} }
export function Handle() { /*
* The drag handle only exists on the native bottom sheet; props are accepted
* for parity with the native variant.
*/
export function Handle(_props: {difference?: boolean; fill?: string}) {
return null return null
} }
@@ -1,5 +1,7 @@
import {useState} from 'react' import {useState} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import type Animated from 'react-native-reanimated'
import {type AnimatedRef, type SharedValue} from 'react-native-reanimated'
import {useTheme} from '#/alf' import {useTheme} from '#/alf'
import {DotGrid2x3_Stroke2_Corner0_Rounded as GripIcon} from '#/components/icons/DotGrid' import {DotGrid2x3_Stroke2_Corner0_Rounded as GripIcon} from '#/components/icons/DotGrid'
@@ -18,6 +20,10 @@ interface SortableListProps<T> {
onDragEnd?: () => void onDragEnd?: () => void
/** Fixed row height used for position math. */ /** Fixed row height used for position math. */
itemHeight: number itemHeight: number
/** Ref to the parent Animated.ScrollView for auto-scroll. Ignored on web. */
scrollRef?: AnimatedRef<Animated.ScrollView>
/** Scroll offset shared value from useScrollViewOffset. Ignored on web. */
scrollOffset?: SharedValue<number>
} }
export function SortableList<T>({ export function SortableList<T>({
+2
View File
@@ -32,6 +32,8 @@ import {
import {Portal} from '#/components/Portal' import {Portal} from '#/components/Portal'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
export {type DialogControlProps as MenuControlProps} from '#/components/Dialog'
export {useMenuContext} export {useMenuContext}
export function useMenuControl(): Dialog.DialogControlProps { export function useMenuControl(): Dialog.DialogControlProps {
@@ -1,3 +1,10 @@
export function VideoEmbedInnerWeb() { import {type VideoEmbedInnerWebProps} from './VideoEmbedInnerWeb.shared'
export {
HLSUnsupportedError,
VideoNotFoundError,
} from './VideoEmbedInnerWeb.shared'
export function VideoEmbedInnerWeb(_props: VideoEmbedInnerWebProps): never {
throw new Error('VideoEmbedInnerWeb may not be used on native.') throw new Error('VideoEmbedInnerWeb may not be used on native.')
} }
@@ -0,0 +1,21 @@
import {type AppBskyEmbedVideo} from '@atproto/api'
export type VideoEmbedInnerWebProps = {
embed: AppBskyEmbedVideo.View
active: boolean
setActive: () => void
onScreen: boolean
lastKnownTime: React.RefObject<number | undefined>
}
export class HLSUnsupportedError extends Error {
constructor() {
super('HLS is not supported')
}
}
export class VideoNotFoundError extends Error {
constructor() {
super('Video not found')
}
}
@@ -1,6 +1,5 @@
import {useCallback, useEffect, useId, useRef, useState} from 'react' import {useCallback, useEffect, useId, useRef, useState} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {type AppBskyEmbedVideo} from '@atproto/api'
import {msg} from '@lingui/core/macro' import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import type * as HlsTypes from 'hls.js' import type * as HlsTypes from 'hls.js'
@@ -10,21 +9,25 @@ import {atoms as a} from '#/alf'
import {AltBadgeWithDialog} from '#/components/AltBadgeWithDialog' import {AltBadgeWithDialog} from '#/components/AltBadgeWithDialog'
import {useFullscreen} from '#/components/hooks/useFullscreen' import {useFullscreen} from '#/components/hooks/useFullscreen'
import * as BandwidthEstimate from './bandwidth-estimate' import * as BandwidthEstimate from './bandwidth-estimate'
import {
HLSUnsupportedError,
type VideoEmbedInnerWebProps,
VideoNotFoundError,
} from './VideoEmbedInnerWeb.shared'
import {Controls} from './web-controls/VideoControls' import {Controls} from './web-controls/VideoControls'
export {
HLSUnsupportedError,
VideoNotFoundError,
} from './VideoEmbedInnerWeb.shared'
export function VideoEmbedInnerWeb({ export function VideoEmbedInnerWeb({
embed, embed,
active, active,
setActive, setActive,
onScreen, onScreen,
lastKnownTime, lastKnownTime,
}: { }: VideoEmbedInnerWebProps) {
embed: AppBskyEmbedVideo.View
active: boolean
setActive: () => void
onScreen: boolean
lastKnownTime: React.RefObject<number | undefined>
}) {
const containerRef = useRef<HTMLDivElement>(null) const containerRef = useRef<HTMLDivElement>(null)
const videoRef = useRef<HTMLVideoElement>(null) const videoRef = useRef<HTMLVideoElement>(null)
const [focused, setFocused] = useState(false) const [focused, setFocused] = useState(false)
@@ -104,12 +107,6 @@ export function VideoEmbedInnerWeb({
) )
} }
export class HLSUnsupportedError extends Error {
constructor() {
super('HLS is not supported')
}
}
// Bluesky serves HLS as MPEG-TS with H.264 + AAC. `Hls.isSupported()` is loose // Bluesky serves HLS as MPEG-TS with H.264 + AAC. `Hls.isSupported()` is loose
// (true if MSE supports *any* of {H.264, AV1, VP9} OR *any* of {AAC, FLAC}), // (true if MSE supports *any* of {H.264, AV1, VP9} OR *any* of {AAC, FLAC}),
// so on Linux boxes missing H.264 (e.g. no ubuntu-restricted-extras, sandboxed // so on Linux boxes missing H.264 (e.g. no ubuntu-restricted-extras, sandboxed
@@ -138,12 +135,6 @@ function canPlayBskyVideoCodecs(): boolean {
) )
} }
export class VideoNotFoundError extends Error {
constructor() {
super('Video not found')
}
}
type CachedPromise<T> = Promise<T> & {value: undefined | T} type CachedPromise<T> = Promise<T> & {value: undefined | T}
const promiseForHls = import( const promiseForHls = import(
// @ts-ignore // @ts-ignore
@@ -1,3 +1,5 @@
export function Controls() { import {type ControlsProps} from './VideoControls.shared'
export function Controls(_props: ControlsProps): never {
throw new Error('VideoWebControls may not be used on native.') throw new Error('VideoWebControls may not be used on native.')
} }
@@ -0,0 +1,17 @@
import type Hls from 'hls.js'
export type ControlsProps = {
videoRef: React.RefObject<HTMLVideoElement | null>
hlsRef: React.RefObject<Hls | undefined | null>
active: boolean
setActive: () => void
focused: boolean
setFocused: (focused: boolean) => void
onScreen: boolean
fullscreenRef: React.RefObject<HTMLDivElement | null>
hlsLoading: boolean
hasSubtitleTrack: boolean
isGif: boolean
altText?: string
updateCuePositions: (controlsVisible?: boolean) => void
}
@@ -3,7 +3,6 @@ import {Pressable, View} from 'react-native'
import {msg} from '@lingui/core/macro' import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro'
import type Hls from 'hls.js'
import {clamp} from '#/lib/numbers' import {clamp} from '#/lib/numbers'
import { import {
@@ -33,6 +32,7 @@ import {TimeIndicator} from '../TimeIndicator'
import {ControlButton} from './ControlButton' import {ControlButton} from './ControlButton'
import {Scrubber} from './Scrubber' import {Scrubber} from './Scrubber'
import {formatTime, useVideoElement} from './utils' import {formatTime, useVideoElement} from './utils'
import {type ControlsProps} from './VideoControls.shared'
import {VolumeControl} from './VolumeControl' import {VolumeControl} from './VolumeControl'
export function Controls({ export function Controls({
@@ -49,21 +49,7 @@ export function Controls({
isGif, isGif,
altText, altText,
updateCuePositions, updateCuePositions,
}: { }: ControlsProps) {
videoRef: React.RefObject<HTMLVideoElement | null>
hlsRef: React.RefObject<Hls | undefined | null>
active: boolean
setActive: () => void
focused: boolean
setFocused: (focused: boolean) => void
onScreen: boolean
fullscreenRef: React.RefObject<HTMLDivElement | null>
hlsLoading: boolean
hasSubtitleTrack: boolean
isGif: boolean
altText?: string
updateCuePositions: (controlsVisible?: boolean) => void
}) {
const { const {
play, play,
pause, pause,
@@ -23,7 +23,7 @@ import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
import {Default as ProfileCard} from '#/components/ProfileCard' import {Default as ProfileCard} from '#/components/ProfileCard'
import {IS_NATIVE, IS_WEB} from '#/env' import {IS_NATIVE, IS_WEB} from '#/env'
function keyExtractor(item: AppBskyActorDefs.ProfileViewBasic, index: number) { function keyExtractor(item: AppBskyActorDefs.ProfileView, index: number) {
return `${item.did}-${index}` return `${item.did}-${index}`
} }
@@ -87,7 +87,7 @@ export const ProfilesList = forwardRef<SectionRef, ProfilesListProps>(
const renderItem = ({ const renderItem = ({
item, item,
index, index,
}: ListRenderItemInfo<AppBskyActorDefs.ProfileViewBasic>) => { }: ListRenderItemInfo<AppBskyActorDefs.ProfileView>) => {
return ( return (
<View <View
style={[ style={[
@@ -1,6 +1,5 @@
import {useCallback, useEffect, useImperativeHandle, useState} from 'react' import {useCallback, useEffect, useImperativeHandle, useState} from 'react'
import { import {
findNodeHandle,
type ListRenderItemInfo, type ListRenderItemInfo,
type StyleProp, type StyleProp,
useWindowDimensions, useWindowDimensions,
@@ -26,6 +25,7 @@ import {
type EmptyStateButtonProps, type EmptyStateButtonProps,
} from '#/view/com/util/EmptyState' } from '#/view/com/util/EmptyState'
import {List, type ListRef} from '#/view/com/util/List' import {List, type ListRef} from '#/view/com/util/List'
import {findListNativeTag} from '#/view/com/util/listNativeTag'
import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import {atoms as a, ios, useTheme} from '#/alf' import {atoms as a, ios, useTheme} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
@@ -57,7 +57,7 @@ interface ProfileFeedgensProps {
emptyStateIcon?: React.ComponentType<any> | React.ReactElement emptyStateIcon?: React.ComponentType<any> | React.ReactElement
} }
function keyExtractor(item: AppBskyGraphDefs.StarterPackView) { function keyExtractor(item: AppBskyGraphDefs.StarterPackViewBasic) {
return item.uri return item.uri
} }
@@ -138,13 +138,16 @@ export function ProfileStarterPacks({
useEffect(() => { useEffect(() => {
if (IS_IOS && enabled && scrollElRef.current) { if (IS_IOS && enabled && scrollElRef.current) {
const nativeTag = findNodeHandle(scrollElRef.current) const nativeTag = findListNativeTag(scrollElRef.current)
setScrollViewTag(nativeTag) setScrollViewTag(nativeTag)
} }
}, [enabled, scrollElRef, setScrollViewTag]) }, [enabled, scrollElRef, setScrollViewTag])
const renderItem = useCallback( const renderItem = useCallback(
({item, index}: ListRenderItemInfo<AppBskyGraphDefs.StarterPackView>) => { ({
item,
index,
}: ListRenderItemInfo<AppBskyGraphDefs.StarterPackViewBasic>) => {
return ( return (
<View <View
style={[ style={[
+2 -5
View File
@@ -10,6 +10,7 @@ import {useLoggedOutViewControls} from '#/state/shell/logged-out'
import {Logo} from '#/view/icons/Logo' import {Logo} from '#/view/icons/Logo'
import {atoms as a, flatten, useBreakpoints, web} from '#/alf' import {atoms as a, flatten, useBreakpoints, web} from '#/alf'
import {Button, ButtonText} from '#/components/Button' import {Button, ButtonText} from '#/components/Button'
import {type WelcomeModalControl} from '#/components/hooks/useWelcomeModal.shared'
import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times' import {TimesLarge_Stroke2_Corner0_Rounded as XIcon} from '#/components/icons/Times'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {useAnalytics} from '#/analytics' import {useAnalytics} from '#/analytics'
@@ -17,11 +18,7 @@ import {useAnalytics} from '#/analytics'
const welcomeModalBg = require('../../assets/images/welcome-modal-bg.jpg') const welcomeModalBg = require('../../assets/images/welcome-modal-bg.jpg')
interface WelcomeModalProps { interface WelcomeModalProps {
control: { control: WelcomeModalControl
isOpen: boolean
open: () => void
close: () => void
}
} }
export function WelcomeModal({control}: WelcomeModalProps) { export function WelcomeModal({control}: WelcomeModalProps) {
@@ -1,3 +1,11 @@
export function FindContactsFlow() { import {type Action, type State} from './state'
export function FindContactsFlow(_props: {
state: State
dispatch: React.ActionDispatch<[Action]>
onBack?: () => void
onCancel: () => void
context: 'Onboarding' | 'Standalone'
}): never {
throw new Error('FindContactsFlow is not available on web') throw new Error('FindContactsFlow is not available on web')
} }
@@ -1,3 +1,5 @@
export function useWelcomeModal() { import {type WelcomeModalControl} from './useWelcomeModal.shared'
export function useWelcomeModal(): WelcomeModalControl {
throw new Error('useWelcomeModal is web only') throw new Error('useWelcomeModal is web only')
} }
@@ -0,0 +1,5 @@
export type WelcomeModalControl = {
isOpen: boolean
open: () => void
close: () => void
}
+2 -1
View File
@@ -2,8 +2,9 @@ import {useEffect, useState} from 'react'
import {useSession} from '#/state/session' import {useSession} from '#/state/session'
import {IS_WEB} from '#/env' import {IS_WEB} from '#/env'
import {type WelcomeModalControl} from './useWelcomeModal.shared'
export function useWelcomeModal() { export function useWelcomeModal(): WelcomeModalControl {
const {hasSession} = useSession() const {hasSession} = useSession()
const [isOpen, setIsOpen] = useState(false) const [isOpen, setIsOpen] = useState(false)
@@ -0,0 +1,15 @@
import {type ColorValue} from 'react-native'
export interface GestureAction {
color: ColorValue
action: () => void
threshold: number
icon: React.ElementType
}
export interface GestureActions {
leftFirst?: GestureAction
leftSecond?: GestureAction
rightFirst?: GestureAction
rightSecond?: GestureAction
}
@@ -16,20 +16,7 @@ import Animated, {
} from 'react-native-reanimated' } from 'react-native-reanimated'
import {useHaptics} from '#/lib/haptics' import {useHaptics} from '#/lib/haptics'
import {type GestureActions} from './GestureActionView.shared'
interface GestureAction {
color: ColorValue
action: () => void
threshold: number
icon: React.ElementType
}
interface GestureActions {
leftFirst?: GestureAction
leftSecond?: GestureAction
rightFirst?: GestureAction
rightSecond?: GestureAction
}
const MAX_WIDTH = Dimensions.get('screen').width const MAX_WIDTH = Dimensions.get('screen').width
const ICON_SIZE = 32 const ICON_SIZE = 32
@@ -1,3 +1,13 @@
export function GestureActionView({children}: {children: React.ReactNode}) { import {type GestureActions} from './GestureActionView.shared'
/*
* Swipe gestures only exist on native; children render as-is on web.
*/
export function GestureActionView({
children,
}: {
children: React.ReactNode
actions: GestureActions
}) {
return children return children
} }
+1 -1
View File
@@ -40,7 +40,7 @@ export function useIntentHandler() {
await WebBrowser.dismissBrowser().catch(() => {}) await WebBrowser.dismissBrowser().catch(() => {})
} }
const referrerInfo = Referrer.getReferrerInfo() const referrerInfo = await Referrer.getReferrerInfo()
if (referrerInfo && referrerInfo.hostname !== 'bsky.app') { if (referrerInfo && referrerInfo.hostname !== 'bsky.app') {
ax.metric('deepLink:referrerReceived', { ax.metric('deepLink:referrerReceived', {
to: url, to: url,
@@ -8,6 +8,8 @@ export function useNavigationTabState() {
return { return {
isAtHome: currentRoute === 'Home', isAtHome: currentRoute === 'Home',
isAtSearch: currentRoute === 'Search', isAtSearch: currentRoute === 'Search',
isAtFeeds: currentRoute === 'Feeds',
isAtBookmarks: currentRoute === 'Bookmarks',
isAtNotifications: currentRoute === 'Notifications', isAtNotifications: currentRoute === 'Notifications',
isAtMyProfile: currentRoute === 'MyProfile', isAtMyProfile: currentRoute === 'MyProfile',
isAtMessages: currentRoute === 'Messages', isAtMessages: currentRoute === 'Messages',
+1 -1
View File
@@ -1,7 +1,7 @@
export function useOTAUpdates() {} export function useOTAUpdates() {}
export function useApplyPullRequestOTAUpdate() { export function useApplyPullRequestOTAUpdate() {
return { return {
tryApplyUpdate: () => {}, tryApplyUpdate: async (_channel: string) => {},
revertToEmbedded: () => {}, revertToEmbedded: () => {},
isCurrentlyRunningPullRequestDeployment: false, isCurrentlyRunningPullRequestDeployment: false,
currentChannel: 'web-build', currentChannel: 'web-build',
+1 -1
View File
@@ -4,7 +4,7 @@ export function Provider({children}: {children: React.ReactNode}) {
return children return children
} }
const noop = () => {} const noop = (_scope: string) => {}
export function useHotkeysContext() { export function useHotkeysContext() {
return useMemo( return useMemo(
+6 -2
View File
@@ -168,10 +168,14 @@ function createResizedImage(
export async function saveBytesToDisk( export async function saveBytesToDisk(
filename: string, filename: string,
bytes: Uint8Array<ArrayBuffer>, bytes: Uint8Array,
type: string, type: string,
) { ) {
const blob = new Blob([bytes], {type}) /*
* Bytes handed to us are never SharedArrayBuffer-backed, but the broader
* Uint8Array parameter type matches the native variant.
*/
const blob = new Blob([bytes as Uint8Array<ArrayBuffer>], {type})
const url = URL.createObjectURL(blob) const url = URL.createObjectURL(blob)
downloadUrl(url, filename) downloadUrl(url, filename)
// Firefox requires a small delay // Firefox requires a small delay
+4 -2
View File
@@ -1,11 +1,13 @@
import {type ImagePickerOptions} from 'expo-image-picker'
import {type OpenCropperOptions} from '@bsky.app/expo-image-crop-tool' import {type OpenCropperOptions} from '@bsky.app/expo-image-crop-tool'
import {type PickerImage} from './picker.shared' import {type PickerImage} from './picker.shared'
import {type CameraOpts} from './types'
export {openPicker, openUnifiedPicker} from './picker.shared' export {openPicker, openUnifiedPicker} from './picker.shared'
export async function openCamera(_opts: CameraOpts): Promise<PickerImage> { export async function openCamera(
_opts: ImagePickerOptions,
): Promise<PickerImage> {
throw new Error('openCamera is not supported on web') throw new Error('openCamera is not supported on web')
} }
-7
View File
@@ -8,10 +8,3 @@ export interface PickerOpts {
multiple?: boolean multiple?: boolean
maxFiles?: number maxFiles?: number
} }
export interface CameraOpts {
width: number
height: number
freeStyleCropEnabled?: boolean
cropperCircleOverlay?: boolean
}
+13
View File
@@ -0,0 +1,13 @@
/*
* Used ONLY by the Android typecheck pass (tsconfig.check.android.json) - it
* is excluded from the other passes and has no runtime effect.
*
* react-native-device-attest's Android variant implements only the Play
* Integrity statics, so the iOS-only getDeviceCheckToken (whose app call
* site is IS_IOS-guarded) fails to resolve under .android module suffixes.
* Pin the module to its platform-neutral base class, which declares the
* full API surface.
*/
declare module 'react-native-device-attest' {
export {DeviceAttestBase as default} from 'react-native-device-attest/build/DeviceAttestBase'
}
+102
View File
@@ -0,0 +1,102 @@
/*
* Used ONLY by the web typecheck pass (tsconfig.check.web.json) - it is
* excluded from the other passes and has no runtime effect.
*
* Some packages publish .web.d.ts declarations that diverge from the API
* the app is written against (or, worse, raw TypeScript sources that break
* under `moduleSuffixes: [".web", ""]`), so this pins them to their native
* declarations. react-native-svg has the same problem, handled by deleting
* its divergent web declarations in patches/react-native-svg@15.12.1.patch
* so resolution falls through to the native ones.
*/
/*
* Side-effect CSS imports in .web files are handled by the bundler.
*/
declare module '*.css'
/*
* expo-file-system's declarations build File/Directory on top of
* `./ExpoFileSystem`, which remaps to a web shim whose classes are empty.
* The fully-typed base classes live in ExpoFileSystem.types (no .web
* sibling), so mirror the FileSystem.d.ts wrapper classes on top of those.
*/
declare module 'expo-file-system' {
import {
Directory as ExpoFileSystemDirectory,
File as ExpoFileSystemFile,
} from 'expo-file-system/build/ExpoFileSystem.types'
export {
type DirectoryCreateOptions,
type DirectoryInfo,
type DownloadOptions,
EncodingType,
type FileCreateOptions,
FileHandle,
type FileInfo,
type FileWriteOptions,
type InfoOptions,
type PathInfo,
} from 'expo-file-system/build/ExpoFileSystem.types'
import {type PathInfo as ExpoPathInfo} from 'expo-file-system/build/ExpoFileSystem.types'
import {PathUtilities} from 'expo-file-system/build/pathUtilities'
export class Paths extends PathUtilities {
static get cache(): Directory
static get bundle(): Directory
static get document(): Directory
static get appleSharedContainers(): Record<string, Directory>
static get totalDiskSpace(): number
static get availableDiskSpace(): number
static info(...uris: string[]): ExpoPathInfo
}
export class File extends ExpoFileSystemFile implements Blob {
constructor(...uris: (string | File | Directory)[])
get parentDirectory(): Directory
get extension(): string
get name(): string
readableStream(): ReadableStream<Uint8Array<ArrayBuffer>>
writableStream(): WritableStream<Uint8Array<ArrayBufferLike>>
arrayBuffer(): Promise<ArrayBuffer>
stream(): ReadableStream<Uint8Array<ArrayBuffer>>
slice(start?: number, end?: number, contentType?: string): Blob
}
export class Directory extends ExpoFileSystemDirectory {
constructor(...uris: (string | File | Directory)[])
get parentDirectory(): Directory
list(): (Directory | File)[]
get name(): string
createFile(name: string, mimeType: string | null): File
createDirectory(name: string): Directory
}
}
/*
* expo-image-manipulator's web declarations export the module class where
* the native ones export an instance, hiding instance methods such as
* `manipulate` from `typeof ImageManipulator`. Mirror the native surface.
*/
declare module 'expo-image-manipulator' {
import {type ImageManipulator as ImageManipulatorModule} from 'expo-image-manipulator/build/ImageManipulator.types'
export const ImageManipulator: ImageManipulatorModule
export {
manipulateAsync,
useImageManipulator,
} from 'expo-image-manipulator/build/ImageManipulator'
export {
type Action,
type ActionCrop,
type ActionExtent,
type ActionFlip,
type ActionResize,
type ActionRotate,
FlipType,
type ImageResult,
SaveFormat,
type SaveOptions,
} from 'expo-image-manipulator/build/ImageManipulator.types'
export {type ImageManipulatorContext} from 'expo-image-manipulator/build/ImageManipulatorContext'
export {type ImageRef} from 'expo-image-manipulator/build/ImageRef'
}
+1 -2
View File
@@ -1,6 +1,5 @@
import {useCallback, useEffect, useMemo, useRef, useState} from 'react' import {useCallback, useEffect, useMemo, useRef, useState} from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {useAnimatedRef} from 'react-native-reanimated'
import {type ChatBskyActorGetStatus, type ChatBskyConvoDefs} from '@atproto/api' import {type ChatBskyActorGetStatus, type ChatBskyConvoDefs} from '@atproto/api'
import {Trans, useLingui} from '@lingui/react/macro' import {Trans, useLingui} from '@lingui/react/macro'
import { import {
@@ -275,7 +274,7 @@ export function ChatList({
const t = useTheme() const t = useTheme()
const {t: l} = useLingui() const {t: l} = useLingui()
const aa = useAgeAssurance() const aa = useAgeAssurance()
const scrollElRef: ListRef = useAnimatedRef() const scrollElRef: ListRef = useRef(null)
const {isWithinSplitView} = useIsWithinSplitView() const {isWithinSplitView} = useIsWithinSplitView()
const openChatControl = useCallback(() => { const openChatControl = useCallback(() => {
@@ -17,7 +17,6 @@ import Animated, {
runOnJS, runOnJS,
type ScrollEvent, type ScrollEvent,
type SharedValue, type SharedValue,
useAnimatedRef,
useAnimatedStyle, useAnimatedStyle,
useDerivedValue, useDerivedValue,
useSharedValue, useSharedValue,
@@ -154,7 +153,7 @@ export function MessagesList({
const t = useTheme() const t = useTheme()
const textInputId = 'chat-input-' + useId() const textInputId = 'chat-input-' + useId()
const flatListRef = useAnimatedRef<ListMethods>() const flatListRef = useRef<ListMethods | null>(null)
const [expandedGroups, setExpandedGroups] = useState<Set<string>>( const [expandedGroups, setExpandedGroups] = useState<Set<string>>(
() => new Set(), () => new Set(),
@@ -1,3 +1,8 @@
export function StepFindContacts() { import {type Action, type State} from '#/components/contacts/state'
export function StepFindContacts(_props: {
flowState: State
flowDispatch: React.ActionDispatch<[Action]>
}): never {
throw new Error('StepFindContacts is not available on web') throw new Error('StepFindContacts is not available on web')
} }
@@ -1,3 +1,3 @@
export function StepFindContactsIntro() { export function StepFindContactsIntro(): never {
throw new Error('StepFindContactsIntro is not available on web') throw new Error('StepFindContactsIntro is not available on web')
} }
@@ -4,6 +4,16 @@ import {useLingui} from '@lingui/react'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
export type ValuePropositionPagerProps = {
step: 0 | 1 | 2
/**
* Only the native pager changes pages itself (by swiping); the web pager
* is driven entirely by the step prop.
*/
setStep: (step: 0 | 1 | 2) => void
avatarUri?: string
}
export function useValuePropText(step: 0 | 1 | 2) { export function useValuePropText(step: 0 | 1 | 2) {
const {_} = useLingui() const {_} = useLingui()
@@ -8,17 +8,17 @@ import {useLingui} from '@lingui/react'
import {atoms as a, tokens, useTheme} from '#/alf' import {atoms as a, tokens, useTheme} from '#/alf'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {PROP_1, PROP_2, PROP_3} from './images' import {PROP_1, PROP_2, PROP_3} from './images'
import {Dot, useValuePropText} from './ValuePropositionPager.shared' import {
Dot,
useValuePropText,
type ValuePropositionPagerProps,
} from './ValuePropositionPager.shared'
export function ValuePropositionPager({ export function ValuePropositionPager({
step, step,
setStep, setStep,
avatarUri, avatarUri,
}: { }: ValuePropositionPagerProps) {
step: 0 | 1 | 2
setStep: (step: 0 | 1 | 2) => void
avatarUri?: string
}) {
const t = useTheme() const t = useTheme()
const [activePage, setActivePage] = useState(step) const [activePage, setActivePage] = useState(step)
const ref = useRef<PagerView>(null) const ref = useRef<PagerView>(null)
@@ -6,15 +6,16 @@ import {useLingui} from '@lingui/react'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
import {PROP_1, PROP_2, PROP_3} from './images' import {PROP_1, PROP_2, PROP_3} from './images'
import {Dot, useValuePropText} from './ValuePropositionPager.shared' import {
Dot,
useValuePropText,
type ValuePropositionPagerProps,
} from './ValuePropositionPager.shared'
export function ValuePropositionPager({ export function ValuePropositionPager({
step, step,
avatarUri, avatarUri,
}: { }: ValuePropositionPagerProps) {
step: 0 | 1 | 2
avatarUri?: string
}) {
const t = useTheme() const t = useTheme()
const {_} = useLingui() const {_} = useLingui()
+1 -1
View File
@@ -34,7 +34,7 @@ function renderItem({
) )
} }
function keyExtractor(item: AppBskyActorDefs.ProfileViewBasic) { function keyExtractor(item: AppBskyActorDefs.ProfileView) {
return item.did return item.did
} }
+3 -2
View File
@@ -1,5 +1,5 @@
import {useCallback, useEffect, useImperativeHandle, useState} from 'react' import {useCallback, useEffect, useImperativeHandle, useState} from 'react'
import {findNodeHandle, View} from 'react-native' import {View} from 'react-native'
import {msg} from '@lingui/core/macro' import {msg} from '@lingui/core/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {Trans} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro'
@@ -17,6 +17,7 @@ import {
type EmptyStateButtonProps, type EmptyStateButtonProps,
} from '#/view/com/util/EmptyState' } from '#/view/com/util/EmptyState'
import {type ListRef} from '#/view/com/util/List' import {type ListRef} from '#/view/com/util/List'
import {findListNativeTag} from '#/view/com/util/listNativeTag'
import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn' import {LoadLatestBtn} from '#/view/com/util/load-latest/LoadLatestBtn'
import {atoms as a, ios, useTheme} from '#/alf' import {atoms as a, ios, useTheme} from '#/alf'
import {EditBig_Stroke1_Corner0_Rounded as EditIcon} from '#/components/icons/EditBig' import {EditBig_Stroke1_Corner0_Rounded as EditIcon} from '#/components/icons/EditBig'
@@ -87,7 +88,7 @@ export function ProfileFeedSection({
useEffect(() => { useEffect(() => {
if (IS_IOS && isFocused && scrollElRef.current) { if (IS_IOS && isFocused && scrollElRef.current) {
const nativeTag = findNodeHandle(scrollElRef.current) const nativeTag = findListNativeTag(scrollElRef.current)
setScrollViewTag(nativeTag) setScrollViewTag(nativeTag)
} }
}, [isFocused, scrollElRef, setScrollViewTag]) }, [isFocused, scrollElRef, setScrollViewTag])
+3 -2
View File
@@ -1,5 +1,5 @@
import {useCallback, useEffect, useImperativeHandle, useMemo} from 'react' import {useCallback, useEffect, useImperativeHandle, useMemo} from 'react'
import {findNodeHandle, type ListRenderItemInfo, View} from 'react-native' import {type ListRenderItemInfo, View} from 'react-native'
import { import {
type AppBskyLabelerDefs, type AppBskyLabelerDefs,
type InterpretedLabelValueDefinition, type InterpretedLabelValueDefinition,
@@ -12,6 +12,7 @@ import {Trans} from '@lingui/react/macro'
import {isLabelerSubscribed, lookupLabelValueDefinition} from '#/lib/moderation' import {isLabelerSubscribed, lookupLabelValueDefinition} from '#/lib/moderation'
import {List, type ListRef} from '#/view/com/util/List' import {List, type ListRef} from '#/view/com/util/List'
import {findListNativeTag} from '#/view/com/util/listNativeTag'
import {atoms as a, ios, tokens, useTheme} from '#/alf' import {atoms as a, ios, tokens, useTheme} from '#/alf'
import {Divider} from '#/components/Divider' import {Divider} from '#/components/Divider'
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo' import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
@@ -61,7 +62,7 @@ export function ProfileLabelsSection({
useEffect(() => { useEffect(() => {
if (IS_IOS && isFocused && scrollElRef.current) { if (IS_IOS && isFocused && scrollElRef.current) {
const nativeTag = findNodeHandle(scrollElRef.current) const nativeTag = findListNativeTag(scrollElRef.current)
setScrollViewTag(nativeTag) setScrollViewTag(nativeTag)
} }
}, [isFocused, scrollElRef, setScrollViewTag]) }, [isFocused, scrollElRef, setScrollViewTag])
+1 -1
View File
@@ -1169,7 +1169,7 @@ export function Explore({
) )
} }
function keyExtractor(item: FeedPreviewItem) { function keyExtractor(item: ExploreScreenItems) {
return item.key return item.key
} }
@@ -1 +1,3 @@
export function SettingsListItem() {} export function SettingsListItem() {
return null
}
@@ -1,3 +1,3 @@
export function AppIconSettingsScreen() { export function AppIconSettingsScreen(): never {
throw new Error('Not supported on web') throw new Error('Not supported on web')
} }
@@ -0,0 +1,10 @@
import {type SignupState} from '#/screens/Signup/state'
export type CaptchaWebViewProps = {
url: string
stateParam: string
state?: SignupState
onComplete: () => void
onSuccess: (code: string) => void
onError: (error: unknown) => void
}
@@ -2,7 +2,7 @@ import {useEffect, useMemo, useRef} from 'react'
import {WebView, type WebViewNavigation} from 'react-native-webview' import {WebView, type WebViewNavigation} from 'react-native-webview'
import {type ShouldStartLoadRequest} from 'react-native-webview/lib/WebViewTypes' import {type ShouldStartLoadRequest} from 'react-native-webview/lib/WebViewTypes'
import {type SignupState} from '#/screens/Signup/state' import {type CaptchaWebViewProps} from './CaptchaWebView.shared'
const ALLOWED_HOSTS = [ const ALLOWED_HOSTS = [
'bsky.social', 'bsky.social',
@@ -24,14 +24,7 @@ export function CaptchaWebView({
onComplete, onComplete,
onSuccess, onSuccess,
onError, onError,
}: { }: CaptchaWebViewProps) {
url: string
stateParam: string
state?: SignupState
onComplete: () => void
onSuccess: (code: string) => void
onError: (error: unknown) => void
}) {
const startedAt = useRef(Date.now()) const startedAt = useRef(Date.now())
const successTo = useRef<NodeJS.Timeout>(undefined) const successTo = useRef<NodeJS.Timeout>(undefined)
@@ -1,6 +1,8 @@
import {useCallback, useEffect} from 'react' import {useCallback, useEffect} from 'react'
import {StyleSheet} from 'react-native' import {StyleSheet} from 'react-native'
import {type CaptchaWebViewProps} from './CaptchaWebView.shared'
// @ts-ignore web only, we will always redirect to the app on web (CORS) // @ts-ignore web only, we will always redirect to the app on web (CORS)
const REDIRECT_HOST = new URL(window.location.href).host const REDIRECT_HOST = new URL(window.location.href).host
@@ -9,12 +11,7 @@ export function CaptchaWebView({
stateParam, stateParam,
onSuccess, onSuccess,
onError, onError,
}: { }: CaptchaWebViewProps) {
url: string
stateParam: string
onSuccess: (code: string) => void
onError: (error: unknown) => void
}) {
useEffect(() => { useEffect(() => {
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
onError({ onError({
@@ -1,7 +1,7 @@
import {useState} from 'react' import {useState} from 'react'
import {type ListRenderItemInfo, View} from 'react-native' import {type ListRenderItemInfo, View} from 'react-native'
import {KeyboardAwareScrollView} from 'react-native-keyboard-controller' import {KeyboardAwareScrollView} from 'react-native-keyboard-controller'
import {type AppBskyActorDefs, type ModerationOpts} from '@atproto/api' import {type ModerationOpts} from '@atproto/api'
import {Trans} from '@lingui/react/macro' import {Trans} from '@lingui/react/macro'
import {useA11y} from '#/state/a11y' import {useA11y} from '#/state/a11y'
@@ -18,7 +18,7 @@ import {Text} from '#/components/Typography'
import {IS_NATIVE} from '#/env' import {IS_NATIVE} from '#/env'
import type * as bsky from '#/types/bsky' import type * as bsky from '#/types/bsky'
function keyExtractor(item: AppBskyActorDefs.ProfileViewBasic) { function keyExtractor(item: bsky.profile.AnyProfileView) {
return item?.did ?? '' return item?.did ?? ''
} }
@@ -0,0 +1,10 @@
import {type ComposerImage} from '#/state/gallery'
import type * as Dialog from '#/components/Dialog'
export type EditImageDialogProps = {
control: Dialog.DialogOuterProps['control']
image?: ComposerImage
onChange: (next: ComposerImage) => void
aspectRatio?: number
circularCrop?: boolean
}
@@ -1,13 +1,6 @@
import {type ComposerImage} from '#/state/gallery' import {type EditImageDialogProps} from './EditImageDialog.shared'
import type * as Dialog from '#/components/Dialog'
export type EditImageDialogProps = { export type {EditImageDialogProps} from './EditImageDialog.shared'
control: Dialog.DialogOuterProps['control']
image?: ComposerImage
onChange: (next: ComposerImage) => void
aspectRatio?: number
circularCrop?: boolean
}
export const EditImageDialog = ({}: EditImageDialogProps): React.ReactNode => { export const EditImageDialog = ({}: EditImageDialogProps): React.ReactNode => {
return null return null
@@ -16,7 +16,7 @@ import {atoms as a, useTheme} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import * as Dialog from '#/components/Dialog' import * as Dialog from '#/components/Dialog'
import {Loader} from '#/components/Loader' import {Loader} from '#/components/Loader'
import {type EditImageDialogProps} from './EditImageDialog' import {type EditImageDialogProps} from './EditImageDialog.shared'
export function EditImageDialog(props: EditImageDialogProps) { export function EditImageDialog(props: EditImageDialogProps) {
return ( return (
@@ -0,0 +1,6 @@
import {type ComposerImage} from '#/state/gallery'
export type OpenCameraBtnProps = {
disabled?: boolean
onAdd: (next: ComposerImage[]) => void
}
@@ -6,18 +6,14 @@ import {useLingui} from '@lingui/react'
import {useCameraPermission} from '#/lib/hooks/usePermissions' import {useCameraPermission} from '#/lib/hooks/usePermissions'
import {openCamera} from '#/lib/media/picker' import {openCamera} from '#/lib/media/picker'
import {logger} from '#/logger' import {logger} from '#/logger'
import {type ComposerImage, createComposerImage} from '#/state/gallery' import {createComposerImage} from '#/state/gallery'
import {atoms as a, useTheme} from '#/alf' import {atoms as a, useTheme} from '#/alf'
import {Button} from '#/components/Button' import {Button} from '#/components/Button'
import {Camera_Stroke2_Corner0_Rounded as Camera} from '#/components/icons/Camera' import {Camera_Stroke2_Corner0_Rounded as Camera} from '#/components/icons/Camera'
import {IS_NATIVE, IS_WEB_MOBILE} from '#/env' import {IS_NATIVE, IS_WEB_MOBILE} from '#/env'
import {type OpenCameraBtnProps} from './OpenCameraBtn.shared'
type Props = { export function OpenCameraBtn({disabled, onAdd}: OpenCameraBtnProps) {
disabled?: boolean
onAdd: (next: ComposerImage[]) => void
}
export function OpenCameraBtn({disabled, onAdd}: Props) {
const {_} = useLingui() const {_} = useLingui()
const {requestCameraAccessIfNeeded} = useCameraPermission() const {requestCameraAccessIfNeeded} = useCameraPermission()
const [mediaPermissionRes, requestMediaPermission] = const [mediaPermissionRes, requestMediaPermission] =
@@ -1,3 +1,5 @@
export function OpenCameraBtn() { import {type OpenCameraBtnProps} from './OpenCameraBtn.shared'
export function OpenCameraBtn(_props: OpenCameraBtnProps) {
return null return null
} }
@@ -1,3 +1,5 @@
export function SubtitleFilePicker() { import {type SubtitleFilePickerProps} from './SubtitleFilePicker.shared'
export function SubtitleFilePicker(_props: SubtitleFilePickerProps): never {
throw new Error('SubtitleFilePicker is a web-only component') throw new Error('SubtitleFilePicker is a web-only component')
} }
@@ -0,0 +1,4 @@
export type SubtitleFilePickerProps = {
onSelectFile: (file: File) => void
disabled?: boolean
}
@@ -9,14 +9,12 @@ import {atoms as a} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button' import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import {CC_Stroke2_Corner0_Rounded as CCIcon} from '#/components/icons/CC' import {CC_Stroke2_Corner0_Rounded as CCIcon} from '#/components/icons/CC'
import * as Toast from '#/components/Toast' import * as Toast from '#/components/Toast'
import {type SubtitleFilePickerProps} from './SubtitleFilePicker.shared'
export function SubtitleFilePicker({ export function SubtitleFilePicker({
onSelectFile, onSelectFile,
disabled, disabled,
}: { }: SubtitleFilePickerProps) {
onSelectFile: (file: File) => void
disabled?: boolean
}) {
const {_} = useLingui() const {_} = useLingui()
const ref = useRef<HTMLInputElement>(null) const ref = useRef<HTMLInputElement>(null)
@@ -1,6 +1,8 @@
import {type QueryClient} from '@tanstack/react-query'
import {atoms as a, flatten} from '#/alf' import {atoms as a, flatten} from '#/alf'
export function clearThumbnailCache() { export function clearThumbnailCache(_queryClient: QueryClient) {
// no-op on web // no-op on web
} }
+2 -2
View File
@@ -6,7 +6,6 @@ import {
useState, useState,
} from 'react' } from 'react'
import { import {
findNodeHandle,
type ListRenderItemInfo, type ListRenderItemInfo,
type StyleProp, type StyleProp,
useWindowDimensions, useWindowDimensions,
@@ -26,6 +25,7 @@ import {useSession} from '#/state/session'
import {EmptyState} from '#/view/com/util/EmptyState' import {EmptyState} from '#/view/com/util/EmptyState'
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
import {List, type ListRef} from '#/view/com/util/List' import {List, type ListRef} from '#/view/com/util/List'
import {findListNativeTag} from '#/view/com/util/listNativeTag'
import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import {LoadMoreRetryBtn} from '#/view/com/util/LoadMoreRetryBtn' import {LoadMoreRetryBtn} from '#/view/com/util/LoadMoreRetryBtn'
import {atoms as a, ios, useTheme} from '#/alf' import {atoms as a, ios, useTheme} from '#/alf'
@@ -219,7 +219,7 @@ export function ProfileFeedgens({
useEffect(() => { useEffect(() => {
if (IS_IOS && enabled && scrollElRef.current) { if (IS_IOS && enabled && scrollElRef.current) {
const nativeTag = findNodeHandle(scrollElRef.current) const nativeTag = findListNativeTag(scrollElRef.current)
setScrollViewTag(nativeTag) setScrollViewTag(nativeTag)
} }
}, [enabled, scrollElRef, setScrollViewTag]) }, [enabled, scrollElRef, setScrollViewTag])
+2 -2
View File
@@ -6,7 +6,6 @@ import {
useState, useState,
} from 'react' } from 'react'
import { import {
findNodeHandle,
type ListRenderItemInfo, type ListRenderItemInfo,
type StyleProp, type StyleProp,
useWindowDimensions, useWindowDimensions,
@@ -26,6 +25,7 @@ import {useSession} from '#/state/session'
import {EmptyState} from '#/view/com/util/EmptyState' import {EmptyState} from '#/view/com/util/EmptyState'
import {ErrorMessage} from '#/view/com/util/error/ErrorMessage' import {ErrorMessage} from '#/view/com/util/error/ErrorMessage'
import {List, type ListRef} from '#/view/com/util/List' import {List, type ListRef} from '#/view/com/util/List'
import {findListNativeTag} from '#/view/com/util/listNativeTag'
import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder' import {FeedLoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import {LoadMoreRetryBtn} from '#/view/com/util/LoadMoreRetryBtn' import {LoadMoreRetryBtn} from '#/view/com/util/LoadMoreRetryBtn'
import {atoms as a, ios, useTheme} from '#/alf' import {atoms as a, ios, useTheme} from '#/alf'
@@ -218,7 +218,7 @@ export function ProfileLists({
useEffect(() => { useEffect(() => {
if (IS_IOS && enabled && scrollElRef.current) { if (IS_IOS && enabled && scrollElRef.current) {
const nativeTag = findNodeHandle(scrollElRef.current) const nativeTag = findListNativeTag(scrollElRef.current)
setScrollViewTag(nativeTag) setScrollViewTag(nativeTag)
} }
}, [enabled, scrollElRef, setScrollViewTag]) }, [enabled, scrollElRef, setScrollViewTag])
+29 -3
View File
@@ -7,6 +7,7 @@ import {
useState, useState,
} from 'react' } from 'react'
import {View} from 'react-native' import {View} from 'react-native'
import {type SharedValue, useSharedValue} from 'react-native-reanimated'
import {flushSync} from 'react-dom' import {flushSync} from 'react-dom'
import {s} from '#/lib/styles' import {s} from '#/lib/styles'
@@ -19,7 +20,9 @@ export interface PagerRef {
export interface RenderTabBarFnProps { export interface RenderTabBarFnProps {
selectedPage: number selectedPage: number
onSelect?: (index: number) => void onSelect?: (index: number) => void
tabBarAnchor?: JSX.Element tabBarAnchor?: JSX.Element | null | undefined // Ignored on native.
dragProgress: SharedValue<number> // Ignored on web.
dragState: SharedValue<'idle' | 'dragging' | 'settling'> // Ignored on web.
} }
export type RenderTabBarFn = (props: RenderTabBarFnProps) => JSX.Element export type RenderTabBarFn = (props: RenderTabBarFnProps) => JSX.Element
@@ -27,7 +30,17 @@ interface Props {
ref?: React.Ref<PagerRef> ref?: React.Ref<PagerRef>
initialPage?: number initialPage?: number
renderTabBar: RenderTabBarFn renderTabBar: RenderTabBarFn
// tab pressed, yet to scroll to page
onTabPressed?: (index: number) => void
// scroll settled
onPageSelected?: (index: number) => void onPageSelected?: (index: number) => void
/**
* Never fires on web - pages switch instantly, there is no drag gesture.
*/
onPageScrollStateChanged?: (
scrollState: 'idle' | 'dragging' | 'settling',
) => void
testID?: string
} }
export function Pager({ export function Pager({
@@ -35,12 +48,22 @@ export function Pager({
children, children,
initialPage = 0, initialPage = 0,
renderTabBar, renderTabBar,
onTabPressed,
onPageSelected, onPageSelected,
onPageScrollStateChanged: _onPageScrollStateChanged,
testID,
}: React.PropsWithChildren<Props>) { }: React.PropsWithChildren<Props>) {
const [selectedPage, setSelectedPage] = useState(initialPage) const [selectedPage, setSelectedPage] = useState(initialPage)
const scrollYs = useRef<Array<number | null>>([]) const scrollYs = useRef<Array<number | null>>([])
const anchorRef = useRef(null) const anchorRef = useRef(null)
/*
* There is no drag gesture on web; these exist to satisfy the shared
* RenderTabBarFnProps contract and never change.
*/
const dragProgress = useSharedValue(selectedPage)
const dragState = useSharedValue<'idle' | 'dragging' | 'settling'>('idle')
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
setPage: (index: number) => { setPage: (index: number) => {
onTabBarSelect(index) onTabBarSelect(index)
@@ -59,6 +82,7 @@ export function Pager({
: -scrollY // If there's no anchor, treat the top of the page as one. : -scrollY // If there's no anchor, treat the top of the page as one.
const isSticking = anchorTop <= 5 // This would be 0 if browser scrollTo() was reliable. const isSticking = anchorTop <= 5 // This would be 0 if browser scrollTo() was reliable.
onTabPressed?.(index)
if (isSticking) { if (isSticking) {
scrollYs.current[selectedPage] = window.scrollY scrollYs.current[selectedPage] = window.scrollY
} else { } else {
@@ -77,15 +101,17 @@ export function Pager({
} }
} }
}, },
[selectedPage, setSelectedPage, onPageSelected], [selectedPage, setSelectedPage, onPageSelected, onTabPressed],
) )
return ( return (
<View style={s.hContentRegion}> <View testID={testID} style={s.hContentRegion}>
{renderTabBar({ {renderTabBar({
selectedPage, selectedPage,
tabBarAnchor: <View ref={anchorRef} />, tabBarAnchor: <View ref={anchorRef} />,
onSelect: e => onTabBarSelect(e), onSelect: e => onTabBarSelect(e),
dragProgress,
dragState,
})} })}
{Children.map(children, (child, i) => ( {Children.map(children, (child, i) => (
<View <View
+3 -2
View File
@@ -29,11 +29,12 @@ export interface PagerWithHeaderProps {
renderHeader?: ({ renderHeader?: ({
setMinimumHeight, setMinimumHeight,
}: { }: {
setMinimumHeight: () => void setMinimumHeight: (height: number) => void
}) => JSX.Element }) => JSX.Element
initialPage?: number initialPage?: number
onPageSelected?: (index: number) => void onPageSelected?: (index: number) => void
onCurrentPageSelected?: (index: number) => void onCurrentPageSelected?: (index: number) => void
allowHeaderOverScroll?: boolean // Ignored on web.
} }
export const PagerWithHeader = forwardRef<PagerRef, PagerWithHeaderProps>( export const PagerWithHeader = forwardRef<PagerRef, PagerWithHeaderProps>(
function PageWithHeaderImpl( function PageWithHeaderImpl(
@@ -127,7 +128,7 @@ let PagerTabBar = ({
renderHeader?: ({ renderHeader?: ({
setMinimumHeight, setMinimumHeight,
}: { }: {
setMinimumHeight: () => void setMinimumHeight: (height: number) => void
}) => JSX.Element }) => JSX.Element
isHeaderReady: boolean isHeaderReady: boolean
onCurrentPageSelected?: (index: number) => void onCurrentPageSelected?: (index: number) => void
+9
View File
@@ -1,5 +1,6 @@
import {useCallback, useEffect, useRef} from 'react' import {useCallback, useEffect, useRef} from 'react'
import {type ScrollView, StyleSheet, View} from 'react-native' import {type ScrollView, StyleSheet, View} from 'react-native'
import {type SharedValue} from 'react-native-reanimated'
import {atoms as a, useBreakpoints, useTheme, web} from '#/alf' import {atoms as a, useBreakpoints, useTheme, web} from '#/alf'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
@@ -15,6 +16,14 @@ export interface TabBarProps {
onSelect?: (index: number) => void onSelect?: (index: number) => void
onPressSelected?: (index: number) => void onPressSelected?: (index: number) => void
/**
* The drag-following indicator and transparent background only exist in
* the native tab bar - accepted here so shared callers typecheck.
*/
dragProgress?: SharedValue<number> // Ignored on web.
dragState?: SharedValue<'idle' | 'dragging' | 'settling'> // Ignored on web.
transparent?: boolean // Ignored on web.
} }
// How much of the previous/next item we're showing // How much of the previous/next item we're showing
+8 -1
View File
@@ -17,6 +17,7 @@ import {usePostQuotesQuery} from '#/state/queries/post-quotes'
import {useResolveUriQuery} from '#/state/queries/resolve-uri' import {useResolveUriQuery} from '#/state/queries/resolve-uri'
import {Post} from '#/view/com/post/Post' import {Post} from '#/view/com/post/Post'
import {ListFooter, ListMaybePlaceholder} from '#/components/Lists' import {ListFooter, ListMaybePlaceholder} from '#/components/Lists'
import * as bsky from '#/types/bsky'
import {List} from '../util/List' import {List} from '../util/List'
function renderItem({ function renderItem({
@@ -70,7 +71,13 @@ export function PostQuotes({uri}: {uri: string}) {
data?.pages data?.pages
.flatMap(page => .flatMap(page =>
page.posts.map(post => { page.posts.map(post => {
if (!AppBskyFeedPost.isRecord(post.record) || !moderationOpts) { if (
!bsky.dangerousIsType<AppBskyFeedPost.Record>(
post.record,
AppBskyFeedPost.isRecord,
) ||
!moderationOpts
) {
return null return null
} }
const moderation = moderatePost(post, moderationOpts) const moderation = moderatePost(post, moderationOpts)
+1 -1
View File
@@ -28,7 +28,7 @@ function renderItem({
) )
} }
function keyExtractor(item: ActorDefs.ProfileViewBasic) { function keyExtractor(item: ActorDefs.ProfileView) {
return item.did return item.did
} }
+1 -1
View File
@@ -43,7 +43,7 @@ function renderItem({
) )
} }
function keyExtractor(item: ActorDefs.ProfileViewBasic) { function keyExtractor(item: ActorDefs.ProfileView) {
return item.did return item.did
} }
+1 -1
View File
@@ -39,7 +39,7 @@ function renderItem({
) )
} }
function keyExtractor(item: ActorDefs.ProfileViewBasic) { function keyExtractor(item: ActorDefs.ProfileView) {
return item.did return item.did
} }
+14 -5
View File
@@ -28,8 +28,10 @@ import * as Layout from '#/components/Layout'
export type ListMethods = { export type ListMethods = {
scrollToTop: () => void scrollToTop: () => void
scrollToOffset: (options: {animated: boolean; offset: number}) => void // Signature kept compatible with FlatList's scrollToOffset (the native
scrollToEnd: (options?: {animated?: boolean}) => void // ListMethods type) so callers stay platform-agnostic.
scrollToOffset: (options: {animated?: boolean | null; offset: number}) => void
scrollToEnd: (options?: {animated?: boolean | null}) => void
// Signature kept compatible with FlatList's scrollToIndex (the native // Signature kept compatible with FlatList's scrollToIndex (the native
// ListMethods type) so callers stay platform-agnostic. viewOffset is // ListMethods type) so callers stay platform-agnostic. viewOffset is
// accepted for parity but not currently used by the web implementation. // accepted for parity but not currently used by the web implementation.
@@ -40,7 +42,8 @@ export type ListMethods = {
viewPosition?: number viewPosition?: number
}) => void }) => void
} }
export type ListProps<ItemT> = Omit< // eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ListProps<ItemT = any> = Omit<
FlatListProps<ItemT>, FlatListProps<ItemT>,
| 'onScroll' // Use ScrollContext instead. | 'onScroll' // Use ScrollContext instead.
| 'refreshControl' // Pass refreshing and/or onRefresh instead. | 'refreshControl' // Pass refreshing and/or onRefresh instead.
@@ -59,7 +62,7 @@ export type ListProps<ItemT> = Omit<
*/ */
sideBorders?: boolean sideBorders?: boolean
} }
export type ListRef = React.RefObject<View> export type ListRef = React.RefObject<ListMethods | null>
const ON_ITEM_SEEN_WAIT_DURATION = 0.5e3 // when we consider post to be "seen" const ON_ITEM_SEEN_WAIT_DURATION = 0.5e3 // when we consider post to be "seen"
const ON_ITEM_SEEN_INTERSECTION_OPTS = { const ON_ITEM_SEEN_INTERSECTION_OPTS = {
@@ -248,7 +251,13 @@ function ListImpl<ItemT>(
getScrollableNode()?.scrollTo({top: 0}) getScrollableNode()?.scrollTo({top: 0})
}, },
scrollToOffset({animated, offset}: {animated: boolean; offset: number}) { scrollToOffset({
animated,
offset,
}: {
animated?: boolean | null
offset: number
}) {
getScrollableNode()?.scrollTo({ getScrollableNode()?.scrollTo({
left: 0, left: 0,
top: offset, top: offset,
+12
View File
@@ -0,0 +1,12 @@
import {findNodeHandle} from 'react-native'
import {type ListMethods} from './List'
/**
* Returns the native view tag backing a List, for handing to native code
* (e.g. the pager's scrollViewTag). Always null on web.
*/
export function findListNativeTag(list: ListMethods | null): number | null {
if (!list) return null
return findNodeHandle(list)
}
+9
View File
@@ -0,0 +1,9 @@
import {type ListMethods} from './List'
/**
* Returns the native view tag backing a List, for handing to native code
* (e.g. the pager's scrollViewTag). Always null on web.
*/
export function findListNativeTag(_list: ListMethods | null): number | null {
return null
}
+14
View File
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig.check.json",
"compilerOptions": {
/*
* Mirrors Metro's resolution order for platform=android.
*/
"moduleSuffixes": [".android", ".native", ""]
},
/*
* Narrows the base exclude so the *.android-check.d.ts ambient shims
* apply to this pass.
*/
"exclude": ["src/platform/*.web-check.d.ts"]
}
+9
View File
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.check.json",
"compilerOptions": {
/*
* Mirrors Metro's resolution order for platform=ios.
*/
"moduleSuffixes": [".ios", ".native", ""]
}
}
+9 -1
View File
@@ -1,4 +1,12 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"include": ["src", "modules", "app.config.js"] "include": ["src", "modules", "app.config.js"],
/*
* Ambient check shims apply only to the platform pass that includes them
* back (tsconfig.check.android.json, tsconfig.check.web.json).
*/
"exclude": [
"src/platform/*.android-check.d.ts",
"src/platform/*.web-check.d.ts"
]
} }
+24
View File
@@ -0,0 +1,24 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"moduleSuffixes": [".web", ""],
"paths": {
"#/*": ["./src/*"],
"crypto": ["./src/platform/crypto.ts"],
/*
* expo-file-system/legacy resolves to the package's raw TypeScript
* source, whose internals break under .web module suffixes. Point it
* at the compiled declarations, where skipLibCheck applies.
*/
"expo-file-system/legacy": [
"./node_modules/expo-file-system/build/legacy/index.d.ts"
]
}
},
"include": [
"index.web.ts",
"src/**/*.web.ts",
"src/**/*.web.tsx",
"src/platform/*.web-check.d.ts"
]
}
+1
View File
@@ -3,6 +3,7 @@
"compilerOptions": { "compilerOptions": {
"jsx": "react-jsx", "jsx": "react-jsx",
"module": "esnext", "module": "esnext",
"moduleSuffixes": [".ios", ".android", ".native", ""],
"lib": ["dom", "esnext"], "lib": ["dom", "esnext"],
"types": ["node", "jest"], "types": ["node", "jest"],
"paths": { "paths": {