feat(android): jetpack compose support#1092
Open
troZee wants to merge 6 commits into
Open
Conversation
added 5 commits
July 3, 2026 22:20
There was a problem hiding this comment.
Pull request overview
This PR migrates the Android implementation of RNCViewPager from a ViewPager2-backed view hierarchy to a Jetpack Compose-backed pager (HorizontalPager / VerticalPager) while keeping the existing React Native manager API surface.
Changes:
- Replaces the Android native view implementation with a new
ComposePagerViewthat hosts RN child views viaAndroidView. - Rewires the RN
ViewGroupManagerand manager-impl helpers to operate onComposePagerViewinstead ofNestedScrollableHost/ViewPager2. - Adds Compose Gradle configuration and Compose dependencies to the Android module.
Reviewed changes
Copilot reviewed 5 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| android/src/main/java/com/reactnativepagerview/PagerViewViewManagerImpl.kt | Redirects child management and prop setters to ComposePagerView methods. |
| android/src/main/java/com/reactnativepagerview/PagerViewViewManager.kt | Switches the manager’s view type to ComposePagerView and forwards commands/props accordingly. |
| android/src/main/java/com/reactnativepagerview/ComposePagerView.kt | New Compose-based pager implementation, including event dispatching and RN-child hosting. |
| android/gradle.properties | Introduces a Compose version property for dependency management. |
| android/build.gradle | Enables Compose + adds Kotlin Compose plugin and Compose dependencies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+236
to
+239
| implementation "androidx.compose.foundation:foundation:$compose_version" | ||
| implementation "androidx.compose.runtime:runtime:$compose_version" | ||
| implementation "androidx.compose.ui:ui:$compose_version" | ||
| implementation "androidx.compose.ui:ui-viewbinding:$compose_version" |
Comment on lines
+52
to
54
| fun setOverScrollMode(host: ComposePagerView, value: String) { | ||
| return | ||
| } |
Comment on lines
+193
to
+195
| fun setOffscreenPageLimit(value: Int) { | ||
| offscreenPageLimitState.value = value.coerceAtLeast(0) | ||
| } |
Comment on lines
+313
to
+318
| .collect { inProgress -> | ||
| if (!inProgress) { | ||
| dispatchPageScroll(pagerState.settledPage, 0f) | ||
| dispatchScrollState("idle") | ||
| } | ||
| } |
troZee
commented
Jul 3, 2026
| { | ||
| "name": "react-native-pager-view", | ||
| "version": "8.0.2", | ||
| "version": "9.0.0-rc.0", |
Collaborator
Author
There was a problem hiding this comment.
revert this before the release
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces the Android pager implementation with a Jetpack Compose-backed pager while preserving the existing
React Native manager API.
Changes
ComposePagerView, backed by ComposeHorizontalPagerandVerticalPager.