mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
build(mobile): upgrade to Expo SDK 58 and React Native 0.88 (#37935)
* build(mobile): upgrade to Expo SDK 58 and React Native 0.88 Expo 58 drops Zod from @expo/cli, which clears the last Zod 3 advisory (GHSA-mrhx-c7xc-m3w5) in mobile along with its local patch and override. - Expo 55 -> 58, React Native 0.83 -> 0.88, React 19.3, gesture-handler 3, webview 14, reanimated 4.7, worklets 0.13 (SDK 58 bundled versions, pinned below today's batch to respect minimumReleaseAge). - Port the react-native and react-native-webview patches unchanged; drop expo-constants, expo-notifications, @expo/cli, expo-router, zod and query-string patches plus the zod/query-string/xcode>uuid overrides, which upstream fixed or no longer need. - iOS minimum rises to 16.4 (Expo 58 / RN 0.88 requirement). - Migrate to RN 0.88 strict types: instance ref types, NamedStyles, AppState.currentState, list header/footer nulls. - Replace removed runtime APIs: InteractionManager -> idle callback with a macrotask fallback; StyleSheet.absoluteFillObject -> absoluteFill; FileHandle.readBytes -> readBytesSync (it became async). - Resolve react-native/asset-registry for shared assets in Metro and alias the old registry path for react-native-svg in the desktop mobile-web bundle. - Reduce the iOS scene plugin to the reconnect override; Expo 58's template now ships the scene delegate itself. * fix(mobile): bridge react-native-svg web imports and libsodium runtime for RN 0.88 - Share react-native-svg web shims between the mobile-web build and its render checks: map the old asset-registry path to react-native-web's registry and stub the Android-only touch-sound TurboModule. - Patch react-native-libsodium 1.7.0 to read the JSI runtime from the bridge proxy; RN 0.88 removed RCTCxxBridge.runtime. * fix(mobile): use Expo 58's legacy promise resolver for audio permissions * fix(mobile): skip null handles in the RPC recording timer shims for RN 0.88 types * style(mobile): format MobilePRSidebar after rebase * fix(mobile): name RN 0.88 text input refs for declarations; allow queued back in stack render check - Type text input refs with an exported interface so declaration emit can name hook results (RN 0.88 aliases TextInputInstance to an unexported class). - Expo Router 58 drains back() after a commit; check the interrupted push's exit from the frame it starts, bounded to three frames of lag. * chore(mobile): justify the text input handle interface for React Doctor * chore(mobile): use a nameable intersection alias for text input refs * fix(mobile): use sync expo-file-system writes, copies and moves on Expo 58 Expo 58 made File.write/copy/move and FileHandle.writeBytes return promises. Our callers never awaited them, so failures escaped their try/catch and the store's tmp-then-move and PDF writes could race their close or rename. * build(mobile): raise the page bundle budget to 10 MiB for Expo 58 Expo 58 adds about 310 KB to the page: expo-router (+258 KB, now carrying React Navigation, net about +110 KB) and Reanimated 4.7 (+152 KB). Main had 85 KB of headroom left. 10 MiB still stays within the 10 MiB per-asset contract. * fix(mobile): drop the window-metrics seed RN 0.88 removed from Android RN 0.88 no longer holds window metrics: DeviceInfoModule reads the activity's WindowMetrics on demand and setWindowDisplayMetrics is gone, so MainActivity no longer compiled. Layout scale still comes from the screen metrics we reseed. --------- Co-authored-by: Kelvin Amoaba <97001695+AmoabaKelvin@users.noreply.github.com>
This commit is contained in:
@@ -38,19 +38,6 @@
|
||||
"sha256": "c07bb14cec04bc891e1fe529720444cc9729a25117f9aaf24253cfe3132a34fd"
|
||||
}
|
||||
},
|
||||
{
|
||||
"workspace": "mobile",
|
||||
"package": "zod",
|
||||
"version": "3.25.76",
|
||||
"advisory": "GHSA-mrhx-c7xc-m3w5",
|
||||
"owner": "Orca maintainers",
|
||||
"reason": "Expo and Vercel require Zod 3, which has no fixed upstream release. Backport the upper collection-size gate from colinhacks/zod#6652 for the v3 and bundled v4 entrypoints; installed-dependency regression tests cover sync and async parsing. Remove when a fixed Zod 3 release or compatible consumer upgrade is available.",
|
||||
"expires": "2026-11-20",
|
||||
"patch": {
|
||||
"path": "patches/zod@3.25.76.patch",
|
||||
"sha256": "8f57d8e7910df51ec3c40c412b4f8fb3d01fd65e1889c057aae0e4a15483bcec"
|
||||
}
|
||||
},
|
||||
{
|
||||
"workspace": "docs/site",
|
||||
"package": "zod",
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
routePathnameFromKey
|
||||
} from '../../mobile-web-app/mobile-web-app-route-manifest.mjs'
|
||||
import { MOBILE_WEB_PAGE_ROUTES } from './mobile-web-page-routes.mjs'
|
||||
import { reactNativeSvgWebPlugin } from './react-native-svg-web-plugin.mjs'
|
||||
import {
|
||||
ROUTE_ENTRY_NAMESPACE,
|
||||
entryStaticClosure,
|
||||
@@ -235,6 +236,9 @@ export const lucideBarrelPlugin = {
|
||||
}
|
||||
}
|
||||
|
||||
// Render checks bundle components on their own; share the page's module shims so they resolve alike.
|
||||
export const mobileWebRenderCheckPlugins = [lucideBarrelPlugin, reactNativeSvgWebPlugin]
|
||||
|
||||
// react-native-web's own assignment, matched whole so an upgrade that moves it fails the build.
|
||||
const RNW_HAIRLINE_ASSIGNMENT = 'StyleSheet.hairlineWidth = 1;'
|
||||
// Round native hairline upward to 1/64 CSS px: WebKit floors exact 1/3 to 21/64 and paints nothing at 3×; 22/64 minimizes spill across rows.
|
||||
@@ -308,6 +312,7 @@ export function mobileWebAppBuildOptions(
|
||||
anchoredLazyModules
|
||||
),
|
||||
lucideBarrelPlugin,
|
||||
reactNativeSvgWebPlugin,
|
||||
hairlineDevicePixelPlugin
|
||||
],
|
||||
resolveExtensions: [
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const mobileDir = fileURLToPath(new URL('../../../../mobile', import.meta.url))
|
||||
|
||||
// react-native-svg 15.16 reaches two native-only modules from its web build: the asset registry RN 0.88
|
||||
// folded into react-native (react-native-web keeps its own), and an Android touch-sound TurboModule
|
||||
// it requires only when Platform.OS is android. Shared with the render checks so they bundle alike.
|
||||
export const reactNativeSvgWebPlugin = {
|
||||
name: 'react-native-svg-web',
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /^@react-native\/assets-registry\/registry$/ }, () =>
|
||||
build.resolve('react-native-web/dist/modules/AssetRegistry', {
|
||||
kind: 'import-statement',
|
||||
resolveDir: mobileDir
|
||||
})
|
||||
)
|
||||
build.onResolve({ filter: /[\\/]fabric[\\/]NativeSvgSoundModule$/ }, (args) => ({
|
||||
path: args.path,
|
||||
namespace: 'react-native-svg-web-stub'
|
||||
}))
|
||||
build.onLoad({ filter: /.*/, namespace: 'react-native-svg-web-stub' }, () => ({
|
||||
contents: 'export default { playTouchSound() {} };',
|
||||
loader: 'js'
|
||||
}))
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export const MOBILE_WEB_APP_HOST_CATALOG_MAX_BYTES = 384 * 1024
|
||||
|
||||
// Our own fence on the page's code, well inside the phone contract (32 MiB total, 10 MiB per asset in
|
||||
// manifest-contract.ts); it fails the build before the code weighs more than any one asset may.
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES = 9.5 * 1024 * 1024
|
||||
export const MOBILE_WEB_APP_BUNDLE_MAX_TOTAL_BYTES = 10 * 1024 * 1024
|
||||
|
||||
// Only this licensed desktop-identical asset has its own allowance; other fonts (KaTeX's) and code count.
|
||||
export const MOBILE_WEB_APP_TERMINAL_FONT_MAX_BYTES = 1200 * 1024
|
||||
|
||||
@@ -8,7 +8,7 @@ import { fileURLToPath } from 'node:url'
|
||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
||||
import * as esbuild from 'esbuild'
|
||||
import { chromium, webkit } from 'playwright-core'
|
||||
import { lucideBarrelPlugin } from '../../build/mobile-web-app/build-mobile-web-app-bundle.mjs'
|
||||
import { mobileWebRenderCheckPlugins } from '../../build/mobile-web-app/build-mobile-web-app-bundle.mjs'
|
||||
import { mobileWebAppDependenciesPresent } from '../mobile-web-app-bundle-dependencies.mjs'
|
||||
import {
|
||||
createBundleServer,
|
||||
@@ -109,7 +109,7 @@ beforeAll(async () => {
|
||||
jsx: 'automatic',
|
||||
logLevel: 'silent',
|
||||
// Reuse shipped Lucide shim; barrel reexports missing LucideProvider and toolbar otherwise fails linking.
|
||||
plugins: [lucideBarrelPlugin],
|
||||
plugins: mobileWebRenderCheckPlugins,
|
||||
nodePaths: [join(mobileDir, 'node_modules')],
|
||||
alias: { 'react-native': 'react-native-web' },
|
||||
// Prefer web siblings, including .web.jsx/.web.js; native WebView/Fabric SVG paths fail in browser.
|
||||
|
||||
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url'
|
||||
import { afterAll, beforeAll, describe, expect, it } from 'vitest'
|
||||
import * as esbuild from 'esbuild'
|
||||
import { chromium, webkit } from 'playwright-core'
|
||||
import { lucideBarrelPlugin } from '../../build/mobile-web-app/build-mobile-web-app-bundle.mjs'
|
||||
import { mobileWebRenderCheckPlugins } from '../../build/mobile-web-app/build-mobile-web-app-bundle.mjs'
|
||||
import { mobileWebAppDependenciesPresent } from '../mobile-web-app-bundle-dependencies.mjs'
|
||||
import {
|
||||
createBundleServer,
|
||||
@@ -101,7 +101,7 @@ beforeAll(async () => {
|
||||
logLevel: 'silent',
|
||||
nodePaths: [join(mobileDir, 'node_modules')],
|
||||
alias: { 'react-native': 'react-native-web' },
|
||||
plugins: [lucideBarrelPlugin],
|
||||
plugins: mobileWebRenderCheckPlugins,
|
||||
// Resolve web sibling; native WebView becomes text in a browser.
|
||||
resolveExtensions: ['.web.tsx', '.web.ts', '.web.js', '.tsx', '.ts', '.js'],
|
||||
define: { __DEV__: 'false', 'process.env.NODE_ENV': '"production"' }
|
||||
|
||||
@@ -10,7 +10,7 @@ import { chromium, webkit } from 'playwright-core'
|
||||
import {
|
||||
MOBILE_WEB_APP_NATIVE_PARITY_STYLE,
|
||||
MOBILE_WEB_APP_ROOT_RESET,
|
||||
lucideBarrelPlugin
|
||||
mobileWebRenderCheckPlugins
|
||||
} from '../../build/mobile-web-app/build-mobile-web-app-bundle.mjs'
|
||||
import { mobileWebAppDependenciesPresent } from '../mobile-web-app-bundle-dependencies.mjs'
|
||||
import {
|
||||
@@ -200,7 +200,7 @@ beforeAll(async () => {
|
||||
nodePaths: [join(mobileDir, 'node_modules')],
|
||||
alias: { 'react-native': 'react-native-web' },
|
||||
// Match app plugin: barrel reexports LucideProvider absent from its context module.
|
||||
plugins: [lucideBarrelPlugin],
|
||||
plugins: mobileWebRenderCheckPlugins,
|
||||
// Prefer .web.jsx/.web.js or toolbar’s react-native-svg resolves Fabric and fails codegenNativeComponent.
|
||||
resolveExtensions: ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', '.tsx', '.ts', '.jsx', '.js'],
|
||||
// Match app’s RN shims for JSX-in-.js, process.env and Metro global; missing global made isFabric throw before mount.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useRef, useState } from 'react'
|
||||
import { View, Text, Pressable, BackHandler } from 'react-native'
|
||||
import { View, Text, Pressable, BackHandler, type HostInstance } from 'react-native'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import { useFocusEffect, useLocalSearchParams, useRouter } from 'expo-router'
|
||||
import { ChevronLeft } from 'lucide-react-native'
|
||||
@@ -86,7 +86,7 @@ function PairConfirmContent({ routeState }: { routeState: PairConfirmRouteState
|
||||
}, [cancel])
|
||||
)
|
||||
|
||||
const setPairConfirmRootRef = useCallback((node: View | null): void => {
|
||||
const setPairConfirmRootRef = useCallback((node: HostInstance | null): void => {
|
||||
if (node !== null) {
|
||||
mountedRef.current = true
|
||||
return
|
||||
|
||||
@@ -74,7 +74,7 @@ export default function PairScanScreen() {
|
||||
return () => subscription.remove()
|
||||
}, [getPermission])
|
||||
|
||||
const setPairScanRootRef = useCallback((node: View | null): void => {
|
||||
const setPairScanRootRef = useCallback((node: unknown): void => {
|
||||
if (node !== null) {
|
||||
mountedRef.current = true
|
||||
return
|
||||
|
||||
@@ -9,4 +9,11 @@ const config = getDefaultConfig(projectRoot)
|
||||
// Watch repo root: mobile source-control uses desktop’s pure prompt builders, outside Metro’s default mobile-only scope.
|
||||
config.watchFolders = Array.from(new Set([...(config.watchFolders ?? []), sharedRoot]))
|
||||
|
||||
// RN 0.88 registers assets through the bare `react-native/asset-registry` import, which Metro resolves from
|
||||
// the asset's own folder. Shared assets live outside mobile/, so fall back to mobile's react-native.
|
||||
config.resolver.extraNodeModules = {
|
||||
...config.resolver.extraNodeModules,
|
||||
'react-native': path.join(projectRoot, 'node_modules', 'react-native')
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
|
||||
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
||||
s.author = 'Orca'
|
||||
s.homepage = 'https://onorca.dev'
|
||||
s.source = { :git => 'https://github.com/stablyai/orca.git' }
|
||||
s.platforms = { :ios => '15.1' }
|
||||
s.platforms = { :ios => '16.4' }
|
||||
s.swift_version = '5.9'
|
||||
s.static_framework = true
|
||||
s.dependency 'ExpoModulesCore'
|
||||
|
||||
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
||||
s.author = 'Orca'
|
||||
s.homepage = 'https://onorca.dev'
|
||||
s.source = { :git => 'https://github.com/stablyai/orca.git' }
|
||||
s.platforms = { :ios => '15.1' }
|
||||
s.platforms = { :ios => '16.4' }
|
||||
s.swift_version = '5.9'
|
||||
s.static_framework = true
|
||||
s.dependency 'ExpoModulesCore'
|
||||
|
||||
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
||||
s.author = 'Orca'
|
||||
s.homepage = 'https://onorca.dev'
|
||||
s.source = { :git => 'https://github.com/stablyai/orca.git' }
|
||||
s.platforms = { :ios => '15.1' }
|
||||
s.platforms = { :ios => '16.4' }
|
||||
s.swift_version = '5.9'
|
||||
s.static_framework = true
|
||||
s.dependency 'ExpoModulesCore'
|
||||
|
||||
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
||||
s.author = 'Orca'
|
||||
s.homepage = 'https://onorca.dev'
|
||||
s.source = { :git => 'https://github.com/stablyai/orca.git' }
|
||||
s.platforms = { :ios => '15.1' }
|
||||
s.platforms = { :ios => '16.4' }
|
||||
s.swift_version = '5.9'
|
||||
s.static_framework = true
|
||||
s.dependency 'ExpoModulesCore'
|
||||
|
||||
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
||||
s.author = 'Orca'
|
||||
s.homepage = 'https://onorca.dev'
|
||||
s.source = { :git => 'https://github.com/stablyai/orca.git' }
|
||||
s.platforms = { :ios => '15.1' }
|
||||
s.platforms = { :ios => '16.4' }
|
||||
s.swift_version = '5.9'
|
||||
s.static_framework = true
|
||||
s.dependency 'ExpoModulesCore'
|
||||
|
||||
+36
-35
@@ -34,28 +34,28 @@
|
||||
"@xterm/xterm": "6.1.0-beta.336",
|
||||
"buffer": "^6.0.3",
|
||||
"diff": "8.0.4",
|
||||
"expo": "^55.0.31",
|
||||
"expo-build-properties": "^55.0.18",
|
||||
"expo-camera": "^55.0.23",
|
||||
"expo-clipboard": "^55.0.17",
|
||||
"expo-constants": "^55.0.17",
|
||||
"expo-crypto": "^55.0.19",
|
||||
"expo-dev-client": "~55.0.40",
|
||||
"expo-document-picker": "^55.0.17",
|
||||
"expo-file-system": "55.0.26",
|
||||
"expo-haptics": "^55.0.18",
|
||||
"expo-image-picker": "^55.0.24",
|
||||
"expo-keep-awake": "~55.0.8",
|
||||
"expo-linking": "^55.0.17",
|
||||
"expo-localization": "~55.0.19",
|
||||
"expo-modules-core": "~55.0.26",
|
||||
"expo-network": "~55.0.18",
|
||||
"expo-notifications": "^55.0.27",
|
||||
"expo-router": "^55.0.18",
|
||||
"expo-secure-store": "^55.0.18",
|
||||
"expo-splash-screen": "^55.0.25",
|
||||
"expo-status-bar": "^55.0.6",
|
||||
"expo-task-manager": "~55.0.20",
|
||||
"expo": "~58.0.22",
|
||||
"expo-build-properties": "^58.0.12",
|
||||
"expo-camera": "^58.0.14",
|
||||
"expo-clipboard": "^58.0.4",
|
||||
"expo-constants": "^58.0.14",
|
||||
"expo-crypto": "^58.0.7",
|
||||
"expo-dev-client": "~58.0.18",
|
||||
"expo-document-picker": "^58.0.4",
|
||||
"expo-file-system": "58.0.13",
|
||||
"expo-haptics": "^58.0.7",
|
||||
"expo-image-picker": "^58.0.10",
|
||||
"expo-keep-awake": "~58.0.3",
|
||||
"expo-linking": "^58.0.15",
|
||||
"expo-localization": "~58.0.5",
|
||||
"expo-modules-core": "~58.0.29",
|
||||
"expo-network": "~58.0.4",
|
||||
"expo-notifications": "^58.1.7",
|
||||
"expo-router": "^58.0.29",
|
||||
"expo-secure-store": "^58.0.2",
|
||||
"expo-splash-screen": "^58.0.12",
|
||||
"expo-status-bar": "^58.0.4",
|
||||
"expo-task-manager": "~58.0.13",
|
||||
"fflate": "0.8.3",
|
||||
"i18next": "26.5.11",
|
||||
"katex": "0.18.10",
|
||||
@@ -65,18 +65,18 @@
|
||||
"markdown-it-cjk-friendly": "^2.0.3",
|
||||
"markdown-it-footnote": "^4.0.0",
|
||||
"mermaid": "11.17.2",
|
||||
"react": "19.2.8",
|
||||
"react-dom": "19.2.8",
|
||||
"react-native": "^0.83.10",
|
||||
"react-native-gesture-handler": "^2.31.2",
|
||||
"react": "19.3.0",
|
||||
"react-dom": "19.3.0",
|
||||
"react-native": "0.88.1",
|
||||
"react-native-gesture-handler": "^3.3.0",
|
||||
"react-native-libsodium": "1.7.0",
|
||||
"react-native-reanimated": "4.3.4",
|
||||
"react-native-safe-area-context": "^5.7.0",
|
||||
"react-native-screens": "^4.24.0",
|
||||
"react-native-svg": "^15.15.5",
|
||||
"react-native-web": "^0.21.3",
|
||||
"react-native-webview": "13.16.2",
|
||||
"react-native-worklets": "^0.8.3",
|
||||
"react-native-reanimated": "4.7.1",
|
||||
"react-native-safe-area-context": "^5.10.1",
|
||||
"react-native-screens": "^4.30.1",
|
||||
"react-native-svg": "15.16.0",
|
||||
"react-native-web": "^0.21.4",
|
||||
"react-native-webview": "14.0.1",
|
||||
"react-native-worklets": "0.13.0",
|
||||
"remend": "1.4.0",
|
||||
"smol-toml": "1.9.1",
|
||||
"tweetnacl": "^1.0.3",
|
||||
@@ -84,6 +84,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@orca/process-host": "link:../src/packages/process-host",
|
||||
"@react-native/metro-config": "0.88.1",
|
||||
"@types/markdown-it": "14.1.2",
|
||||
"@types/markdown-it-footnote": "^3.0.4",
|
||||
"@types/mdast": "^4.0.4",
|
||||
@@ -92,11 +93,11 @@
|
||||
"@types/ws": "^8.18.2",
|
||||
"acorn": "8.18.0",
|
||||
"esbuild": "0.28.2",
|
||||
"expo-module-scripts": "^55.0.2",
|
||||
"expo-module-scripts": "^56.0.3",
|
||||
"happy-dom": "^21.0.4",
|
||||
"oxfmt": "^0.74.0",
|
||||
"oxlint": "^1.88.0",
|
||||
"react-test-renderer": "19.2.8",
|
||||
"react-test-renderer": "19.3.0",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "^7.0.2",
|
||||
"typescript-api": "npm:typescript@6.0.3",
|
||||
|
||||
@@ -126,7 +126,7 @@ public class ExpoTwoWayAudioModule: Module {
|
||||
EXPermissionsMethodsDelegate.getPermissionWithPermissionsManager(
|
||||
self.appContext?.permissions,
|
||||
withRequester: MicrophonePermissionRequester.self,
|
||||
resolve: promise.resolver,
|
||||
resolve: promise.legacyResolver,
|
||||
reject: promise.legacyRejecter
|
||||
)
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class ExpoTwoWayAudioModule: Module {
|
||||
EXPermissionsMethodsDelegate.askForPermission(
|
||||
withPermissionsManager: self.appContext?.permissions,
|
||||
withRequester: MicrophonePermissionRequester.self,
|
||||
resolve: promise.resolver,
|
||||
resolve: promise.legacyResolver,
|
||||
reject: promise.legacyRejecter
|
||||
)
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "~19.2.18",
|
||||
"expo-module-scripts": "^55.0.2",
|
||||
"expo-modules-core": "~55.0.26"
|
||||
"expo-module-scripts": "^56.0.3",
|
||||
"expo-modules-core": "~58.0.29"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"expo": "*",
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
diff --git a/build/src/utils/tsconfig/evaluateTsConfig.js b/build/src/utils/tsconfig/evaluateTsConfig.js
|
||||
index ecf0298a6858541f2e33d0af5293ad61aa80a159..491d9800703dab8e3c197c09bd45af4fd3e13b58 100644
|
||||
--- a/build/src/utils/tsconfig/evaluateTsConfig.js
|
||||
+++ b/build/src/utils/tsconfig/evaluateTsConfig.js
|
||||
@@ -77,11 +77,15 @@ function evaluateTsConfig(ts, tsConfigPath) {
|
||||
}
|
||||
}
|
||||
function importTypeScriptFromProjectOptionally(projectRoot) {
|
||||
- const resolvedPath = _resolvefrom().default.silent(projectRoot, 'typescript');
|
||||
- if (!resolvedPath) {
|
||||
- return null;
|
||||
+ // TypeScript 7 ships no compiler API; read tsconfig with the project's TypeScript 6 alias.
|
||||
+ for (const name of ['typescript', 'typescript-api']) {
|
||||
+ const resolvedPath = _resolvefrom().default.silent(projectRoot, name);
|
||||
+ const ts = resolvedPath ? require(resolvedPath) : null;
|
||||
+ if (typeof (ts == null ? void 0 : ts.readConfigFile) === 'function') {
|
||||
+ return ts;
|
||||
+ }
|
||||
}
|
||||
- return require(resolvedPath);
|
||||
+ return null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=evaluateTsConfig.js.map
|
||||
@@ -1,31 +0,0 @@
|
||||
diff --git a/ios/EXConstants.podspec b/ios/EXConstants.podspec
|
||||
index fc4608aec9d7ac1e884cb6c57aaf0886f9ff6bbe..26b96c970acfbe66af00270683b21d150e27314e 100644
|
||||
--- a/ios/EXConstants.podspec
|
||||
+++ b/ios/EXConstants.podspec
|
||||
@@ -34,10 +34,11 @@ Pod::Spec.new do |s|
|
||||
s.source_files = "**/*.{h,m,swift}"
|
||||
end
|
||||
|
||||
- env_vars = ENV['PROJECT_ROOT'] ? "PROJECT_ROOT=#{ENV['PROJECT_ROOT']} " : ""
|
||||
+ # Orca: `bash -l -c` re-parses its argument, so keep paths quoted for checkouts with spaces (upstream fix in expo-constants 58).
|
||||
+ env_vars = ENV['PROJECT_ROOT'] ? "PROJECT_ROOT=\\\"#{ENV['PROJECT_ROOT']}\\\" " : ""
|
||||
script_phase = {
|
||||
:name => 'Generate app.config for prebuilt Constants.manifest',
|
||||
- :script => "bash -l -c \"#{env_vars}$PODS_TARGET_SRCROOT/../scripts/get-app-config-ios.sh\"",
|
||||
+ :script => "bash -l -c \"#{env_vars}\\\"$PODS_TARGET_SRCROOT/../scripts/get-app-config-ios.sh\\\"\"",
|
||||
:execution_position => :before_compile
|
||||
}
|
||||
# :always_out_of_date is only available in CocoaPods 1.13.0 and later
|
||||
diff --git a/scripts/get-app-config-ios.sh b/scripts/get-app-config-ios.sh
|
||||
index b612e095ea509f92dac967540f50353507a8ff51..d416e082d219a99ac732e1ae9802bc6cd0de0bfb 100755
|
||||
--- a/scripts/get-app-config-ios.sh
|
||||
+++ b/scripts/get-app-config-ios.sh
|
||||
@@ -11,7 +11,7 @@ EXPO_CONSTANTS_PACKAGE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
||||
# `$PROJECT_DIR` is passed by Xcode as the directory to the xcodeproj file.
|
||||
# in classic main project setup it is something like /path/to/app/ios
|
||||
# in new style pod project setup it is something like /path/to/app/ios/Pods
|
||||
-PROJECT_DIR_BASENAME=$(basename $PROJECT_DIR)
|
||||
+PROJECT_DIR_BASENAME=$(basename "$PROJECT_DIR")
|
||||
if [ "x$PROJECT_DIR_BASENAME" != "xPods" ]; then
|
||||
exit 0
|
||||
fi
|
||||
@@ -1,36 +0,0 @@
|
||||
diff --git a/build/getDevicePushTokenAsync.js b/build/getDevicePushTokenAsync.js
|
||||
index f0875c5eaa84d45d646edd1ad5f21a962f68ab02..d93813b2636f1ac5e09081c3207407410a404698 100644
|
||||
--- a/build/getDevicePushTokenAsync.js
|
||||
+++ b/build/getDevicePushTokenAsync.js
|
||||
@@ -20,8 +20,11 @@ export async function getDevicePushTokenAsync() {
|
||||
else {
|
||||
// Create a new Promise and clear it afterwards
|
||||
nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync();
|
||||
- devicePushToken = await nativeTokenPromise;
|
||||
- nativeTokenPromise = null;
|
||||
+ try {
|
||||
+ devicePushToken = await nativeTokenPromise;
|
||||
+ } finally {
|
||||
+ nativeTokenPromise = null;
|
||||
+ }
|
||||
}
|
||||
// @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it
|
||||
return { type: Platform.OS, data: devicePushToken };
|
||||
diff --git a/src/getDevicePushTokenAsync.ts b/src/getDevicePushTokenAsync.ts
|
||||
index ab518dff463bc1a92052329ce5ac7c9055cbcf62..ad164f162998b5c1e218f089be82ab474727d68e 100644
|
||||
--- a/src/getDevicePushTokenAsync.ts
|
||||
+++ b/src/getDevicePushTokenAsync.ts
|
||||
@@ -24,8 +24,11 @@ export async function getDevicePushTokenAsync(): Promise<DevicePushToken> {
|
||||
} else {
|
||||
// Create a new Promise and clear it afterwards
|
||||
nativeTokenPromise = PushTokenManager.getDevicePushTokenAsync();
|
||||
- devicePushToken = await nativeTokenPromise;
|
||||
- nativeTokenPromise = null;
|
||||
+ try {
|
||||
+ devicePushToken = await nativeTokenPromise;
|
||||
+ } finally {
|
||||
+ nativeTokenPromise = null;
|
||||
+ }
|
||||
}
|
||||
|
||||
// @ts-ignore: TS thinks Platform.OS could be anything and can't decide what type is it
|
||||
@@ -1,14 +0,0 @@
|
||||
diff --git a/ios/LinkPreview/LinkPreviewNativeActionView.swift b/ios/LinkPreview/LinkPreviewNativeActionView.swift
|
||||
index 3884b7844b99484f705632100134a16547e0bf0f..af749936ffc60f54f560fcb84bd6ad4067c746a4 100644
|
||||
--- a/ios/LinkPreview/LinkPreviewNativeActionView.swift
|
||||
+++ b/ios/LinkPreview/LinkPreviewNativeActionView.swift
|
||||
@@ -137,7 +137,8 @@ class LinkPreviewNativeActionView: RouterViewWithLogger, LinkPreviewMenuUpdatabl
|
||||
baseUiAction.attributes = attributes
|
||||
baseUiAction.state = isOn == true ? .on : .off
|
||||
|
||||
- if let subtitle = subtitle {
|
||||
+ // Orca: the iOS 27.1 SDK marks UIAction.subtitle iOS 16+, which fails the iOS 15.1 build.
|
||||
+ if let subtitle = subtitle, #available(iOS 16.0, *) {
|
||||
baseUiAction.subtitle = subtitle
|
||||
}
|
||||
if let label = discoverabilityLabel {
|
||||
@@ -1,10 +0,0 @@
|
||||
diff --git a/index.js b/index.js
|
||||
index 0480a96d718c997b0a5a54b775e635e2e048e796..85f71b13d3f0f31c3c2140581d1e4051afb21dc3 100644
|
||||
--- a/index.js
|
||||
+++ b/index.js
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as queryString from './base.js';
|
||||
|
||||
export default queryString;
|
||||
+
|
||||
+export * from './base.js';
|
||||
@@ -0,0 +1,37 @@
|
||||
diff --git a/ios/Libsodium.mm b/ios/Libsodium.mm
|
||||
index fbc745de0b351ca6193930a5682e5fa44589e8bf..7f75eaa3e62230435bd634882cdb98cd38ced0b6 100644
|
||||
--- a/ios/Libsodium.mm
|
||||
+++ b/ios/Libsodium.mm
|
||||
@@ -4,6 +4,12 @@
|
||||
#import <React/RCTLog.h>
|
||||
#import "react-native-libsodium.h"
|
||||
|
||||
+// Orca: RN 0.88 removed RCTCxxBridge.runtime. Under bridgeless the module's bridge is an
|
||||
+// RCTBridgeProxy, which still implements -runtime but no longer declares it publicly.
|
||||
+@protocol OrcaLibsodiumRuntimeProvider
|
||||
+- (void *)runtime;
|
||||
+@end
|
||||
+
|
||||
@implementation Libsodium
|
||||
|
||||
@synthesize bridge=_bridge;
|
||||
@@ -13,14 +19,14 @@ RCT_EXPORT_MODULE()
|
||||
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
|
||||
|
||||
RCTLogInfo(@"installing libsodium");
|
||||
- RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
|
||||
- if (!cxxBridge.runtime) {
|
||||
- RCTLogInfo(@"libsodium install failure: no cxx bridge runtime");
|
||||
+ void *runtime = [(id<OrcaLibsodiumRuntimeProvider>)self.bridge runtime];
|
||||
+ if (!runtime) {
|
||||
+ RCTLogInfo(@"libsodium install failure: no bridge runtime");
|
||||
return nil;
|
||||
}
|
||||
|
||||
- RCTLogInfo(@"calling installLibsodium with cxx bridge runtime");
|
||||
- ReactNativeLibsodium::installLibsodium(*(facebook::jsi::Runtime *)cxxBridge.runtime);
|
||||
+ RCTLogInfo(@"calling installLibsodium with bridge runtime");
|
||||
+ ReactNativeLibsodium::installLibsodium(*(facebook::jsi::Runtime *)runtime);
|
||||
return nil;
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ index 80c68034b193a47bedb56ca527352de9548e8ac6..977c068a74c88c0322fca2a4bbffab8b
|
||||
}
|
||||
};
|
||||
diff --git a/apple/RNCWebViewImpl.m b/apple/RNCWebViewImpl.m
|
||||
index 7f5c24d6e2cfb26eddbc513bf17a81c24a7273e2..d70cb58a3c81cb22bd549a2c37340ba53853cfcf 100644
|
||||
index 38904266dc37b006274104f4680778ffbfece369..28bd1df80722396ef33fa48bf539dc4abbb1ead9 100644
|
||||
--- a/apple/RNCWebViewImpl.m
|
||||
+++ b/apple/RNCWebViewImpl.m
|
||||
@@ -776,12 +776,21 @@ - (void)userContentController:(WKUserContentController *)userContentController
|
||||
@@ -790,12 +790,21 @@ RCTAutoInsetsProtocol>
|
||||
didReceiveScriptMessage:(WKScriptMessage *)message
|
||||
{
|
||||
if ([message.name isEqualToString:HistoryShimName]) {
|
||||
+117
-108
@@ -1,111 +1,11 @@
|
||||
diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
|
||||
index d02e003a439e410ddab597b2c036256c80db0395..cf745cf37a37d34f9e93eb8df10b43cb54ab91a3 100644
|
||||
--- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
|
||||
+++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
|
||||
@@ -382,6 +382,7 @@
|
||||
_backedTextInputView.inputAccessoryView = nil;
|
||||
_hasInputAccessoryView = false;
|
||||
[_backedTextInputView resignFirstResponder];
|
||||
+ [_backedTextInputView resetDictationRecognition];
|
||||
}
|
||||
|
||||
#pragma mark - RCTBackedTextInputDelegate
|
||||
@@ -703,6 +704,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
{
|
||||
return {
|
||||
.text = RCTStringFromNSString(_backedTextInputView.attributedText.string),
|
||||
+ .isComposing = _backedTextInputView.markedTextRange != nil,
|
||||
.selectionRange = [self _selectionRange],
|
||||
.eventCount = static_cast<int>(_mostRecentEventCount),
|
||||
.contentOffset = RCTPointFromCGPoint(_backedTextInputView.contentOffset),
|
||||
@@ -865,4 +867,6 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
+ // Preserve the native recognition placeholder while iOS finalizes dictation.
|
||||
BOOL shouldFallbackToBareTextComparison =
|
||||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] ||
|
||||
+ _backedTextInputView.dictationRecognizing ||
|
||||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] ||
|
||||
_backedTextInputView.markedTextRange || _backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem;
|
||||
diff --git a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp
|
||||
index a9bc219f8bf729111e907423ca61b991fd712b46..60e9c6f54edb295295d6e48d1d554499106b7e57 100644
|
||||
--- a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp
|
||||
+++ b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp
|
||||
@@ -24,6 +24,10 @@ static jsi::Value textInputMetricsPayload(
|
||||
|
||||
payload.setProperty(runtime, "eventCount", textInputMetrics.eventCount);
|
||||
|
||||
+ if (textInputMetrics.isComposing.has_value()) {
|
||||
+ payload.setProperty(runtime, "isComposing", *textInputMetrics.isComposing);
|
||||
+ }
|
||||
+
|
||||
if (includeSelectionState) {
|
||||
auto selection = jsi::Object(runtime);
|
||||
selection.setProperty(
|
||||
diff --git a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
|
||||
index a3f2e01c130c1a53aee0b39e72927d21f2a6973d..c9d34f8b42644800b5c85e5be45b6ebfbe94a54d 100644
|
||||
--- a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
|
||||
+++ b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
+#include <optional>
|
||||
+
|
||||
#include <react/renderer/attributedstring/AttributedString.h>
|
||||
#include <react/renderer/components/view/ViewEventEmitter.h>
|
||||
|
||||
@@ -18,6 +20,7 @@ class TextInputEventEmitter : public ViewEventEmitter {
|
||||
|
||||
struct Metrics {
|
||||
std::string text;
|
||||
+ std::optional<bool> isComposing;
|
||||
AttributedString::Range selectionRange;
|
||||
// ScrollView-like metrics
|
||||
Size contentSize;
|
||||
diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
|
||||
index 79ee7ffe43..956f189a1c 100644
|
||||
--- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
|
||||
+++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
|
||||
@@ -136,6 +136,7 @@ using namespace facebook::react;
|
||||
- (void)prepareForRecycle
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
_textView.state = nullptr;
|
||||
+ _textView.layoutMetrics = EmptyLayoutMetrics;
|
||||
_accessibilityProvider = nil;
|
||||
}
|
||||
diff --git a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
|
||||
--- a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
|
||||
+++ b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
|
||||
@@ -48,6 +48,7 @@
|
||||
- (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange NS_UNAVAILABLE;
|
||||
- (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate;
|
||||
- (void)scrollRangeToVisible:(NSRange)selectedTextRange;
|
||||
+- (void)resetDictationRecognition;
|
||||
|
||||
// This protocol disallows direct access to `text` property because
|
||||
// unwise usage of it can break the `attributeText` behavior.
|
||||
diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.mm b/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
|
||||
--- a/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
|
||||
+++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
|
||||
@@ -197,6 +197,11 @@
|
||||
}
|
||||
|
||||
#pragma mark - Dictation
|
||||
+
|
||||
+- (void)resetDictationRecognition
|
||||
+{
|
||||
+ _dictationRecognizing = NO;
|
||||
+}
|
||||
|
||||
- (void)dictationRecordingDidEnd
|
||||
{
|
||||
diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.mm b/Libraries/Text/TextInput/Multiline/RCTUITextView.mm
|
||||
index a803387b98bfb68e0c9bbb783e25bc649566e6a3..53adfdd413797871d29e13770f50e9be6377c3e1 100644
|
||||
--- a/Libraries/Text/TextInput/Multiline/RCTUITextView.mm
|
||||
+++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.mm
|
||||
@@ -319,6 +319,11 @@
|
||||
|
||||
@@ -326,6 +326,11 @@ static UIColor *defaultPlaceholderColor(void)
|
||||
|
||||
#pragma mark - Dictation
|
||||
|
||||
|
||||
+- (void)resetDictationRecognition
|
||||
+{
|
||||
+ _dictationRecognizing = NO;
|
||||
@@ -114,11 +14,118 @@ diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.mm b/Libraries/Tex
|
||||
- (void)dictationRecordingDidEnd
|
||||
{
|
||||
_dictationRecognizing = YES;
|
||||
diff --git a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
|
||||
index 2f32b96d2a17b1fd512c2d985dd536ffd4c011c8..4089c3a940a7c389c17500667b6c026bc741034d 100644
|
||||
--- a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
|
||||
+++ b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h
|
||||
@@ -47,6 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange NS_UNAVAILABLE;
|
||||
- (void)setSelectedTextRange:(nullable UITextRange *)selectedTextRange notifyDelegate:(BOOL)notifyDelegate;
|
||||
- (void)scrollRangeToVisible:(NSRange)selectedTextRange;
|
||||
+- (void)resetDictationRecognition;
|
||||
|
||||
// This protocol disallows direct access to `text` property because
|
||||
// unwise usage of it can break the `attributeText` behavior.
|
||||
diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.mm b/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
|
||||
index 064b48bb372074df29f961ff8d79e7caba8520c5..b0b73ecba1f42a7789ede064aa83f4ae9f62c1fb 100644
|
||||
--- a/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
|
||||
+++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.mm
|
||||
@@ -197,6 +197,11 @@
|
||||
|
||||
#pragma mark - Dictation
|
||||
|
||||
+- (void)resetDictationRecognition
|
||||
+{
|
||||
+ _dictationRecognizing = NO;
|
||||
+}
|
||||
+
|
||||
- (void)dictationRecordingDidEnd
|
||||
{
|
||||
_dictationRecognizing = YES;
|
||||
diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
|
||||
index 228ec0d2a28feeee886e1105f4b1e6cd18649b42..c50f79b48e0d4ae0fcdcfb49d0b9db949f55f5d7 100644
|
||||
--- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
|
||||
+++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
|
||||
@@ -167,6 +167,7 @@ using namespace facebook::react;
|
||||
{
|
||||
[super prepareForRecycle];
|
||||
_textView.state = nullptr;
|
||||
+ _textView.layoutMetrics = EmptyLayoutMetrics;
|
||||
_accessibilityProvider = nil;
|
||||
}
|
||||
|
||||
diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
|
||||
index 8f55121cd23d27577bab45716d91d6cdad878e41..05529db1a074652d2ca45abd70e421484b38e87b 100644
|
||||
--- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
|
||||
+++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm
|
||||
@@ -397,6 +397,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
_backedTextInputView.inputAccessoryView = nil;
|
||||
_hasInputAccessoryView = false;
|
||||
[_backedTextInputView resignFirstResponder];
|
||||
+ [_backedTextInputView resetDictationRecognition];
|
||||
}
|
||||
|
||||
#pragma mark - RCTBackedTextInputDelegate
|
||||
@@ -733,6 +734,7 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
{
|
||||
return {
|
||||
.text = RCTStringFromNSString(_backedTextInputView.attributedText.string),
|
||||
+ .isComposing = _backedTextInputView.markedTextRange != nil,
|
||||
.selectionRange = [self _selectionRange],
|
||||
.contentSize = RCTSizeFromCGSize(_backedTextInputView.contentSize),
|
||||
.contentOffset = RCTPointFromCGPoint(_backedTextInputView.contentOffset),
|
||||
@@ -892,8 +894,10 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
|
||||
}
|
||||
}];
|
||||
|
||||
+ // Preserve the native recognition placeholder while iOS finalizes dictation.
|
||||
BOOL shouldFallbackToBareTextComparison =
|
||||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] ||
|
||||
+ _backedTextInputView.dictationRecognizing ||
|
||||
[_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] ||
|
||||
_backedTextInputView.markedTextRange || _backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem;
|
||||
|
||||
diff --git a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp
|
||||
index 7da2622926dcb85968d0d8f17a2ec57098117bdd..42d814740d9cfd46bfd40f1cc5b9e851d3765fbd 100644
|
||||
--- a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp
|
||||
+++ b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.cpp
|
||||
@@ -24,6 +24,10 @@ static jsi::Value textInputMetricsPayload(
|
||||
|
||||
payload.setProperty(runtime, "eventCount", textInputMetrics.eventCount);
|
||||
|
||||
+ if (textInputMetrics.isComposing.has_value()) {
|
||||
+ payload.setProperty(runtime, "isComposing", *textInputMetrics.isComposing);
|
||||
+ }
|
||||
+
|
||||
if (includeSelectionState) {
|
||||
auto selection = jsi::Object(runtime);
|
||||
selection.setProperty(
|
||||
diff --git a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
|
||||
index 8c1a443f9e5f769ea0a1e50e818ab7aae63c72b2..cf6aa26c9a1b6469f110fb0d39e2456bb464bb4f 100644
|
||||
--- a/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
|
||||
+++ b/ReactCommon/react/renderer/components/textinput/TextInputEventEmitter.h
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <react/cxxstableapi/FrameworksGuard.h>
|
||||
|
||||
+#include <optional>
|
||||
+
|
||||
#include <react/renderer/attributedstring/AttributedString.h>
|
||||
#include <react/renderer/components/view/ViewEventEmitter.h>
|
||||
|
||||
@@ -20,6 +22,7 @@ class TextInputEventEmitter : public ViewEventEmitter {
|
||||
|
||||
struct Metrics {
|
||||
std::string text;
|
||||
+ std::optional<bool> isComposing;
|
||||
AttributedString::Range selectionRange;
|
||||
// ScrollView-like metrics
|
||||
Size contentSize;
|
||||
diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js
|
||||
index 36aafbb..92aa2d9 100644
|
||||
index 2eccf43..b5dfad2 100644
|
||||
--- a/Libraries/WebSocket/WebSocket.js
|
||||
+++ b/Libraries/WebSocket/WebSocket.js
|
||||
@@ -88,6 +88,8 @@ class WebSocket extends EventTarget {
|
||||
@@ -90,6 +90,8 @@ class WebSocket extends EventTarget {
|
||||
_eventEmitter: NativeEventEmitter<WebSocketEventDefinitions>;
|
||||
_subscriptions: Array<EventSubscription>;
|
||||
_binaryType: ?BinaryType;
|
||||
@@ -127,7 +134,7 @@ index 36aafbb..92aa2d9 100644
|
||||
|
||||
bufferedAmount: number;
|
||||
extension: ?string;
|
||||
@@ -236,10 +238,13 @@ class WebSocket extends EventTarget {
|
||||
@@ -241,11 +243,14 @@ class WebSocket extends EventTarget {
|
||||
if (ev.id !== this._socketId) {
|
||||
return;
|
||||
}
|
||||
@@ -136,10 +143,12 @@ index 36aafbb..92aa2d9 100644
|
||||
+ ev.data;
|
||||
switch (ev.type) {
|
||||
case 'binary':
|
||||
- // $FlowFixMe[incompatible-type]
|
||||
- data = base64.toByteArray(ev.data).buffer;
|
||||
+ data = this.orcaBinaryAsBase64
|
||||
+ ? {base64: ev.data}
|
||||
+ : base64.toByteArray(ev.data).buffer;
|
||||
+ : // $FlowFixMe[incompatible-type]
|
||||
+ base64.toByteArray(ev.data).buffer;
|
||||
break;
|
||||
case 'blob':
|
||||
data = BlobManager.createFromOptions(ev.data);
|
||||
@@ -1,175 +0,0 @@
|
||||
diff --git a/src/v3/types.ts b/src/v3/types.ts
|
||||
--- a/src/v3/types.ts
|
||||
+++ b/src/v3/types.ts
|
||||
@@ -2263,6 +2263,7 @@
|
||||
exact: true,
|
||||
message: def.exactLength.message,
|
||||
});
|
||||
+ if (tooBig) return INVALID;
|
||||
status.dirty();
|
||||
}
|
||||
}
|
||||
@@ -2291,7 +2292,7 @@
|
||||
exact: false,
|
||||
message: def.maxLength.message,
|
||||
});
|
||||
- status.dirty();
|
||||
+ return INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3723,7 +3724,7 @@
|
||||
exact: false,
|
||||
message: def.maxSize.message,
|
||||
});
|
||||
- status.dirty();
|
||||
+ return INVALID;
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/v3/types.js b/v3/types.js
|
||||
--- a/v3/types.js
|
||||
+++ b/v3/types.js
|
||||
@@ -1769,6 +1769,7 @@
|
||||
exact: true,
|
||||
message: def.exactLength.message,
|
||||
});
|
||||
+ if (tooBig) return INVALID;
|
||||
status.dirty();
|
||||
}
|
||||
}
|
||||
@@ -1795,7 +1796,7 @@
|
||||
exact: false,
|
||||
message: def.maxLength.message,
|
||||
});
|
||||
- status.dirty();
|
||||
+ return INVALID;
|
||||
}
|
||||
}
|
||||
if (ctx.common.async) {
|
||||
@@ -2814,7 +2815,7 @@
|
||||
exact: false,
|
||||
message: def.maxSize.message,
|
||||
});
|
||||
- status.dirty();
|
||||
+ return INVALID;
|
||||
}
|
||||
}
|
||||
const valueType = this._def.valueType;
|
||||
diff --git a/v3/types.cjs b/v3/types.cjs
|
||||
--- a/v3/types.cjs
|
||||
+++ b/v3/types.cjs
|
||||
@@ -1790,6 +1790,7 @@
|
||||
exact: true,
|
||||
message: def.exactLength.message,
|
||||
});
|
||||
+ if (tooBig) return parseUtil_js_1.INVALID;
|
||||
status.dirty();
|
||||
}
|
||||
}
|
||||
@@ -1816,7 +1817,7 @@
|
||||
exact: false,
|
||||
message: def.maxLength.message,
|
||||
});
|
||||
- status.dirty();
|
||||
+ return parseUtil_js_1.INVALID;
|
||||
}
|
||||
}
|
||||
if (ctx.common.async) {
|
||||
@@ -2843,7 +2844,7 @@
|
||||
exact: false,
|
||||
message: def.maxSize.message,
|
||||
});
|
||||
- status.dirty();
|
||||
+ return parseUtil_js_1.INVALID;
|
||||
}
|
||||
}
|
||||
const valueType = this._def.valueType;
|
||||
diff --git a/src/v4/core/schemas.ts b/src/v4/core/schemas.ts
|
||||
--- a/src/v4/core/schemas.ts
|
||||
+++ b/src/v4/core/schemas.ts
|
||||
@@ -242,6 +242,26 @@
|
||||
};
|
||||
|
||||
inst._zod.run = (payload, ctx) => {
|
||||
+ const value = payload.value;
|
||||
+ const size = def.type === "array" && Array.isArray(value) ? value.length
|
||||
+ : (def.type === "map" && value instanceof Map) || (def.type === "set" && value instanceof Set) ? value.size : -1;
|
||||
+ if (size >= 0) {
|
||||
+ for (const ch of checks) {
|
||||
+ const checkDef = ch._zod.def;
|
||||
+ if (!["min_length", "max_length", "length_equals", "min_size", "max_size", "size_equals"].includes(checkDef.check)) break;
|
||||
+ const maximum = "maximum" in checkDef ? checkDef.maximum
|
||||
+ : "length" in checkDef ? checkDef.length : "size" in checkDef ? checkDef.size : undefined;
|
||||
+ if (typeof maximum === "number" && size > maximum && (!checkDef.when || checkDef.when(payload))) {
|
||||
+ const start = payload.issues.length;
|
||||
+ // SAFETY: Built-in size checks run only after the matching collection type guard.
|
||||
+ ch._zod.check(payload as ParsePayload<never>);
|
||||
+ for (let i = start; i < payload.issues.length; i++) {
|
||||
+ payload.issues[i] = { ...payload.issues[i], continue: false };
|
||||
+ }
|
||||
+ return payload;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
const result = inst._zod.parse(payload, ctx);
|
||||
|
||||
if (result instanceof Promise) {
|
||||
diff --git a/v4/core/schemas.js b/v4/core/schemas.js
|
||||
--- a/v4/core/schemas.js
|
||||
+++ b/v4/core/schemas.js
|
||||
@@ -74,6 +74,25 @@
|
||||
return payload;
|
||||
};
|
||||
inst._zod.run = (payload, ctx) => {
|
||||
+ const value = payload.value;
|
||||
+ const size = def.type === "array" && Array.isArray(value) ? value.length
|
||||
+ : (def.type === "map" && value instanceof Map) || (def.type === "set" && value instanceof Set) ? value.size : -1;
|
||||
+ if (size >= 0) {
|
||||
+ for (const ch of checks) {
|
||||
+ const checkDef = ch._zod.def;
|
||||
+ if (!["min_length", "max_length", "length_equals", "min_size", "max_size", "size_equals"].includes(checkDef.check)) break;
|
||||
+ const maximum = "maximum" in checkDef ? checkDef.maximum
|
||||
+ : "length" in checkDef ? checkDef.length : "size" in checkDef ? checkDef.size : undefined;
|
||||
+ if (typeof maximum === "number" && size > maximum && (!checkDef.when || checkDef.when(payload))) {
|
||||
+ const start = payload.issues.length;
|
||||
+ ch._zod.check(payload);
|
||||
+ for (let i = start; i < payload.issues.length; i++) {
|
||||
+ payload.issues[i] = { ...payload.issues[i], continue: false };
|
||||
+ }
|
||||
+ return payload;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
const result = inst._zod.parse(payload, ctx);
|
||||
if (result instanceof Promise) {
|
||||
if (ctx.async === false)
|
||||
diff --git a/v4/core/schemas.cjs b/v4/core/schemas.cjs
|
||||
--- a/v4/core/schemas.cjs
|
||||
+++ b/v4/core/schemas.cjs
|
||||
@@ -104,6 +104,25 @@
|
||||
return payload;
|
||||
};
|
||||
inst._zod.run = (payload, ctx) => {
|
||||
+ const value = payload.value;
|
||||
+ const size = def.type === "array" && Array.isArray(value) ? value.length
|
||||
+ : (def.type === "map" && value instanceof Map) || (def.type === "set" && value instanceof Set) ? value.size : -1;
|
||||
+ if (size >= 0) {
|
||||
+ for (const ch of checks) {
|
||||
+ const checkDef = ch._zod.def;
|
||||
+ if (!["min_length", "max_length", "length_equals", "min_size", "max_size", "size_equals"].includes(checkDef.check)) break;
|
||||
+ const maximum = "maximum" in checkDef ? checkDef.maximum
|
||||
+ : "length" in checkDef ? checkDef.length : "size" in checkDef ? checkDef.size : undefined;
|
||||
+ if (typeof maximum === "number" && size > maximum && (!checkDef.when || checkDef.when(payload))) {
|
||||
+ const start = payload.issues.length;
|
||||
+ ch._zod.check(payload);
|
||||
+ for (let i = start; i < payload.issues.length; i++) {
|
||||
+ payload.issues[i] = { ...payload.issues[i], continue: false };
|
||||
+ }
|
||||
+ return payload;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
const result = inst._zod.parse(payload, ctx);
|
||||
if (result instanceof Promise) {
|
||||
if (ctx.async === false)
|
||||
@@ -55,7 +55,6 @@ const METHODS = `
|
||||
densityDpi = pane.densityDpi
|
||||
scaledDensity = pane.scaledDensity
|
||||
}
|
||||
DisplayMetricsHolder.setWindowDisplayMetrics(pane)
|
||||
DisplayMetricsHolder.setScreenDisplayMetrics(screen)
|
||||
}
|
||||
`
|
||||
|
||||
@@ -3,7 +3,8 @@ const { withPodfile } = require('expo/config-plugins')
|
||||
// Why: Xcode 27 rejects deployment targets below iOS 15.0, and some pods (and their
|
||||
// resource-bundle targets) still declare 9.0–13.4, which fails the build. The iOS 27 SDK
|
||||
// is what lets the app resize on iPhone Duo, so raise those targets to the app's own.
|
||||
const DEPLOYMENT_TARGET_FLOOR = '15.1'
|
||||
// Expo SDK 58 and React Native 0.88 require iOS 16.4.
|
||||
const DEPLOYMENT_TARGET_FLOOR = '16.4'
|
||||
const MARKER = '# orca: pod deployment target floor'
|
||||
const POST_INSTALL = 'post_install do |installer|'
|
||||
|
||||
|
||||
@@ -1,181 +1,64 @@
|
||||
const fs = require('node:fs')
|
||||
const path = require('node:path')
|
||||
const {
|
||||
IOSConfig,
|
||||
withAppDelegate,
|
||||
withDangerousMod,
|
||||
withInfoPlist,
|
||||
withXcodeProject
|
||||
} = require('expo/config-plugins')
|
||||
const { withDangerousMod } = require('expo/config-plugins')
|
||||
|
||||
// Why: UIKit stops an app built with the iOS 27 SDK at launch unless it adopts the UIScene
|
||||
// lifecycle (TN3187), and Expo SDK 55's AppDelegate template still creates the window itself.
|
||||
// The iOS 27 SDK is what lets the app resize on iPhone Duo, so the window moves into a scene
|
||||
// delegate here. Drop this plugin once Expo's template adopts scenes (SDK 58).
|
||||
const MARKER = 'orca: UIScene lifecycle'
|
||||
// Why: Expo SDK 58's template adopts the UIScene lifecycle the iOS 27 SDK requires (TN3187), and
|
||||
// its ExpoAppSceneDelegate forwards URLs and user activities. It starts React Native on every
|
||||
// scene connect, though, and iOS may disconnect the app's only scene in the background and
|
||||
// reconnect it later. Reattach the running root then, so a reconnect keeps the app's state
|
||||
// instead of starting a second React Native instance.
|
||||
const MARKER = 'orca: UIScene reconnect'
|
||||
const EXTENSION_POINT = ' // Extension point for config plugins.\n'
|
||||
const TEMPLATE_CLASS = 'class SceneDelegate: ExpoAppSceneDelegate {\n'
|
||||
|
||||
const SCENE_MANIFEST = {
|
||||
UIApplicationSupportsMultipleScenes: false,
|
||||
UISceneConfigurations: {
|
||||
UIWindowSceneSessionRoleApplication: [
|
||||
{
|
||||
UISceneConfigurationName: 'Default Configuration',
|
||||
UISceneDelegateClassName: '$(PRODUCT_MODULE_NAME).SceneDelegate'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
const FACTORY_PROPERTY = ' var reactNativeFactory: RCTReactNativeFactory?\n'
|
||||
const WINDOW_BLOCK =
|
||||
/#if os\(iOS\) \|\| os\(tvOS\)\s*\n\s*window = UIWindow\(frame: UIScreen\.main\.bounds\)\s*\n\s*factory\.startReactNative\(\s*withModuleName: "main",\s*in: window,\s*launchOptions: launchOptions\)\s*\n#endif\n/
|
||||
|
||||
function patchAppDelegate(contents) {
|
||||
if (contents.includes(MARKER)) {
|
||||
return contents
|
||||
}
|
||||
// A changed template must fail prebuild rather than ship an app that cannot launch.
|
||||
if (!contents.includes(FACTORY_PROPERTY) || !WINDOW_BLOCK.test(contents)) {
|
||||
throw new Error(
|
||||
"ios-scene-lifecycle: Expo's AppDelegate template changed; update the plugin before building."
|
||||
)
|
||||
}
|
||||
return contents
|
||||
.replace(
|
||||
FACTORY_PROPERTY,
|
||||
`${FACTORY_PROPERTY} // ${MARKER}: SceneDelegate starts React Native with these.\n var launchOptions: [UIApplication.LaunchOptionsKey: Any]?\n`
|
||||
)
|
||||
.replace(
|
||||
WINDOW_BLOCK,
|
||||
` // ${MARKER}: SceneDelegate creates the window.\n self.launchOptions = launchOptions\n`
|
||||
)
|
||||
}
|
||||
|
||||
const SCENE_DELEGATE_SWIFT = `import React
|
||||
import UIKit
|
||||
|
||||
// ${MARKER}, generated by plugins/ios-scene-lifecycle.js.
|
||||
// Under scenes UIKit stops calling the AppDelegate URL callbacks, where RCTLinkingManager and
|
||||
// Expo's subscribers listen, so every URL and user activity is forwarded to them.
|
||||
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
private var appDelegate: AppDelegate? {
|
||||
UIApplication.shared.delegate as? AppDelegate
|
||||
}
|
||||
|
||||
func scene(
|
||||
const RECONNECT_OVERRIDE = ` // ${MARKER}, generated by plugins/ios-scene-lifecycle.js.
|
||||
override func scene(
|
||||
_ scene: UIScene,
|
||||
willConnectTo session: UISceneSession,
|
||||
options connectionOptions: UIScene.ConnectionOptions
|
||||
) {
|
||||
guard let windowScene = scene as? UIWindowScene, let appDelegate,
|
||||
let factory = appDelegate.reactNativeFactory
|
||||
else { return }
|
||||
|
||||
guard let windowScene = scene as? UIWindowScene,
|
||||
let provider = UIApplication.shared.delegate as? ExpoReactNativeFactoryProvider,
|
||||
let runningRoot = provider.window?.rootViewController
|
||||
else {
|
||||
super.scene(scene, willConnectTo: session, options: connectionOptions)
|
||||
return
|
||||
}
|
||||
let window = UIWindow(windowScene: windowScene)
|
||||
self.window = window
|
||||
// A scene iOS dropped in the background and reconnects keeps the running app, not a fresh one.
|
||||
let runningRoot = appDelegate.window?.rootViewController
|
||||
appDelegate.window = window
|
||||
|
||||
let launchURL = connectionOptions.urlContexts.first
|
||||
// Universal links are the only activity the app handles.
|
||||
let launchActivity = connectionOptions.userActivities.first {
|
||||
$0.activityType == NSUserActivityTypeBrowsingWeb
|
||||
provider.window = window
|
||||
window.rootViewController = runningRoot
|
||||
window.makeKeyAndVisible()
|
||||
if !connectionOptions.urlContexts.isEmpty {
|
||||
self.scene(scene, openURLContexts: connectionOptions.urlContexts)
|
||||
}
|
||||
|
||||
if let runningRoot {
|
||||
window.rootViewController = runningRoot
|
||||
window.makeKeyAndVisible()
|
||||
} else {
|
||||
// A cold-start URL arrives here rather than in the launch options getInitialURL reads.
|
||||
var launchOptions = appDelegate.launchOptions ?? [:]
|
||||
if let launchURL {
|
||||
launchOptions[.url] = launchURL.url
|
||||
if let source = launchURL.options.sourceApplication {
|
||||
launchOptions[.sourceApplication] = source
|
||||
}
|
||||
}
|
||||
if let launchActivity {
|
||||
launchOptions[.userActivityDictionary] = [
|
||||
UIApplication.LaunchOptionsKey.userActivityType.rawValue: launchActivity.activityType,
|
||||
"UIApplicationLaunchOptionsUserActivityKey": launchActivity,
|
||||
]
|
||||
}
|
||||
factory.startReactNative(withModuleName: "main", in: window, launchOptions: launchOptions)
|
||||
}
|
||||
|
||||
if let launchURL {
|
||||
forward(launchURL)
|
||||
}
|
||||
if let launchActivity {
|
||||
_ = appDelegate.application(UIApplication.shared, continue: launchActivity) { _ in }
|
||||
for activity in connectionOptions.userActivities {
|
||||
self.scene(scene, continue: activity)
|
||||
}
|
||||
}
|
||||
|
||||
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
||||
for context in URLContexts {
|
||||
forward(context)
|
||||
}
|
||||
}
|
||||
|
||||
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
|
||||
_ = appDelegate?.application(UIApplication.shared, continue: userActivity) { _ in }
|
||||
}
|
||||
|
||||
private func forward(_ context: UIOpenURLContext) {
|
||||
var options: [UIApplication.OpenURLOptionsKey: Any] = [
|
||||
.openInPlace: context.options.openInPlace
|
||||
]
|
||||
if let source = context.options.sourceApplication {
|
||||
options[.sourceApplication] = source
|
||||
}
|
||||
if let annotation = context.options.annotation {
|
||||
options[.annotation] = annotation
|
||||
}
|
||||
_ = appDelegate?.application(UIApplication.shared, open: context.url, options: options)
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
function patchSceneDelegate(contents) {
|
||||
if (contents.includes(MARKER)) {
|
||||
return contents
|
||||
}
|
||||
// A changed template must fail prebuild rather than silently drop the reconnect behavior.
|
||||
if (!contents.includes(TEMPLATE_CLASS) || !contents.includes(EXTENSION_POINT)) {
|
||||
throw new Error(
|
||||
"ios-scene-lifecycle: Expo's SceneDelegate template changed; update the plugin before building."
|
||||
)
|
||||
}
|
||||
return contents.replace(EXTENSION_POINT, `${EXTENSION_POINT}\n${RECONNECT_OVERRIDE}`)
|
||||
}
|
||||
|
||||
module.exports = function withIosSceneLifecycle(config) {
|
||||
config = withInfoPlist(config, (cfg) => {
|
||||
cfg.modResults.UIApplicationSceneManifest = SCENE_MANIFEST
|
||||
return cfg
|
||||
})
|
||||
|
||||
config = withAppDelegate(config, (cfg) => {
|
||||
if (cfg.modResults.language !== 'swift') {
|
||||
throw new Error(
|
||||
`ios-scene-lifecycle: expected a Swift AppDelegate, got ${cfg.modResults.language}`
|
||||
)
|
||||
}
|
||||
cfg.modResults.contents = patchAppDelegate(cfg.modResults.contents)
|
||||
return cfg
|
||||
})
|
||||
|
||||
config = withDangerousMod(config, [
|
||||
return withDangerousMod(config, [
|
||||
'ios',
|
||||
(cfg) => {
|
||||
const { platformProjectRoot, projectName } = cfg.modRequest
|
||||
fs.writeFileSync(
|
||||
path.join(platformProjectRoot, projectName, 'SceneDelegate.swift'),
|
||||
SCENE_DELEGATE_SWIFT
|
||||
)
|
||||
const file = path.join(platformProjectRoot, projectName, 'SceneDelegate.swift')
|
||||
fs.writeFileSync(file, patchSceneDelegate(fs.readFileSync(file, 'utf8')))
|
||||
return cfg
|
||||
}
|
||||
])
|
||||
|
||||
return withXcodeProject(config, (cfg) => {
|
||||
const filepath = `${cfg.modRequest.projectName}/SceneDelegate.swift`
|
||||
if (!cfg.modResults.hasFile(filepath)) {
|
||||
IOSConfig.XcodeUtils.addBuildSourceFileToGroup({
|
||||
filepath,
|
||||
groupName: cfg.modRequest.projectName,
|
||||
project: cfg.modResults
|
||||
})
|
||||
}
|
||||
return cfg
|
||||
})
|
||||
}
|
||||
|
||||
Generated
+1741
-3283
File diff suppressed because it is too large
Load Diff
@@ -6,30 +6,19 @@ allowBuilds:
|
||||
minimumReleaseAge: 4320
|
||||
|
||||
overrides:
|
||||
# Expo still requires Zod 3; pin the version with our security backport.
|
||||
zod@>=3 <4: 3.25.76
|
||||
dompurify@<3.4.17: 3.4.17
|
||||
sprintf-js@<1.1.3: 1.1.3
|
||||
markdown-it@>=14.0.0 <14.3.3: 14.3.3
|
||||
# Mermaid 11 still requests KaTeX 0.16; the security fix starts at 0.18.2.
|
||||
katex@>=0.11.0 <0.18.2: 0.18.10
|
||||
# xcode still requests uuid 7; buffer bounds checks were fixed in 11.1.1.
|
||||
xcode>uuid: 11.1.1
|
||||
# Expo Router still requests query-string 7 and its vulnerable URI decoder.
|
||||
query-string: 9.5.1
|
||||
|
||||
patchedDependencies:
|
||||
zod@3.25.76: patches/zod@3.25.76.patch
|
||||
sprintf-js@1.1.3: patches/sprintf-js@1.1.3.patch
|
||||
'@xterm/addon-webgl@0.20.0-beta.329': patches/@xterm__addon-webgl@0.20.0-beta.329.patch
|
||||
expo-notifications@55.0.27: patches/expo-notifications@55.0.27.patch
|
||||
query-string@9.5.1: patches/query-string@9.5.1.patch
|
||||
react-native-webview@13.16.2: patches/react-native-webview@13.16.2.patch
|
||||
react-native@0.83.10: patches/react-native@0.83.10.patch
|
||||
braces@3.0.3: patches/braces@3.0.3.patch
|
||||
'@expo/cli@55.0.36': patches/@expo__cli@55.0.36.patch
|
||||
expo-router@55.0.18: patches/expo-router@55.0.18.patch
|
||||
expo-constants@55.0.17: patches/expo-constants@55.0.17.patch
|
||||
react-native-webview@14.0.1: patches/react-native-webview@14.0.1.patch
|
||||
react-native@0.88.1: patches/react-native@0.88.1.patch
|
||||
react-native-libsodium@1.7.0: patches/react-native-libsodium@1.7.0.patch
|
||||
deepmerge@4.3.1: patches/deepmerge@4.3.1.patch
|
||||
glob@13.0.6: patches/glob@13.0.6.patch
|
||||
minimatch@10.2.5: patches/minimatch@10.2.5.patch
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
import { createRequire } from 'node:module'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
const require = createRequire(import.meta.url)
|
||||
const expoRequire = createRequire(require.resolve('expo'))
|
||||
const cliRequire = createRequire(expoRequire.resolve('@expo/cli'))
|
||||
const zodRoot = dirname(cliRequire.resolve('zod/package.json'))
|
||||
|
||||
describe.each(['cjs', 'js'])('installed Expo Zod (%s)', (extension) => {
|
||||
it.each(['index', 'v3/index', 'v4/index'])(
|
||||
'rejects oversized collections before parsing elements in %s',
|
||||
async (entry) => {
|
||||
const path = join(zodRoot, `${entry}.${extension}`)
|
||||
const z = extension === 'cjs' ? require(path) : await import(pathToFileURL(path).href)
|
||||
let parsed = 0
|
||||
let refined = 0
|
||||
const element = z.preprocess((value: unknown) => {
|
||||
parsed += 1
|
||||
return value
|
||||
}, z.string())
|
||||
const cases = [
|
||||
{
|
||||
schema: z.array(element).max(2, 'too many'),
|
||||
oversized: Array(1_000).fill(0),
|
||||
valid: ['a', 'b']
|
||||
},
|
||||
{
|
||||
schema: z.array(element).length(2, 'too many'),
|
||||
oversized: Array(1_000).fill(0),
|
||||
valid: ['a', 'b']
|
||||
},
|
||||
{
|
||||
schema: z.set(element).max(2, 'too many'),
|
||||
oversized: new Set(Array.from({ length: 1_000 }, (_, i) => i)),
|
||||
valid: new Set(['a', 'b'])
|
||||
},
|
||||
{
|
||||
schema: z.set(element).size(2, 'too many'),
|
||||
oversized: new Set(Array.from({ length: 1_000 }, (_, i) => i)),
|
||||
valid: new Set(['a', 'b'])
|
||||
}
|
||||
]
|
||||
for (const { schema, oversized, valid } of cases) {
|
||||
const parent = z.object({ items: schema }).refine(() => {
|
||||
refined += 1
|
||||
return true
|
||||
})
|
||||
parsed = 0
|
||||
refined = 0
|
||||
for (const result of [
|
||||
parent.safeParse({ items: oversized }),
|
||||
await parent.safeParseAsync({ items: oversized })
|
||||
]) {
|
||||
expect(result.success).toBe(false)
|
||||
expect(result.error.issues).toEqual([
|
||||
expect.objectContaining({ code: 'too_big', path: ['items'], message: 'too many' })
|
||||
])
|
||||
}
|
||||
expect([parsed, refined]).toEqual([0, 0])
|
||||
expect(parent.parse({ items: valid })).toEqual({ items: valid })
|
||||
expect(await parent.parseAsync({ items: valid })).toEqual({ items: valid })
|
||||
expect(parsed).toBe(4)
|
||||
}
|
||||
expect(z.array(z.string()).max(2).safeParse([1]).success).toBe(false)
|
||||
expect(z.array(z.string()).length(2).safeParse(['a']).success).toBe(false)
|
||||
expect(
|
||||
z
|
||||
.set(z.string())
|
||||
.size(2)
|
||||
.safeParse(new Set(['a'])).success
|
||||
).toBe(false)
|
||||
if (entry === 'v4/index') {
|
||||
expect(
|
||||
z
|
||||
.array(z.number())
|
||||
.overwrite((items: number[]) => items.slice(0, 2))
|
||||
.max(2)
|
||||
.parse([1, 2, 3])
|
||||
).toEqual([1, 2])
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
it('protects the bundled Zod mini entrypoint', async () => {
|
||||
const path = join(zodRoot, `v4/mini/index.${extension}`)
|
||||
const z = extension === 'cjs' ? require(path) : await import(pathToFileURL(path).href)
|
||||
const schema = z.array(z.string()).check(z.maxLength(2))
|
||||
expect(z.safeParse(schema, [1, 2, 3]).error.issues).toEqual([
|
||||
expect.objectContaining({ code: 'too_big' })
|
||||
])
|
||||
expect((await z.safeParseAsync(schema, [1, 2, 3])).error.issues).toHaveLength(1)
|
||||
expect(z.parse(schema, ['a'])).toEqual(['a'])
|
||||
const map = z.map(z.string(), z.string()).check(z.maxSize(1))
|
||||
const oversized = new Map([
|
||||
[1, 1],
|
||||
[2, 2]
|
||||
])
|
||||
expect(z.safeParse(map, oversized).error.issues).toEqual([
|
||||
expect.objectContaining({ code: 'too_big' })
|
||||
])
|
||||
expect((await z.safeParseAsync(map, oversized)).error.issues).toHaveLength(1)
|
||||
expect(z.parse(map, new Map([['a', 'b']]))).toEqual(new Map([['a', 'b']]))
|
||||
})
|
||||
})
|
||||
@@ -88,7 +88,7 @@ const styles = themedStyleSheet(() => ({
|
||||
height: ADDRESS_FIELD_HEIGHT
|
||||
},
|
||||
fileLabelHost: {
|
||||
...StyleSheet.absoluteFillObject
|
||||
...StyleSheet.absoluteFill
|
||||
},
|
||||
fileLabel: {
|
||||
flex: 1,
|
||||
|
||||
@@ -31,7 +31,7 @@ export function MobileBrowserLoadFailure({ loadError }: { loadError: BrowserLoad
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
page: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: spacing.xl,
|
||||
|
||||
@@ -120,7 +120,7 @@ export function MobileBrowserLoadProgress({
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
clip: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
borderRadius: radii.control,
|
||||
overflow: 'hidden'
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* oxlint-disable react-doctor/no-adjust-state-on-prop-change -- Why: mobile browser state mirrors a remote desktop screencast session and CDP dialogs, which are external systems that cannot be derived during render. */
|
||||
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'
|
||||
import { AppState, type View } from 'react-native'
|
||||
import { AppState, type HostInstance } from 'react-native'
|
||||
import type { MobileBrowserTab } from '../session/tabs/mobile-session-tabs'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
@@ -114,7 +114,7 @@ export function MobileBrowserPane({
|
||||
}, [])
|
||||
|
||||
const setRootViewRef = useCallback(
|
||||
(node: View | null) => {
|
||||
(node: HostInstance | null) => {
|
||||
// Clear surface-owned long-press timers at ref cleanup to preserve unmount boundary.
|
||||
if (node === null) {
|
||||
clearLongPressTimer()
|
||||
|
||||
@@ -7,7 +7,8 @@ import {
|
||||
View,
|
||||
type PanResponderInstance,
|
||||
type StyleProp,
|
||||
type ViewStyle
|
||||
type ViewStyle,
|
||||
type HostInstance
|
||||
} from 'react-native'
|
||||
import { ArrowUp, ChevronLeft, ChevronRight, RefreshCw } from 'lucide-react-native'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
@@ -70,7 +71,7 @@ type MobileBrowserPaneViewProps = {
|
||||
setAddressValue: Dispatch<SetStateAction<string>>
|
||||
setKeyboardValue: Dispatch<SetStateAction<string>>
|
||||
setLayout: Dispatch<SetStateAction<BrowserTouchLayout | null>>
|
||||
setRootViewRef: (view: View | null) => void
|
||||
setRootViewRef: (view: HostInstance | null) => void
|
||||
tab: MobileBrowserTab
|
||||
togglePointerModifier: (modifier: BrowserPointerModifier) => void
|
||||
zoom: BrowserZoomState
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Image, View } from 'react-native'
|
||||
import type { HostInstance, ImageInstance } from 'react-native'
|
||||
import type { FrameLayer } from './mobile-browser-frame-state'
|
||||
|
||||
/** Told when a frame the pane has already handed to a layer is safe to show, or never will be. */
|
||||
@@ -8,7 +8,7 @@ export type BrowserFrameDisplayHandlers = {
|
||||
}
|
||||
|
||||
export function updateBrowserLayerVisibility(
|
||||
layers: [View | null, View | null],
|
||||
layers: [HostInstance | null, HostInstance | null],
|
||||
visible: FrameLayer
|
||||
): void {
|
||||
for (const [index, layer] of layers.entries()) {
|
||||
@@ -16,7 +16,7 @@ export function updateBrowserLayerVisibility(
|
||||
}
|
||||
}
|
||||
|
||||
export function updateBrowserImageSource(image: Image | null, uri: string): void {
|
||||
export function updateBrowserImageSource(image: ImageInstance | null, uri: string): void {
|
||||
// Write large frame strings directly to native Image to avoid rerendering whole tab per frame.
|
||||
const source = [{ uri }]
|
||||
image?.setNativeProps({ source, src: source })
|
||||
|
||||
@@ -3,11 +3,11 @@ import { createRequire } from 'node:module'
|
||||
import { act, createElement, type ComponentType } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { Image } from 'react-native'
|
||||
import type { ImageInstance } from 'react-native'
|
||||
import { updateBrowserImageSource as updateBrowserImageSourceOnWeb } from './browser-frame-layer-paint.web'
|
||||
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the point of the test is that a DOM node is what the native signature receives on RN Web, which is exactly the mismatch these siblings exist for.
|
||||
const asImageRef = (node: HTMLElement) => node as unknown as Image
|
||||
const asImageRef = (node: HTMLElement) => node as unknown as ImageInstance
|
||||
|
||||
// Find rendered frame element by its background and verify write lands there.
|
||||
describe('against a real react-native-web Image', () => {
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import type { Image, View } from 'react-native'
|
||||
import type { HostInstance, ImageInstance } from 'react-native'
|
||||
import type { FrameLayer } from './mobile-browser-frame-state'
|
||||
import type { BrowserFrameDisplayHandlers } from './browser-frame-layer-paint'
|
||||
|
||||
// RN Web refs are DOM nodes without setNativeProps; write Image’s first-child background and View opacity directly.
|
||||
// Sibling accessibility img is prop-driven and retains mount frame until a pane render updates it.
|
||||
function elementOf(node: Image | View | null): HTMLElement | null {
|
||||
function elementOf(node: ImageInstance | HostInstance | null): HTMLElement | null {
|
||||
return node instanceof HTMLElement ? node : null
|
||||
}
|
||||
|
||||
export function updateBrowserLayerVisibility(
|
||||
layers: [View | null, View | null],
|
||||
layers: [HostInstance | null, HostInstance | null],
|
||||
visible: FrameLayer
|
||||
): void {
|
||||
for (const [index, layer] of layers.entries()) {
|
||||
@@ -20,7 +20,7 @@ export function updateBrowserLayerVisibility(
|
||||
}
|
||||
}
|
||||
|
||||
export function updateBrowserImageSource(image: Image | null, uri: string): void {
|
||||
export function updateBrowserImageSource(image: ImageInstance | null, uri: string): void {
|
||||
const host = elementOf(image)
|
||||
if (host === null) {
|
||||
return
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Image, ImageLoadEvent, View } from 'react-native'
|
||||
import type { HostInstance, ImageInstance, ImageLoadEvent } from 'react-native'
|
||||
import type { BrowserScreencastFrame } from './browser-screencast-protocol'
|
||||
import { MOBILE_BROWSER_FRAME_MIN_INTERVAL_MS } from './browser-screencast-request'
|
||||
import type { FrameLayer } from './mobile-browser-frame-state'
|
||||
@@ -24,8 +24,8 @@ type BrowserFramePacerDeps = {
|
||||
|
||||
/** What one layer's `<View>` and `<Image>` hand the pacer. Stable, so binding them re-renders nothing. */
|
||||
export type BrowserFrameLayerBinding = {
|
||||
attachView: (view: View | null) => void
|
||||
attachImage: (image: Image | null) => void
|
||||
attachView: (view: HostInstance | null) => void
|
||||
attachImage: (image: ImageInstance | null) => void
|
||||
onLoad: (event: ImageLoadEvent) => void
|
||||
onError: () => void
|
||||
}
|
||||
@@ -33,8 +33,8 @@ export type BrowserFrameLayerBinding = {
|
||||
// Decode each frame on hidden layer, then flip opacity at most once per interval.
|
||||
// Write only changed sources to idle layers: unchanged sources emit no native answer. replace may overwrite loading layer; newest source answers.
|
||||
export function createBrowserFramePacer(deps: BrowserFramePacerDeps) {
|
||||
const views: [View | null, View | null] = [null, null]
|
||||
const images: [Image | null, Image | null] = [null, null]
|
||||
const views: [HostInstance | null, HostInstance | null] = [null, null]
|
||||
const images: [ImageInstance | null, ImageInstance | null] = [null, null]
|
||||
const layers: [LayerState, LayerState] = [
|
||||
{ uri: deps.initialUri, status: 'ready' },
|
||||
{ uri: deps.initialUri, status: 'ready' }
|
||||
|
||||
@@ -21,7 +21,7 @@ vi.mock('react-native', () => ({
|
||||
Platform: { OS: 'android' },
|
||||
Pressable: 'Pressable',
|
||||
StyleSheet: {
|
||||
absoluteFillObject: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },
|
||||
absoluteFill: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },
|
||||
create: (styles: unknown) => styles
|
||||
},
|
||||
Text: 'Text',
|
||||
|
||||
@@ -20,7 +20,7 @@ vi.mock('react-native', () => ({
|
||||
Platform: { OS: 'ios' },
|
||||
Pressable: 'Pressable',
|
||||
StyleSheet: {
|
||||
absoluteFillObject: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },
|
||||
absoluteFill: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },
|
||||
create: (styles: unknown) => styles
|
||||
},
|
||||
Text: 'Text',
|
||||
|
||||
@@ -27,7 +27,7 @@ export const mobileBrowserPaneStyles = themedStyleSheet(() => ({
|
||||
backgroundColor: colors.bgBase
|
||||
},
|
||||
browserImageHost: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
overflow: 'hidden'
|
||||
@@ -37,7 +37,7 @@ export const mobileBrowserPaneStyles = themedStyleSheet(() => ({
|
||||
height: '100%'
|
||||
},
|
||||
browserImageLayer: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center'
|
||||
},
|
||||
@@ -57,7 +57,7 @@ export const mobileBrowserPaneStyles = themedStyleSheet(() => ({
|
||||
backgroundColor: colors.bgBase
|
||||
},
|
||||
overlay: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
padding: spacing.xl,
|
||||
@@ -77,7 +77,7 @@ export const mobileBrowserPaneStyles = themedStyleSheet(() => ({
|
||||
overflow: 'hidden'
|
||||
},
|
||||
dialogOverlay: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
zIndex: 30,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ReactNode, RefObject } from 'react'
|
||||
import { Animated, ScrollView, StyleSheet, Text, View } from 'react-native'
|
||||
import { Animated, ScrollView, StyleSheet, Text, View, type HostInstance } from 'react-native'
|
||||
import { DetailCardFocusBoundary, DetailCardLayer } from './detail-card-host'
|
||||
import type { AnchoredDetailCardState } from './use-anchored-detail-card'
|
||||
import { useDetailCardMotion } from './use-detail-card-motion'
|
||||
@@ -38,7 +38,7 @@ export function AnchoredDetailCardLayer({
|
||||
card: AnchoredDetailCardState
|
||||
obscured: boolean
|
||||
/** Replaces the hook's layer ref, for a caller that also needs the node. */
|
||||
layerRef?: (view: View | null) => void
|
||||
layerRef?: (view: HostInstance | null) => void
|
||||
}): React.JSX.Element {
|
||||
const reducedMotion = useReducedMotionEnabled()
|
||||
return (
|
||||
@@ -69,7 +69,7 @@ export function AnchoredDetailCardLayer({
|
||||
)
|
||||
}
|
||||
|
||||
const layerStyle = { ...StyleSheet.absoluteFillObject, zIndex: 1000 }
|
||||
const layerStyle = { ...StyleSheet.absoluteFill, zIndex: 1000 }
|
||||
|
||||
/** Only the current motion may release the retained exit presentation. */
|
||||
function AnchoredDetailCard({
|
||||
@@ -95,7 +95,7 @@ function AnchoredDetailCard({
|
||||
motion: number
|
||||
bounds: { left: number; top: number; right: number; bottom: number }
|
||||
layerHeight: number
|
||||
contentRef: RefObject<View | null>
|
||||
contentRef: RefObject<HostInstance | null>
|
||||
boundaryRefs: RefObject<unknown[]>
|
||||
active: boolean
|
||||
obscured: boolean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRef } from 'react'
|
||||
import { ScrollView, StyleSheet, Text, View } from 'react-native'
|
||||
import { ScrollView, StyleSheet, Text, View, type ScrollViewInstance } from 'react-native'
|
||||
import type { ConnectionLogEntry } from '../diagnostics/connection/connection-log-types'
|
||||
import { colors, radii, spacing, typography } from '../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../theme/themed-styles'
|
||||
@@ -40,7 +40,7 @@ function formatTime(ts: number, baseTs: number): string {
|
||||
|
||||
export function ConnectionLog({ entries, title, fillAvailableHeight = false }: Props) {
|
||||
useMobileColorScheme()
|
||||
const scrollRef = useRef<ScrollView | null>(null)
|
||||
const scrollRef = useRef<ScrollViewInstance | null>(null)
|
||||
|
||||
if (entries.length === 0) {
|
||||
return null
|
||||
|
||||
@@ -133,7 +133,7 @@ const styles = themedStyleSheet(() => ({
|
||||
flex: 1
|
||||
},
|
||||
pendingOverlay: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: colors.bgBase,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import type { View } from 'react-native'
|
||||
import type { HostInstance } from 'react-native'
|
||||
import { ChevronLeft, MoreHorizontal } from 'lucide-react-native'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
|
||||
@@ -27,7 +27,7 @@ export function MobileDiffReviewHeader({
|
||||
}: Props) {
|
||||
const t = useMobileTranslation()
|
||||
useMobileColorScheme()
|
||||
const moreRef = useRef<View>(null)
|
||||
const moreRef = useRef<HostInstance>(null)
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { FlatList, Platform, Pressable, Text, View, type ViewStyle } from 'react-native'
|
||||
import {
|
||||
FlatList,
|
||||
Platform,
|
||||
Pressable,
|
||||
Text,
|
||||
View,
|
||||
type HostInstance,
|
||||
type ViewStyle
|
||||
} from 'react-native'
|
||||
import { Gesture, GestureDetector } from 'react-native-gesture-handler'
|
||||
import { UnfoldVertical } from 'lucide-react-native'
|
||||
import type { DiffComment } from '../../../src/shared/diff-comment-types'
|
||||
@@ -177,7 +185,7 @@ export function MobileDiffReviewLines({
|
||||
// The release that ends a pick also reaches the starting row as a tap; that tap must not replace the range.
|
||||
const pickConsumedTapRef = useRef(false)
|
||||
// Browsers decide on the first touchmove whether to scroll; once a pick is live, claim it so the drag isn't cancelled.
|
||||
const frameRef = useRef<View>(null)
|
||||
const frameRef = useRef<HostInstance>(null)
|
||||
useEffect(() => {
|
||||
const node: unknown = frameRef.current
|
||||
if (Platform.OS !== 'web' || !(node instanceof EventTarget)) {
|
||||
@@ -353,7 +361,7 @@ export function MobileDiffReviewLines({
|
||||
<Text style={[styles.truncatedText, viewportRow]}>
|
||||
{t('components.diffReviewBody.diffTruncated', 'Diff truncated for mobile preview.')}
|
||||
</Text>
|
||||
) : null
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { memo, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { ScrollView, StyleSheet, Text, type StyleProp, type TextStyle } from 'react-native'
|
||||
import {
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Text,
|
||||
type HostInstance,
|
||||
type StyleProp,
|
||||
type TextStyle
|
||||
} from 'react-native'
|
||||
import {
|
||||
loadMobileMathTypesetter,
|
||||
type MobileMathTypesetter
|
||||
@@ -58,7 +65,7 @@ export const MobileMarkdownMath = memo(function MobileMarkdownMath({
|
||||
() => typesetter?.(value, display, githubSizes) ?? null,
|
||||
[typesetter, value, display, githubSizes]
|
||||
)
|
||||
const hostRef = useRef<Text>(null)
|
||||
const hostRef = useRef<HostInstance>(null)
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const host = hostRef.current
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { useCallback, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||
import { ActivityIndicator, Pressable, ScrollView, Text, View } from 'react-native'
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
Text,
|
||||
View,
|
||||
type HostInstance
|
||||
} from 'react-native'
|
||||
import {
|
||||
ArrowRight,
|
||||
CircleCheck,
|
||||
@@ -333,7 +340,7 @@ export function MobilePRSidebar({ onRetry, bottomInset = 0, ...input }: SidebarP
|
||||
}
|
||||
]
|
||||
]
|
||||
const moreRef = useRef<View>(null)
|
||||
const moreRef = useRef<HostInstance>(null)
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
const close = () => setScreen(null)
|
||||
// The dock's drawer would otherwise take Back and close the whole PR panel from a pushed screen.
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
useState,
|
||||
type ForwardedRef
|
||||
} from 'react'
|
||||
import { View } from 'react-native'
|
||||
import { View, type HostInstance } from 'react-native'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import { colors } from '../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../theme/themed-styles'
|
||||
@@ -62,7 +62,7 @@ function MobileRichMarkdownEditorWebInner(
|
||||
) {
|
||||
const t = useMobileTranslation()
|
||||
const colorScheme = useMobileColorScheme()
|
||||
const hostRef = useRef<View>(null)
|
||||
const hostRef = useRef<HostInstance>(null)
|
||||
const documentRef = useRef<RichMarkdownWebDocument | null>(null)
|
||||
// Document reports ready synchronously during mount before documentRef exists; queue controller content/editable calls until handle arrives or editor stays empty.
|
||||
const beforeMountRef = useRef<((send: RichMarkdownEditorApi) => void)[]>([])
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { useEffect, useRef } from 'react'
|
||||
import {
|
||||
InteractionManager,
|
||||
Pressable,
|
||||
View,
|
||||
type StyleProp,
|
||||
type TextInput,
|
||||
type TextInputProps,
|
||||
type ViewStyle
|
||||
type ViewStyle,
|
||||
type TextInputInstance
|
||||
} from 'react-native'
|
||||
import { Search, X } from 'lucide-react-native'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
@@ -14,6 +13,7 @@ import { colors, radii, spacing } from '../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
|
||||
import { TextField } from './composer-input/TextField'
|
||||
import { runAfterInteractions } from '../platform/after-interactions'
|
||||
|
||||
// Delay focus until opening chrome settles; native autoFocus alone often shows caret without iOS/Android keyboard.
|
||||
const SEARCH_AUTO_FOCUS_DELAY_MS = 120
|
||||
@@ -57,7 +57,7 @@ export function MobileSearchField({
|
||||
}: MobileSearchFieldProps) {
|
||||
const t = useMobileTranslation()
|
||||
useMobileColorScheme()
|
||||
const inputRef = useRef<TextInput>(null)
|
||||
const inputRef = useRef<TextInputInstance>(null)
|
||||
const clearVisible = showClear ?? value.length > 0
|
||||
|
||||
useEffect(() => {
|
||||
@@ -67,7 +67,7 @@ export function MobileSearchField({
|
||||
|
||||
let timeout: ReturnType<typeof setTimeout> | undefined
|
||||
// Wait for press/layout completion before focusing so soft keyboard appears.
|
||||
const task = InteractionManager.runAfterInteractions(() => {
|
||||
const task = runAfterInteractions(() => {
|
||||
timeout = setTimeout(() => {
|
||||
inputRef.current?.focus()
|
||||
}, SEARCH_AUTO_FOCUS_DELAY_MS)
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { Pressable, ScrollView, Text, View, type StyleProp, type ViewStyle } from 'react-native'
|
||||
import {
|
||||
Pressable,
|
||||
ScrollView,
|
||||
Text,
|
||||
View,
|
||||
type ScrollViewInstance,
|
||||
type StyleProp,
|
||||
type ViewStyle
|
||||
} from 'react-native'
|
||||
import { triggerSelection } from '../platform/haptics'
|
||||
import { resolveTabStripScrollOffset } from '../session/tabs/tab-strip-scroll'
|
||||
import { colors, concentricRadius, feedback, radii, spacing } from '../theme/mobile-theme'
|
||||
@@ -38,7 +46,7 @@ type Props<Value extends string> = {
|
||||
export function MobileSegmentedControl<Value extends string>(props: Props<Value>) {
|
||||
useMobileColorScheme()
|
||||
const [trackWidth, setTrackWidth] = useState(0)
|
||||
const scrollRef = useRef<ScrollView>(null)
|
||||
const scrollRef = useRef<ScrollViewInstance>(null)
|
||||
const scrollX = useRef(0)
|
||||
const [widths] = useState(() => new Map<string, number>())
|
||||
const revealSelected = (): void => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useRef, type ComponentProps } from 'react'
|
||||
import type { TextInput } from 'react-native'
|
||||
import type { TextInputInstance } from 'react-native'
|
||||
import { TextField } from './composer-input/TextField'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
|
||||
@@ -16,7 +16,7 @@ export function MobileWorkspaceNameInput({
|
||||
...props
|
||||
}: MobileWorkspaceNameInputProps) {
|
||||
const t = useMobileTranslation()
|
||||
const inputRef = useRef<TextInput>(null)
|
||||
const inputRef = useRef<TextInputInstance>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!shouldAutoFocus) {
|
||||
|
||||
@@ -169,14 +169,14 @@ function MountedRightDrawer({
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
overlay: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
zIndex: 1000
|
||||
},
|
||||
root: {
|
||||
flex: 1
|
||||
},
|
||||
backdrop: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
backgroundColor: 'rgba(0,0,0,0.5)'
|
||||
},
|
||||
anchor: {
|
||||
|
||||
@@ -2,11 +2,10 @@ import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import {
|
||||
ActivityIndicator,
|
||||
FlatList,
|
||||
InteractionManager,
|
||||
Pressable,
|
||||
Text,
|
||||
TextInput,
|
||||
View
|
||||
View,
|
||||
type TextInputInstance
|
||||
} from 'react-native'
|
||||
import type { RpcClient } from '../transport/rpc/rpc-client-contract'
|
||||
import type { SmartWorkspaceSourceRow as SourceRow } from '../../../src/shared/new-workspace/smart-workspace-source-results'
|
||||
@@ -36,6 +35,7 @@ import { TextField } from './composer-input/TextField'
|
||||
import { SmartSourceModeIcon } from './SmartSourceModeIcon'
|
||||
import { SmartWorkspaceSourceRow } from './SmartWorkspaceSourceRow'
|
||||
import { SheetHeader } from './nav-bar/SheetHeader'
|
||||
import { runAfterInteractions } from '../platform/after-interactions'
|
||||
|
||||
// Delay focus like MobileSearchField: native autoFocus may not raise keyboard during drawer animation.
|
||||
const SOURCE_INPUT_FOCUS_DELAY_MS = 120
|
||||
@@ -76,7 +76,7 @@ export function SmartWorkspaceSourceDrawer({
|
||||
const availableModes = useMemo(() => resolveAvailableSmartModes(availability), [availability])
|
||||
const [mode, setMode] = useState<SmartNameMode>(() => resolveDefaultSmartMode(availability))
|
||||
const [mrStateFilter, setMrStateFilter] = useState<MrStateFilter>('opened')
|
||||
const inputRef = useRef<TextInput>(null)
|
||||
const inputRef = useRef<TextInputInstance>(null)
|
||||
// Reseed only on open so a recreated availability object cannot reset the picked mode.
|
||||
const [wasVisible, setWasVisible] = useState(visible)
|
||||
if (wasVisible !== visible) {
|
||||
@@ -92,7 +92,7 @@ export function SmartWorkspaceSourceDrawer({
|
||||
return
|
||||
}
|
||||
let timeout: ReturnType<typeof setTimeout> | undefined
|
||||
const task = InteractionManager.runAfterInteractions(() => {
|
||||
const task = runAfterInteractions(() => {
|
||||
timeout = setTimeout(() => {
|
||||
inputRef.current?.focus()
|
||||
}, SOURCE_INPUT_FOCUS_DELAY_MS)
|
||||
@@ -305,7 +305,7 @@ export function SmartWorkspaceSourceDrawer({
|
||||
'Type a workspace name in the field below.'
|
||||
)}
|
||||
</Text>
|
||||
) : null
|
||||
) : undefined
|
||||
}
|
||||
renderItem={({ item }) => (
|
||||
<SmartWorkspaceSourceRow row={item} onPress={() => handleSelectRow(item)} />
|
||||
|
||||
@@ -170,7 +170,7 @@ const styles = themedStyleSheet(() => ({
|
||||
pager: { overflow: 'hidden' },
|
||||
underlay: { position: 'absolute', top: 0, left: 0, right: 0 },
|
||||
page: { flexGrow: 1, backgroundColor: colors.sheetSurface },
|
||||
dim: { ...StyleSheet.absoluteFillObject, backgroundColor: '#000' },
|
||||
dim: { ...StyleSheet.absoluteFill, backgroundColor: '#000' },
|
||||
fill: { flex: 1, overflow: 'hidden' },
|
||||
fillPage: { ...StyleSheet.absoluteFillObject, backgroundColor: colors.bgBase }
|
||||
fillPage: { ...StyleSheet.absoluteFill, backgroundColor: colors.bgBase }
|
||||
}))
|
||||
|
||||
@@ -17,7 +17,7 @@ vi.mock('react-native', () => ({
|
||||
Platform: { OS: 'android', select: (options: { android?: unknown }) => options.android },
|
||||
Pressable: 'Pressable',
|
||||
ScrollView: 'ScrollView',
|
||||
StyleSheet: { create: <T,>(styles: T) => styles, absoluteFillObject: {} },
|
||||
StyleSheet: { create: <T,>(styles: T) => styles, absoluteFill: {} },
|
||||
View: 'View',
|
||||
useWindowDimensions: () => ({ width: 412, height: 900 })
|
||||
}))
|
||||
|
||||
@@ -4,18 +4,18 @@ import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
|
||||
export const bottomDrawerStyles = themedStyleSheet(() => ({
|
||||
overlay: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
zIndex: 1000
|
||||
},
|
||||
root: {
|
||||
flex: 1
|
||||
},
|
||||
backdrop: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
backgroundColor: 'rgba(0,0,0,0.55)'
|
||||
},
|
||||
backdropPressable: {
|
||||
...StyleSheet.absoluteFillObject
|
||||
...StyleSheet.absoluteFill
|
||||
},
|
||||
anchor: {
|
||||
flex: 1,
|
||||
|
||||
@@ -6,7 +6,8 @@ import {
|
||||
ScrollView,
|
||||
Keyboard,
|
||||
Modal,
|
||||
Platform
|
||||
Platform,
|
||||
type ScrollViewInstance
|
||||
} from 'react-native'
|
||||
import { GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'
|
||||
import Animated, { useSharedValue, useAnimatedStyle, withTiming } from 'react-native-reanimated'
|
||||
@@ -75,7 +76,7 @@ export function MountedBottomDrawer({
|
||||
const motion = useMemo(() => ({ progress, fade, reducedMotion }), [progress, fade, reducedMotion])
|
||||
const keyboardOffset = useSharedValue(0)
|
||||
const scrollOffsetY = useSharedValue(0)
|
||||
const scrollRef = useRef<ScrollView>(null)
|
||||
const scrollRef = useRef<ScrollViewInstance>(null)
|
||||
useEffect(() => {
|
||||
if (scrollResetKey !== null) {
|
||||
scrollRef.current?.scrollTo({ y: 0, animated: false })
|
||||
|
||||
@@ -8,7 +8,7 @@ vi.mock('react-native', () => ({
|
||||
Pressable: 'Pressable',
|
||||
Text: 'Text',
|
||||
View: 'View',
|
||||
StyleSheet: { create: <T,>(styles: T) => styles, absoluteFillObject: {} }
|
||||
StyleSheet: { create: <T,>(styles: T) => styles, absoluteFill: {} }
|
||||
}))
|
||||
vi.mock('../../platform/use-reduced-motion', () => ({ useReducedMotionEnabled: () => false }))
|
||||
vi.mock('./mounted-bottom-drawer', () => ({ MountedBottomDrawer: 'MountedBottomDrawer' }))
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import type { Ref } from 'react'
|
||||
import { TextInput, type StyleProp, type TextInputProps, type TextStyle } from 'react-native'
|
||||
import {
|
||||
TextInput,
|
||||
type StyleProp,
|
||||
type TextInputProps,
|
||||
type TextStyle,
|
||||
type TextInputInstance
|
||||
} from 'react-native'
|
||||
import { colors } from '../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { composerInputStyles as styles } from './composer-input-styles'
|
||||
@@ -9,7 +15,7 @@ type FieldTextInputProps = Omit<
|
||||
TextInputProps,
|
||||
'style' | 'placeholderTextColor' | 'selectionColor'
|
||||
> & {
|
||||
ref?: Ref<TextInput>
|
||||
ref?: Ref<TextInputInstance>
|
||||
/** Size, padding and type; the edge and focus ring are the field's own. */
|
||||
style?: StyleProp<TextStyle>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { useRef, type ReactNode, type RefObject } from 'react'
|
||||
import { TextInput, View, type StyleProp, type TextInputProps, type ViewStyle } from 'react-native'
|
||||
import {
|
||||
TextInput,
|
||||
View,
|
||||
type StyleProp,
|
||||
type TextInputProps,
|
||||
type ViewStyle,
|
||||
type TextInputInstance
|
||||
} from 'react-native'
|
||||
import { colors } from '../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
import { useTextInputContentHeight } from '../../platform/text-input-content-height'
|
||||
@@ -18,7 +25,7 @@ type MessageBoxProps = Omit<
|
||||
> & {
|
||||
value: string
|
||||
onChangeText: (text: string) => void
|
||||
inputRef?: RefObject<TextInput | null>
|
||||
inputRef?: RefObject<TextInputInstance | null>
|
||||
/** Shows the round Send button at the end of the action row. */
|
||||
onSend?: () => void
|
||||
canSend?: boolean
|
||||
@@ -55,7 +62,7 @@ export function MessageBox({
|
||||
...inputProps
|
||||
}: MessageBoxProps): React.JSX.Element {
|
||||
useMobileColorScheme()
|
||||
const ownRef = useRef<TextInput>(null)
|
||||
const ownRef = useRef<TextInputInstance>(null)
|
||||
const ref = inputRef ?? ownRef
|
||||
const contentHeight = useTextInputContentHeight(ref, value)
|
||||
const focus = useInputFocus({ onFocus, onBlur })
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
TextInput,
|
||||
View,
|
||||
type StyleProp,
|
||||
type TextInputInstance,
|
||||
type TextInputProps,
|
||||
type ViewStyle
|
||||
} from 'react-native'
|
||||
@@ -13,7 +14,7 @@ import { composerInputStyles as styles } from './composer-input-styles'
|
||||
import { useInputFocus } from './use-input-focus'
|
||||
|
||||
type TextFieldProps = Omit<TextInputProps, 'style' | 'placeholderTextColor' | 'selectionColor'> & {
|
||||
inputRef?: Ref<TextInput>
|
||||
inputRef?: Ref<TextInputInstance>
|
||||
/** An icon before the text, e.g. Search. */
|
||||
leading?: ReactNode
|
||||
/** A control after the text, e.g. a clear chip. */
|
||||
|
||||
@@ -55,7 +55,7 @@ vi.mock('react-native', () => ({
|
||||
Text: hosts.Text,
|
||||
Pressable: hosts.Pressable,
|
||||
TextInput: hosts.TextInput,
|
||||
StyleSheet: { create: <T,>(styles: T) => styles, absoluteFillObject: {} },
|
||||
StyleSheet: { create: <T,>(styles: T) => styles, absoluteFill: {} },
|
||||
Platform: { OS: 'ios', select: (options: Record<string, unknown>) => options.ios }
|
||||
}))
|
||||
vi.mock('./MobileSwitch', () => ({ MobileSwitch: hosts.Switch }))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ComponentType, Ref } from 'react'
|
||||
import { Pressable, type View } from 'react-native'
|
||||
import { Pressable, type HostInstance } from 'react-native'
|
||||
import { colors, feedback, radii } from '../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
@@ -9,7 +9,7 @@ export const NAV_BAR_BUTTON_SIZE = 36
|
||||
type IconProps = { size?: number; color?: string; strokeWidth?: number }
|
||||
|
||||
type NavBarButtonProps = {
|
||||
ref?: Ref<View>
|
||||
ref?: Ref<HostInstance>
|
||||
icon: ComponentType<IconProps>
|
||||
accessibilityLabel: string
|
||||
onPress: () => void
|
||||
|
||||
@@ -9,7 +9,8 @@ import {
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
useWindowDimensions
|
||||
useWindowDimensions,
|
||||
type HostInstance
|
||||
} from 'react-native'
|
||||
import { Check } from 'lucide-react-native'
|
||||
import { useReducedMotionEnabled } from '../../platform/use-reduced-motion'
|
||||
@@ -33,7 +34,7 @@ type Anchor = { top: number; right: number } | { bottom: number; right: number }
|
||||
type PullDownMenuProps = {
|
||||
visible: boolean
|
||||
/** The button the menu drops from. */
|
||||
anchorRef: RefObject<View | null>
|
||||
anchorRef: RefObject<HostInstance | null>
|
||||
/** Groups are separated by a thicker divider, like an iOS menu's sections. */
|
||||
groups: readonly (readonly ActionSheetAction[])[]
|
||||
onClose: () => void
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { memo, useEffect, useId, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||
import { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native'
|
||||
import { Pressable, ScrollView, StyleSheet, Text, View, type HostInstance } from 'react-native'
|
||||
import { Maximize2 } from 'lucide-react-native'
|
||||
import { colors, radii, spacing, typography, pressedStyle } from '../../theme/mobile-theme'
|
||||
import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme'
|
||||
@@ -24,7 +24,7 @@ export type MermaidDiagramProps = {
|
||||
// Source is a JS string argument, never inline-script interpolation.
|
||||
export const MermaidDiagram = memo(function MermaidDiagram({ source, base }: MermaidDiagramProps) {
|
||||
const colorScheme = useMobileColorScheme()
|
||||
const hostRef = useRef<View>(null)
|
||||
const hostRef = useRef<HostInstance>(null)
|
||||
// Remember failing source, not flag, so next source need not clear failure through effect.
|
||||
const [failedSource, setFailedSource] = useState<string | null>(null)
|
||||
// Sanitize React id for CSS identifier because mermaid embeds #id rules; do not assume React’s current _R_0_ spelling.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
|
||||
import { ActivityIndicator, Pressable, Text, View, type HostInstance } from 'react-native'
|
||||
import {
|
||||
Copy,
|
||||
CircleX,
|
||||
@@ -58,7 +58,7 @@ export function PrCheckFailureRow({
|
||||
const [showLog, setShowLog] = useState(false)
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
const [copyFailed, setCopyFailed] = useState(false)
|
||||
const menuRef = useRef<View>(null)
|
||||
const menuRef = useRef<HostInstance>(null)
|
||||
const details = entry?.status === 'loaded' ? entry.details : null
|
||||
const content = details ? presentCheckDetail(details) : null
|
||||
const annotation = content?.annotations[0] ?? null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useMemo, useRef, useState } from 'react'
|
||||
import { Pressable, ScrollView, Text, View } from 'react-native'
|
||||
import { Pressable, ScrollView, Text, View, type HostInstance } from 'react-native'
|
||||
import { Bot, ListFilter } from 'lucide-react-native'
|
||||
import { colors, pressedStyle, spacing, typography } from '../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
@@ -49,7 +49,7 @@ export function PrCommentsScreen({ tab, onBack, bottomInset = 0, onOpenFile }: S
|
||||
)
|
||||
const [hideBots, setHideBots] = useState(false)
|
||||
const [filterMenuOpen, setFilterMenuOpen] = useState(false)
|
||||
const filterRef = useRef<View>(null)
|
||||
const filterRef = useRef<HostInstance>(null)
|
||||
const [showResolved, setShowResolved] = useState(false)
|
||||
const [resolvedLimit, setResolvedLimit] = useState(COMMENT_PAGE)
|
||||
const [openThreadId, setOpenThreadId] = useState<string | null>(null)
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import { ActivityIndicator, Pressable, StyleSheet, Text, View } from 'react-native'
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
Text,
|
||||
View,
|
||||
type HostInstance
|
||||
} from 'react-native'
|
||||
import {
|
||||
ExternalLink,
|
||||
FileText,
|
||||
@@ -92,7 +99,7 @@ export function PrThreadRow({
|
||||
const [editing, setEditing] = useState(false)
|
||||
const [confirmDelete, setConfirmDelete] = useState(false)
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
const menuRef = useRef<View>(null)
|
||||
const menuRef = useRef<HostInstance>(null)
|
||||
const root = getPRCommentGroupRoot(group)
|
||||
const replies = group.kind === 'thread' ? group.replies : []
|
||||
const lastReply = replies.at(-1)
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { useCallback, useLayoutEffect, useReducer, useRef, useState } from 'react'
|
||||
import { useWindowDimensions, type LayoutChangeEvent, type View } from 'react-native'
|
||||
import { useWindowDimensions, type LayoutChangeEvent } from 'react-native'
|
||||
import type { DetailCardAnchor, DetailCardPlacement } from './AnchoredDetailCard'
|
||||
import { useBackClaim } from '../navigation/use-back-claim'
|
||||
import { useWindowSafeAreaInsets } from '../layout/side-safe-area'
|
||||
import type { MobileHostHandle } from '../platform/host-handle'
|
||||
|
||||
type State = {
|
||||
serial: number
|
||||
@@ -74,10 +75,10 @@ export function useAnchoredDetailCard({
|
||||
obscured: boolean
|
||||
measure: DetailCardMeasure
|
||||
}) {
|
||||
const layerRef = useRef<View>(null)
|
||||
const openerRef = useRef<View>(null)
|
||||
const contentRef = useRef<View>(null)
|
||||
const backRef = useRef<View>(null)
|
||||
const layerRef = useRef<MobileHostHandle>(null)
|
||||
const openerRef = useRef<MobileHostHandle>(null)
|
||||
const contentRef = useRef<MobileHostHandle>(null)
|
||||
const backRef = useRef<MobileHostHandle>(null)
|
||||
const boundaryRefs = useRef<unknown[]>([])
|
||||
const measureRef = useRef(measure)
|
||||
useLayoutEffect(() => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useLayoutEffect, useState, type RefObject } from 'react'
|
||||
import { Animated, Easing, type View } from 'react-native'
|
||||
import { Animated, Easing, type HostInstance } from 'react-native'
|
||||
import { commitDetailCardExit } from './detail-card-host'
|
||||
|
||||
export type DetailCardMotionOptions = {
|
||||
contentRef: RefObject<View | null>
|
||||
contentRef: RefObject<HostInstance | null>
|
||||
motion: number
|
||||
target: 0 | 1
|
||||
slide: boolean
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import { useCallback, useState, type ReactNode } from 'react'
|
||||
import { View, Text, Pressable, ScrollView, ActivityIndicator } from 'react-native'
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
ActivityIndicator,
|
||||
type HostInstance
|
||||
} from 'react-native'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import {
|
||||
ChevronDown,
|
||||
@@ -47,7 +54,7 @@ export function TroubleshootView({
|
||||
onConnectionLog,
|
||||
developerRow
|
||||
}: {
|
||||
rootRef?: (node: View | null) => void
|
||||
rootRef?: (node: HostInstance | null) => void
|
||||
diagnosticStatus: DiagnosticStatus
|
||||
checks: CheckResult[]
|
||||
hostEndpoints: readonly string[]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import type { View } from 'react-native'
|
||||
import type { HostInstance } from 'react-native'
|
||||
import { Platform } from 'react-native'
|
||||
import { useMobileTranslation } from '../i18n/use-mobile-translation'
|
||||
import { loadHostCatalog, loadHosts } from '../host-catalog/host-store'
|
||||
@@ -37,7 +37,7 @@ export function useTroubleshootDiagnostics() {
|
||||
}
|
||||
}, [])
|
||||
|
||||
const rootRef = useCallback((node: View | null): void => {
|
||||
const rootRef = useCallback((node: HostInstance | null): void => {
|
||||
if (node !== null) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useState, type Ref } from 'react'
|
||||
import { ActivityIndicator, Pressable, Text, View } from 'react-native'
|
||||
import { ActivityIndicator, Pressable, Text, View, type HostInstance } from 'react-native'
|
||||
import { CircleAlert, Laptop, Mic, RotateCcw, Smartphone, Square, X } from 'lucide-react-native'
|
||||
import type { MobileDictationMeter } from '../hooks/mobile-dictation-meter'
|
||||
import type { MobileDictationEngineShown } from '../hooks/mobile-dictation-session-state'
|
||||
@@ -32,7 +32,7 @@ export function MobileDictationCancelButton({
|
||||
discards = false
|
||||
}: {
|
||||
onCancel: () => void
|
||||
targetRef?: Ref<View>
|
||||
targetRef?: Ref<HostInstance>
|
||||
compact?: boolean
|
||||
// After a failure, ✕ throws the kept recording away.
|
||||
discards?: boolean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, type RefObject } from 'react'
|
||||
import type { GestureResponderEvent, View } from 'react-native'
|
||||
import type { GestureResponderEvent, HostInstance } from 'react-native'
|
||||
import { measurePageBox, type PageBox } from '../platform/page-box'
|
||||
|
||||
// A dragging finger lands less precisely than a tap, so the drop zone reaches past ✕.
|
||||
@@ -16,7 +16,7 @@ function contains(box: PageBox, x: number, y: number): boolean {
|
||||
|
||||
// Hold mode: letting go of the mic over ✕ cancels instead of inserting, like a voice note.
|
||||
export function useMobileDictationCancelDrop(
|
||||
cancelRef: RefObject<View | null> | undefined,
|
||||
cancelRef: RefObject<HostInstance | null> | undefined,
|
||||
onCancel: (() => void) | undefined,
|
||||
onRelease: (() => void) | undefined
|
||||
): (event: GestureResponderEvent) => void {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { Platform, ScrollView, Text, View } from 'react-native'
|
||||
import { Platform, ScrollView, Text, View, type ScrollViewInstance } from 'react-native'
|
||||
import type {
|
||||
AttachmentTextSource,
|
||||
AttachmentTextWindow
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
import { AttachmentTextViewport } from '../../../src/shared/attachment-text/attachment-text-viewport'
|
||||
import { chatAttachmentPreviewStyles as styles } from './mobile-file-preview-styles'
|
||||
|
||||
function scrollElement(view: ScrollView | null): HTMLElement | null {
|
||||
function scrollElement(view: ScrollViewInstance | null): HTMLElement | null {
|
||||
if (Platform.OS !== 'web') {
|
||||
return null
|
||||
}
|
||||
@@ -27,8 +27,8 @@ export function AttachmentTextScrollView({
|
||||
revision: number
|
||||
demand: (window: AttachmentTextWindow) => void
|
||||
}) {
|
||||
const scroll = useRef<ScrollView>(null)
|
||||
const viewport = useRef<ScrollView>(null)
|
||||
const scroll = useRef<ScrollViewInstance>(null)
|
||||
const viewport = useRef<ScrollViewInstance>(null)
|
||||
const nativeOffset = useRef(0)
|
||||
const [position, setPosition] = useState({ height: 0, rowHeight: 19 })
|
||||
const measured = useMemo(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useRef } from 'react'
|
||||
import { ScrollView, Text } from 'react-native'
|
||||
import { ScrollView, Text, type ScrollViewInstance } from 'react-native'
|
||||
import { MobileSyntaxSegments } from '../components/MobileSyntaxSegments'
|
||||
import { formatPreviewByteLength } from './mobile-file-preview-request'
|
||||
import { scrollOffsetForPreviewLine } from './mobile-file-preview-line-column'
|
||||
@@ -23,7 +23,7 @@ export function MobileFilePreviewSourceText({
|
||||
}) {
|
||||
useMobileColorScheme()
|
||||
const t = useMobileTranslation()
|
||||
const scrollRef = useRef<ScrollView>(null)
|
||||
const scrollRef = useRef<ScrollViewInstance>(null)
|
||||
const revealedRef = useRef(false)
|
||||
const syntax = useMemo(
|
||||
() => buildMobileFilePreviewSyntax(relativePath, content),
|
||||
|
||||
@@ -16,7 +16,7 @@ const MOBILE_IMAGE_READ_CHUNK_BYTES = 256 * 1024
|
||||
|
||||
type MobileImageFileHandle = {
|
||||
readonly size: number | null
|
||||
readBytes(length: number): Uint8Array
|
||||
readBytesSync(length: number): Uint8Array
|
||||
close(): void
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export async function readUriAsBase64(
|
||||
MOBILE_IMAGE_READ_CHUNK_BYTES,
|
||||
CLIPBOARD_IMAGE_MAX_SOURCE_BYTES - bytesRead + 1
|
||||
)
|
||||
const bytes = handle.readBytes(requested)
|
||||
const bytes = handle.readBytesSync(requested)
|
||||
if (bytes.byteLength === 0) {
|
||||
break
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
WifiOff
|
||||
} from 'lucide-react-native'
|
||||
import { useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
|
||||
import { ActivityIndicator, ScrollView, Text, View } from 'react-native'
|
||||
import { ActivityIndicator, ScrollView, Text, View, type HostInstance } from 'react-native'
|
||||
import {
|
||||
AGENT_LIST_GROUP_BY_CHOICES,
|
||||
agentListRowsIn,
|
||||
@@ -61,7 +61,7 @@ export function MobileHomeAgentsTab(props: {
|
||||
const [query, setQuery] = useState('')
|
||||
const [pickedHost, setPickedHost] = useState<string | null>(null)
|
||||
const [menu, setMenu] = useState<'closed' | 'options' | 'group-by'>('closed')
|
||||
const optionsRef = useRef<View>(null)
|
||||
const optionsRef = useRef<HostInstance>(null)
|
||||
// An unpaired desktop's filter falls back to every desktop.
|
||||
const hostFilter = hosts.some((host) => host.id === pickedHost) ? pickedHost : null
|
||||
const { now } = data.agentList
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { LucideIcon } from 'lucide-react-native'
|
||||
import { useState, type ReactNode, type Ref } from 'react'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import { Pressable, Text, View, type HostInstance } from 'react-native'
|
||||
import Animated from 'react-native-reanimated'
|
||||
import { colors, radii, spacing } from '../../theme/mobile-theme'
|
||||
import { themedStyleSheet } from '../../theme/themed-styles'
|
||||
@@ -21,7 +21,7 @@ export function MobileHomeTabHeader(props: { title: string; trailing?: ReactNode
|
||||
|
||||
export function MobileHomeTabHeaderButton(props: {
|
||||
/** The anchor a pull-down menu drops from. */
|
||||
ref?: Ref<View>
|
||||
ref?: Ref<HostInstance>
|
||||
icon: LucideIcon
|
||||
accessibilityLabel: string
|
||||
disabled?: boolean
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react'
|
||||
import { AppState, type AppStateStatus } from 'react-native'
|
||||
import { currentAppStateStatus } from '../platform/app-state-status'
|
||||
|
||||
const appStateListeners = new Set<() => void>()
|
||||
// Read on first subscribe, so importing this module never touches AppState.
|
||||
@@ -9,7 +10,7 @@ let appStateSubscription: ReturnType<typeof AppState.addEventListener> | null =
|
||||
function subscribeToAppState(listener: () => void): () => void {
|
||||
appStateListeners.add(listener)
|
||||
if (!appStateSubscription) {
|
||||
currentAppState = AppState.currentState
|
||||
currentAppState = currentAppStateStatus()
|
||||
appStateSubscription = AppState.addEventListener('change', (nextState) => {
|
||||
currentAppState = nextState
|
||||
appStateListeners.forEach((notify) => notify())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useRef, useState } from 'react'
|
||||
import { Pressable, Text, View } from 'react-native'
|
||||
import { Pressable, Text, type HostInstance } from 'react-native'
|
||||
import {
|
||||
CalendarClock,
|
||||
ChevronLeft,
|
||||
@@ -95,7 +95,7 @@ export function HostScreenHeader({
|
||||
onHideSidebar,
|
||||
router
|
||||
} = controller
|
||||
const moreRef = useRef<View>(null)
|
||||
const moreRef = useRef<HostInstance>(null)
|
||||
const [menuOpen, setMenuOpen] = useState(false)
|
||||
const showRefreshLine = useRefreshHint(controller.catalog.revalidating)
|
||||
const disconnected = connState !== 'connected'
|
||||
|
||||
@@ -279,7 +279,7 @@ export function HostWorkspaceList({
|
||||
) : null}
|
||||
</>
|
||||
}
|
||||
ListFooterComponent={listState}
|
||||
ListFooterComponent={listState ?? undefined}
|
||||
onScroll={pageTitle?.collapsing.onScroll}
|
||||
{...pageTitle?.collapsing.touchHandlers}
|
||||
scrollEventThrottle={16}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { useWindowDimensions, type View } from 'react-native'
|
||||
import { useWindowDimensions, type HostInstance } from 'react-native'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import type { ReservedRect } from '../../modules/orca-reserved-regions/src'
|
||||
import { useReservedRegions } from './reserved-regions'
|
||||
import { topChromeSpace } from './top-chrome-space'
|
||||
|
||||
export function useTopChromeSpace() {
|
||||
const ref = useRef<View>(null)
|
||||
const ref = useRef<HostInstance>(null)
|
||||
const [frame, setFrame] = useState<ReservedRect | null>(null)
|
||||
const dimensions = useWindowDimensions()
|
||||
const { top } = useSafeAreaInsets()
|
||||
|
||||
@@ -107,7 +107,7 @@ const styles = themedStyleSheet(() => ({
|
||||
backgroundColor: colors.bgRaised
|
||||
},
|
||||
fill: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
backgroundColor: colors.textSecondary,
|
||||
transformOrigin: 'left'
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ vi.mock('react-native', () => ({
|
||||
},
|
||||
StyleSheet: {
|
||||
create: (styles: unknown) => styles,
|
||||
absoluteFillObject: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }
|
||||
absoluteFill: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }
|
||||
},
|
||||
Text: 'Text',
|
||||
View: 'View'
|
||||
|
||||
@@ -78,7 +78,7 @@ export function ShellPageCover({ label, visible }: { label: string; visible: boo
|
||||
|
||||
const styles = themedStyleSheet(() => ({
|
||||
cover: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
backgroundColor: colors.bgBase,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { AppState, type AppStateStatus } from 'react-native'
|
||||
import { currentAppStateStatus } from '../platform/app-state-status'
|
||||
|
||||
function outsideForeground(state: AppStateStatus): boolean {
|
||||
function outsideForeground(state: AppStateStatus | null): boolean {
|
||||
return state === 'background' || state === 'inactive'
|
||||
}
|
||||
|
||||
@@ -17,7 +18,7 @@ export function setForegroundTimer(run: () => void, delayMs: number): () => void
|
||||
handle ??= setTimeout(() => {
|
||||
handle = null
|
||||
// A fire queued behind a not-yet-delivered background change must wait for the next activation.
|
||||
if (outsideForeground(AppState.currentState)) {
|
||||
if (outsideForeground(currentAppStateStatus())) {
|
||||
return
|
||||
}
|
||||
subscription.remove()
|
||||
@@ -31,7 +32,7 @@ export function setForegroundTimer(run: () => void, delayMs: number): () => void
|
||||
arm()
|
||||
}
|
||||
})
|
||||
if (!outsideForeground(AppState.currentState)) {
|
||||
if (!outsideForeground(currentAppStateStatus())) {
|
||||
arm()
|
||||
}
|
||||
return () => {
|
||||
|
||||
@@ -70,12 +70,12 @@ export function createExpoGenerationFileSystem(rootUri: string): GenerationFileS
|
||||
async writeBytes(uri, bytes) {
|
||||
const file = new File(uri)
|
||||
file.create({ intermediates: true, overwrite: true })
|
||||
file.write(bytes)
|
||||
file.writeSync(bytes)
|
||||
},
|
||||
async writeText(uri, text) {
|
||||
const file = new File(uri)
|
||||
file.create({ intermediates: true, overwrite: true })
|
||||
file.write(text)
|
||||
file.writeSync(text)
|
||||
},
|
||||
async readText(uri) {
|
||||
const file = new File(uri)
|
||||
@@ -114,7 +114,7 @@ export function createExpoGenerationFileSystem(rootUri: string): GenerationFileS
|
||||
const target = new File(toUri)
|
||||
// iOS copies only into an existing directory.
|
||||
target.parentDirectory.create({ intermediates: true, idempotent: true })
|
||||
new File(fromUri).copy(target)
|
||||
new File(fromUri).copySync(target)
|
||||
},
|
||||
async delete(uri) {
|
||||
const directory = new Directory(uri)
|
||||
@@ -133,7 +133,7 @@ export function createExpoGenerationFileSystem(rootUri: string): GenerationFileS
|
||||
if (Platform.OS === 'android' && Number(Platform.Version) < 26) {
|
||||
const to = new Directory(toUri)
|
||||
try {
|
||||
from.copy(to)
|
||||
from.copySync(to)
|
||||
} catch (error) {
|
||||
// Readers trust a generation by its manifest, so a failed copy must leave no partial tree.
|
||||
if (to.exists) {
|
||||
@@ -144,10 +144,10 @@ export function createExpoGenerationFileSystem(rootUri: string): GenerationFileS
|
||||
from.delete()
|
||||
return
|
||||
}
|
||||
from.move(new Directory(toUri))
|
||||
from.moveSync(new Directory(toUri))
|
||||
},
|
||||
async moveFile(fromUri, toUri) {
|
||||
new File(fromUri).move(new File(toUri))
|
||||
new File(fromUri).moveSync(new File(toUri))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ export function screenModuleMocks(dependencies: ScreenDependencies) {
|
||||
Pressable: 'Pressable',
|
||||
StyleSheet: {
|
||||
create: (styles: unknown) => styles,
|
||||
absoluteFillObject: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }
|
||||
absoluteFill: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }
|
||||
},
|
||||
Text: 'Text',
|
||||
View: 'View',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState, type RefObject } from 'react'
|
||||
import { useWindowDimensions, type LayoutChangeEvent, type View } from 'react-native'
|
||||
import { useWindowDimensions, type LayoutChangeEvent, type HostInstance } from 'react-native'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
import { useSideRailStrip, useSideRailDirectionPadAvailable } from '../layout/side-rail'
|
||||
import { pageOcclusions, type BridgePageGeometry } from './bridge/bridge-page-geometry'
|
||||
@@ -20,7 +20,7 @@ export function usePageFoldDivision(): {
|
||||
division: BridgeFoldDivision | null
|
||||
geometry: BridgePageGeometry
|
||||
safeAreaInsets: BridgeSafeAreaInsets
|
||||
rootRef: RefObject<View | null>
|
||||
rootRef: RefObject<HostInstance | null>
|
||||
onRootLayout: () => void
|
||||
onShellLayout: (event: LayoutChangeEvent) => void
|
||||
} {
|
||||
@@ -28,7 +28,7 @@ export function usePageFoldDivision(): {
|
||||
const strip = useSideRailStrip()
|
||||
const sideRail = strip !== null
|
||||
const directionPadAvailable = useSideRailDirectionPadAvailable()
|
||||
const rootRef = useRef<View>(null)
|
||||
const rootRef = useRef<HostInstance>(null)
|
||||
const layoutRef = useRef<WindowFrame | null>(null)
|
||||
const [frame, setFrame] = useState<WindowFrame | null>(null)
|
||||
const measure = useCallback(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Run Expo Router’s actual routing module: canGoBack reads committed state while back queues work, a timing gap mocks would hide.
|
||||
// Run Expo Router’s actual imperative router: canGoBack reads committed state while back queues work, a timing gap mocks would hide.
|
||||
import { readFileSync } from 'node:fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import { dirname, join } from 'node:path'
|
||||
@@ -10,22 +10,31 @@ import type { BridgeNavigateBackOutcome } from './bridge-host-contract'
|
||||
type RoutingModule = {
|
||||
canGoBack: () => boolean
|
||||
goBack: () => void
|
||||
routingQueue: { run: (ref: unknown) => void }
|
||||
drain: () => void
|
||||
}
|
||||
|
||||
type NavigationRef = {
|
||||
current: { canGoBack: () => boolean; dispatch: (action: { type: string }) => void }
|
||||
}
|
||||
|
||||
type QueuedIntent = { type: string; payload?: { action?: { type: string } } }
|
||||
type ImperativeRouterFactory = (
|
||||
enqueue: (intent: QueuedIntent) => void,
|
||||
setTransitionMode: (mode: string) => void
|
||||
) => { canGoBack: () => boolean; goBack: () => void }
|
||||
|
||||
const requireFrom = createRequire(import.meta.url)
|
||||
|
||||
// Expo Router 58 builds the imperative router over an intent queue; queue intents here and drain them on demand.
|
||||
function loadRoutingModule(ref: NavigationRef): RoutingModule {
|
||||
const root = dirname(requireFrom.resolve('expo-router/package.json'))
|
||||
const source = readFileSync(join(root, 'build/global-state/routing.js'), 'utf8')
|
||||
const loaded: { exports: Partial<RoutingModule> } = { exports: {} }
|
||||
const source = readFileSync(join(root, 'build/global-state/router.js'), 'utf8')
|
||||
const loaded: { exports: { createImperativeRouter?: ImperativeRouterFactory } } = {
|
||||
exports: {}
|
||||
}
|
||||
const stubs: Record<string, unknown> = {
|
||||
'expo/dom': { IS_DOM: false },
|
||||
'./router-store': { store: { navigationRef: { isReady: () => true, ...ref } } },
|
||||
'./navigationRef': { navigationRef: ref },
|
||||
'../domComponents/emitDomEvent': { emitDomGoBack: () => false }
|
||||
}
|
||||
new Function('require', 'exports', 'module', source)(
|
||||
@@ -33,12 +42,27 @@ function loadRoutingModule(ref: NavigationRef): RoutingModule {
|
||||
loaded.exports,
|
||||
loaded
|
||||
)
|
||||
const { canGoBack, goBack, routingQueue } = loaded.exports
|
||||
const { createImperativeRouter } = loaded.exports
|
||||
// Read exports at runtime so Expo upgrades renaming them fail here instead of as unrelated navigationRef errors later.
|
||||
if (canGoBack === undefined || goBack === undefined || routingQueue === undefined) {
|
||||
throw new Error('the routing module did not define canGoBack, goBack and routingQueue')
|
||||
if (createImperativeRouter === undefined) {
|
||||
throw new Error('the router module did not define createImperativeRouter')
|
||||
}
|
||||
const queue: QueuedIntent[] = []
|
||||
const imperative = createImperativeRouter(
|
||||
(intent) => queue.push(intent),
|
||||
() => {}
|
||||
)
|
||||
return {
|
||||
canGoBack: imperative.canGoBack,
|
||||
goBack: () => imperative.goBack(),
|
||||
drain: () => {
|
||||
for (const intent of queue.splice(0)) {
|
||||
if (intent.type === 'ACTION' && intent.payload?.action) {
|
||||
ref.current.dispatch(intent.payload.action)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return { canGoBack, goBack, routingQueue }
|
||||
}
|
||||
|
||||
function stackRef(screens: string[]): NavigationRef {
|
||||
@@ -143,7 +167,7 @@ function mount(screens: string[]): Harness {
|
||||
},
|
||||
screens,
|
||||
drain: () => {
|
||||
routing.routingQueue.run(ref)
|
||||
routing.drain()
|
||||
},
|
||||
commitRoute: (pathname) => {
|
||||
router.pathname = pathname
|
||||
|
||||
@@ -20,18 +20,22 @@ import {
|
||||
// Expo native-stack’s web view ignores animation and switches display; reuse StackRouter with a view that retains popped screens through their exit slide.
|
||||
export function HostStack({ animation }: { animation: HostStackAnimation }) {
|
||||
useMobileTranslation()
|
||||
const router = useShellOpenTarget()
|
||||
useReportedPageLocation()
|
||||
return (
|
||||
<Navigator router={router}>
|
||||
<Navigator>
|
||||
{HOST_STACK_SCREENS.map(({ name, title }) => (
|
||||
<Navigator.Screen key={name} name={name} options={{ title }} />
|
||||
))}
|
||||
<HostStackView animation={animation} />
|
||||
<HostStackContent animation={animation} />
|
||||
</Navigator>
|
||||
)
|
||||
}
|
||||
|
||||
// Mount the view on the stack the shell's open target leaves, so it starts with only the target drawn.
|
||||
function HostStackContent({ animation }: { animation: HostStackAnimation }) {
|
||||
return useShellOpenTarget() ? null : <HostStackView animation={animation} />
|
||||
}
|
||||
|
||||
type NavigatorContext = ReturnType<typeof Navigator.useContext>
|
||||
type Descriptors = NavigatorContext['descriptors']
|
||||
type Routes = NavigatorContext['state']['routes']
|
||||
@@ -194,7 +198,7 @@ const styles = themedStyleSheet(() => ({
|
||||
overflow: 'hidden'
|
||||
},
|
||||
screen: {
|
||||
...StyleSheet.absoluteFillObject,
|
||||
...StyleSheet.absoluteFill,
|
||||
backgroundColor: colors.bgBase
|
||||
},
|
||||
transparent: {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { execFileSync } from 'node:child_process'
|
||||
import { createRequire } from 'node:module'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
// Check named exports in plain Node: Vitest interop can hide missing query-string 9.x names used by Expo/React Navigation.
|
||||
describe('query-string, as expo-router resolves it', () => {
|
||||
it('exposes the named API the namespace import needs', () => {
|
||||
const requireFromHere = createRequire(import.meta.url)
|
||||
const requireFromExpoRouter = createRequire(requireFromHere.resolve('expo-router/package.json'))
|
||||
const entry = pathToFileURL(requireFromExpoRouter.resolve('query-string')).href
|
||||
const script = `const ns = await import(${JSON.stringify(entry)}); process.stdout.write(JSON.stringify({ stringified: ns.stringify({ from: 'worktrees', hostId: 'host/one' }), parsed: ns.parse('from=worktrees&hostId=host%2Fone') }))`
|
||||
const output = execFileSync(process.execPath, ['--input-type=module', '-e', script], {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
const { stringified, parsed } = JSON.parse(output)
|
||||
expect(stringified).toBe('from=worktrees&hostId=host%2Fone')
|
||||
expect(parsed).toEqual({ from: 'worktrees', hostId: 'host/one' })
|
||||
})
|
||||
})
|
||||
@@ -19,9 +19,12 @@ function pathnameOf(href: string): string {
|
||||
export type RouteHandoffOutcome = 'local' | 'handed-off' | 'refused'
|
||||
|
||||
// Inspect parameter tuples: assignability alone treats no-arg back/dismissAll/reload as href-taking functions.
|
||||
// Require the first parameter to accept any href so string-literal options (setTransitionMode) do not count.
|
||||
type TakesHref<TMember> = TMember extends (...args: infer TArgs) => unknown
|
||||
? TArgs extends [RouterHref, ...unknown[]]
|
||||
? true
|
||||
? RouterHref extends TArgs[0]
|
||||
? true
|
||||
: false
|
||||
: false
|
||||
: false
|
||||
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { useNavigationContainerRef, useRouter } from 'expo-router'
|
||||
// Expo Router's own stack router, the one Navigator falls back to; not re-exported from the package root.
|
||||
import { StackRouter } from 'expo-router/build/layouts/StackClient'
|
||||
// The store router.push resolves hrefs through; reading it keeps one resolver for both open paths.
|
||||
import { store } from 'expo-router/build/global-state/router-store'
|
||||
import { use, useEffect, useLayoutEffect, useState } from 'react'
|
||||
import { Navigator, useNavigationContainerRef, useRouter } from 'expo-router'
|
||||
// The resolver and linking config router.push goes through; reading them keeps one resolver for both open paths.
|
||||
import { getStateForHref } from 'expo-router/build/link/getStateForHref'
|
||||
import { RouterConfigContext } from 'expo-router/build/global-state/routerConfigContext'
|
||||
import { getRouteInfoFromState } from 'expo-router/build/global-state/getRouteInfoFromState'
|
||||
import type { ExpoLinkingOptions } from 'expo-router/build/getLinkingConfig'
|
||||
import type { BridgeRpcClient } from '../mobile-web-shell/bridge/bridge-rpc-client'
|
||||
import type { BridgeInitRoute } from '../mobile-web-shell/bridge/bridge-init-route'
|
||||
import { BRIDGE_OPEN_ROUTE_PARAM } from '../mobile-web-shell/bridge/bridge-route-update'
|
||||
import { usePageBridgeClient } from '../transport/connection/client-context.web'
|
||||
import { createRefusalReporter, handOffRoute, servedHere } from './route-handoff.web'
|
||||
|
||||
type StackRouterFactory = typeof StackRouter
|
||||
type StackState = ReturnType<typeof Navigator.useContext>['state']
|
||||
type StackRoute = { name: string; params?: object }
|
||||
type OpenSplice = { target: string; state: object }
|
||||
|
||||
function openTargetOf(route: BridgeInitRoute | null | undefined): string {
|
||||
return route?.params?.[BRIDGE_OPEN_ROUTE_PARAM] ?? ''
|
||||
@@ -29,10 +31,15 @@ function opensInDocument(client: BridgeRpcClient, target: string): boolean {
|
||||
|
||||
// Resolve through Expo's own linking, as router.push would, and take the route at this stack's level.
|
||||
// A target Expo cannot read (a malformed escape) opens nothing rather than throwing inside the navigator's render.
|
||||
function stackRouteForHref(href: string, routeNames: readonly string[]): StackRoute | null {
|
||||
function stackRouteForHref(
|
||||
href: string,
|
||||
linking: ExpoLinkingOptions | undefined,
|
||||
routeNames: readonly string[]
|
||||
): StackRoute | null {
|
||||
let state
|
||||
try {
|
||||
state = store.getStateForHref(href)
|
||||
// Open targets are absolute, so no current segments are needed to resolve them.
|
||||
state = getStateForHref(href, { segments: [] }, linking)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
@@ -49,42 +56,25 @@ function stackRouteForHref(href: string, routeNames: readonly string[]): StackRo
|
||||
return null
|
||||
}
|
||||
|
||||
// Open the first init's target as part of the stack's initial state, so its chunk loads with the document like a fresh one and the cover drops on its paint.
|
||||
// Reads the target the URL was built from, and is pure so React can discard a suspended first render and hydrate again the same way.
|
||||
function shellOpenStackRouter(
|
||||
opensHere: (target: string) => boolean,
|
||||
onSpliced: (target: string) => void
|
||||
): StackRouterFactory {
|
||||
return (options) => {
|
||||
const router = StackRouter(options)
|
||||
return {
|
||||
...router,
|
||||
getRehydratedState: (partial, config) => {
|
||||
const [only, ...others] = partial.routes
|
||||
const params: Record<string, unknown> = { ...only?.params }
|
||||
const target = params[BRIDGE_OPEN_ROUTE_PARAM]
|
||||
if (
|
||||
only === undefined ||
|
||||
others.length > 0 ||
|
||||
partial.stale === false ||
|
||||
typeof target !== 'string' ||
|
||||
!opensHere(target)
|
||||
) {
|
||||
return router.getRehydratedState(partial, config)
|
||||
}
|
||||
const opened = stackRouteForHref(target, config.routeNames)
|
||||
if (opened === null) {
|
||||
return router.getRehydratedState(partial, config)
|
||||
}
|
||||
onSpliced(target)
|
||||
delete params[BRIDGE_OPEN_ROUTE_PARAM]
|
||||
return router.getRehydratedState(
|
||||
{ stale: true, index: 1, routes: [{ name: only.name, params }, opened] },
|
||||
config
|
||||
)
|
||||
}
|
||||
}
|
||||
// Open the first init's target as part of the stack's first state, so its chunk loads with the document like a fresh one and the cover drops on its paint.
|
||||
// Reads the target the URL was built from, and is pure so React can discard a suspended first render and plan again the same way.
|
||||
function planOpenSplice(
|
||||
state: StackState,
|
||||
linking: ExpoLinkingOptions | undefined,
|
||||
opensHere: (target: string) => boolean
|
||||
): OpenSplice | null {
|
||||
const [only, ...others] = state.routes
|
||||
const params: Record<string, unknown> = { ...only?.params }
|
||||
const target = params[BRIDGE_OPEN_ROUTE_PARAM]
|
||||
if (only === undefined || others.length > 0 || typeof target !== 'string' || !opensHere(target)) {
|
||||
return null
|
||||
}
|
||||
const opened = stackRouteForHref(target, linking, state.routeNames)
|
||||
if (opened === null) {
|
||||
return null
|
||||
}
|
||||
delete params[BRIDGE_OPEN_ROUTE_PARAM]
|
||||
return { target, state: { ...state, index: 1, routes: [{ ...only, params }, opened] } }
|
||||
}
|
||||
|
||||
function decodedPathnameOf(href: string): string {
|
||||
@@ -100,34 +90,32 @@ function searchParamsOf(href: string): Record<string, string> {
|
||||
}
|
||||
|
||||
// The shell names a target to open inside this document (Jump back in, notification taps) instead of pushing a second one.
|
||||
// Returns the stack router that opens the first init's target; later inits push theirs in-page.
|
||||
export function useShellOpenTarget(): StackRouterFactory {
|
||||
// Call inside the stack navigator; true while the first init's target is still being spliced in, so the stack draws nothing yet.
|
||||
export function useShellOpenTarget(): boolean {
|
||||
const client = usePageBridgeClient()
|
||||
const router = useRouter()
|
||||
const navigation = useNavigationContainerRef()
|
||||
// What the router put in the stack, so a later init only opens a different target.
|
||||
const spliced = useRef<string | null>(null)
|
||||
const [stackRouter] = useState(() =>
|
||||
shellOpenStackRouter(
|
||||
(target) => opensInDocument(client, target),
|
||||
(target) => {
|
||||
spliced.current = target
|
||||
}
|
||||
)
|
||||
const container = useNavigationContainerRef()
|
||||
const { state, navigation } = Navigator.useContext()
|
||||
const linking = use(RouterConfigContext)?.linking
|
||||
const [splice] = useState(() =>
|
||||
planOpenSplice(state, linking, (target) => opensInDocument(client, target))
|
||||
)
|
||||
const [opening, setOpening] = useState(splice !== null)
|
||||
|
||||
// Seeded navigation state can no longer be rewritten by the router, so splice before the first paint.
|
||||
useLayoutEffect(() => {
|
||||
if (opening && splice !== null) {
|
||||
navigation.dispatchSync({ type: 'RESET', payload: splice.state })
|
||||
setOpening(false)
|
||||
}
|
||||
}, [navigation, opening, splice])
|
||||
|
||||
useEffect(() => {
|
||||
const report = createRefusalReporter()
|
||||
let applied = spliced.current
|
||||
// A route update can land before the root navigator is ready; Expo Router refuses to route until then.
|
||||
let waiting: string | null = null
|
||||
let applied = splice?.target ?? null
|
||||
const place = (target: string): void => {
|
||||
if (!navigation.isReady()) {
|
||||
waiting = target
|
||||
return
|
||||
}
|
||||
// Already on top: a second copy would only stack the same screen under itself, so hand it the target's params (a notification's pane) instead.
|
||||
if (decodedPathnameOf(target) === store.getRouteInfo().pathname) {
|
||||
if (decodedPathnameOf(target) === getRouteInfoFromState(container.getRootState()).pathname) {
|
||||
const params = searchParamsOf(target)
|
||||
if (Object.keys(params).length > 0) {
|
||||
router.setParams(params)
|
||||
@@ -136,17 +124,6 @@ export function useShellOpenTarget(): StackRouterFactory {
|
||||
}
|
||||
router.push(target)
|
||||
}
|
||||
const stopWaiting = navigation.addListener('ready', () => {
|
||||
// A preloaded boot mounts the spliced stack with the container, so linking keeps the host list's URL until the state next changes.
|
||||
if (spliced.current !== null) {
|
||||
router.setParams({})
|
||||
}
|
||||
if (waiting !== null) {
|
||||
const target = waiting
|
||||
waiting = null
|
||||
place(target)
|
||||
}
|
||||
})
|
||||
const open = (target: string): void => {
|
||||
if (!isThisHost(client, target)) {
|
||||
console.warn('[page-bridge] open-target-refused', { target })
|
||||
@@ -172,12 +149,8 @@ export function useShellOpenTarget(): StackRouterFactory {
|
||||
}
|
||||
}
|
||||
receive(client.getShellSession()?.route ?? null)
|
||||
const unsubscribe = client.onRouteUpdate(receive)
|
||||
return () => {
|
||||
unsubscribe()
|
||||
stopWaiting()
|
||||
}
|
||||
}, [client, navigation, router])
|
||||
return client.onRouteUpdate(receive)
|
||||
}, [client, container, router, splice])
|
||||
|
||||
return stackRouter
|
||||
return opening
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user