modules/expo-scroll-forwarder/README.md
An Expo native module that forwards scroll gestures from a UIView to a UIScrollView on iOS. This enables custom scroll behaviors by allowing a non-scrollable view to control a scrollable view's scroll position.
This module solves a specific interaction problem: allowing a fixed header or overlay view to respond to scroll gestures and forward them to an underlying scroll view. The primary use case in the Bluesky app is the profile screen, where the profile header sits above a scrollable content area and can be dragged to scroll the content below it.
Key behaviors:
The module consists of three main parts:
ExpoScrollForwarderView.swift - The core native view component that:
ExpoScrollForwarderModule.swift - The Expo module definition that:
scrollViewTag prop to specify which scroll view to controlExpoScrollForwarderView.tsx - Platform-specific implementations:
ExpoScrollForwarder.types.ts - TypeScript type definitions:
scrollViewTag: The React Native tag of the scroll view to controlchildren: The content to render (typically a header component)expo-module.config.json - Declares iOS-only platform support
ExpoScrollForwarder.podspec - CocoaPods specification for iOS dependency management
import {ExpoScrollForwarderView} from 'expo-scroll-forwarder'
function ProfileScreen() {
const scrollViewTag = useRef(null)
return (
<View>
<ExpoScrollForwarderView scrollViewTag={scrollViewTag.current}>
<ProfileHeader />
</ExpoScrollForwarderView>
<ScrollView ref={scrollViewTag}>
</ScrollView>
</View>
)
}
The scrollViewTag prop must be the React Native tag (numeric identifier) of the target scroll view. The module uses this to locate the native UIScrollView instance.
The module is designed to enhance iOS UX while gracefully degrading on other platforms.
abs(velocity.y) > abs(velocity.x))RCTRefreshControl.forwarderBeginRefreshing()AppContext.findView(withTag:ofType:)| File | Purpose |
|---|---|
ios/ExpoScrollForwarderView.swift | Native iOS view implementation with gesture handling and scroll physics |
ios/ExpoScrollForwarderModule.swift | Expo module registration and prop definitions |
ios/ExpoScrollForwarder.podspec | CocoaPods dependency specification |
src/ExpoScrollForwarderView.ios.tsx | TypeScript wrapper for iOS native view |
src/ExpoScrollForwarderView.tsx | Default no-op implementation for other platforms |
src/ExpoScrollForwarder.types.ts | TypeScript type definitions |
index.ts | Module entry point |
expo-module.config.json | Expo module configuration |