diff --git a/apps/mobile/src/components/ScreenScrollView.tsx b/apps/mobile/src/components/ScreenScrollView.tsx index 509feeb39728749badc56c09185eca98f8c27bec..c41524e3b9172e000906244fd74fac1f26bc067c 100644 --- a/apps/mobile/src/components/ScreenScrollView.tsx +++ b/apps/mobile/src/components/ScreenScrollView.tsx @@ -1,5 +1,6 @@ import type { ComponentProps } from "react"; -import { Platform, ScrollView } from "react-native"; +import { Platform } from "react-native"; +import { NativeScrollView as ScrollView } from "../native/NativeScrollViewMarker"; /** Keeps forms and settings readable inside a wide pane while its surface fills the screen. */ export function ScreenScrollView(props: ComponentProps) { diff --git a/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx b/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx index 795f72bcd48bcb66f4ef2d7be4813fc1d4259369..45bd8de8d08d2b82f015c3f12bf50b5096602287 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestDiscussionScreen.tsx @@ -5,7 +5,7 @@ import type { PullRequestThreadComment } from "@t3tools/contracts"; import { useRef, useState } from "react"; import { ActivityIndicator, Platform, ScrollView, View } from "react-native"; import { KeyboardAvoidingView, useKeyboardState } from "react-native-keyboard-controller"; -import { ScrollViewMarker } from "react-native-screens"; +import { NativeScrollViewMarker as ScrollViewMarker } from "../../native/NativeScrollViewMarker"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText"; import { AndroidScreenHeader } from "../../components/AndroidScreenHeader"; @@ -153,7 +153,7 @@ function Discussion({ params }: { params: PullRequestParams & { readonly discuss /> ) : null} - + + ["scrollEdgeEffects"]; + +const DEFAULT_SCROLL_EDGE_EFFECTS = nativeHeaderScrollEdgeEffects(Platform.OS, Platform.Version); + +export const NativeScrollEdgeEffectsContext = createContext(undefined); + +/** Register the content scroll view and apply its route's native edge settings. */ +export function NativeScrollViewMarker(props: ComponentProps) { + const effects = use(NativeScrollEdgeEffectsContext); + return ( + + ); +} + +/** Primary screen scrolling; Android keeps its existing native view hierarchy. */ +export function NativeScrollView(props: ComponentProps) { + const scrollView = ; + return Platform.OS === "ios" ? ( + {scrollView} + ) : ( + scrollView + ); +} diff --git a/apps/mobile/src/native/createV5StackNavigator.ios.tsx b/apps/mobile/src/native/createV5StackNavigator.ios.tsx index d6e0dca54b3c12ad0fcb24959b58338370e9c2f3..408ddc9e0ffb7fa775ada5fac12839789ffb1530 100644 --- a/apps/mobile/src/native/createV5StackNavigator.ios.tsx +++ b/apps/mobile/src/native/createV5StackNavigator.ios.tsx @@ -23,6 +23,7 @@ import { import { useCallback, useRef, useState, type ComponentProps } from "react"; import { StyleSheet, View } from "react-native"; import { FormSheet, Stack } from "react-native-screens"; +import { NativeScrollEdgeEffectsContext } from "./NativeScrollViewMarker"; import { V5StackHeader } from "./V5StackHeader.ios"; import type { AppNativeStackNavigationOptions } from "./StackHeader"; import { NativeColumnContent } from "./NativeColumnContent.ios"; @@ -243,7 +244,9 @@ export function V5CardStackView( .nativeContentInsetHorizontally } > - {descriptor.render()} + + {descriptor.render()} +