react-native: Android Scrollview ContentInset/ContentOffset do not behave properly.
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest React Native release to make sure your issue has not already been fixed: https://reactnative.dev/docs/upgrading.html
Content Offset and Content Inset do not work for Android devices on React Native ScrollViews
React Native version:
Run react-native info
in your terminal and copy the results here.
System: OS: macOS 10.15.7 CPU: (8) x64 Intel® Core™ i7-3770 CPU @ 3.40GHz Memory: 91.34 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.15.1 - /usr/local/bin/node Yarn: Not Found npm: 6.13.7 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.3 - /Users/Dellybro/.rvm/gems/ruby-2.6.3/bin/pod SDKs: iOS SDK: Platforms: iOS 14.1, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0 Android SDK: Not Found IDEs: Android Studio: 3.5 AI-191.8026.42.35.5900203 Xcode: 12.1/12A7403 - /usr/bin/xcodebuild Languages: Java: 11.0.2 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.3 => 0.63.3 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Create a horizontal scrollview and attempt to use content inset and content offset. Nothing will happen
Expected Results
Describe what you expected to happen.
I would expect the same results as iOS with contentInset is moves the start and contentOffset is moves the initial starting value
Snack, code example, screenshot, or link to a repository:
Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve
Please review this stackoverflow question which has all of the information about my current situation.
Snack Expo link https://snack.expo.io/gW4iCCXOD
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 10
- Comments: 17 (2 by maintainers)
@fabriziobertoglio1987 It seems to only fix
contentOffset
but notcontentInset
. Can confirmcontentInset
is not working at all on Android.contentInset
is still not working on Android. alternatively, you can pass style tocontentContainerStyle
. e.g. :contentContainerStyle={{ paddingBottom: 150 }}
Unfortunately this is still an issue
This is a workaround if someone is interested.
Components fix
OR
react-native ScrollView Fix, this fix is for react-native: 0.68.2
edit
node_modules\react-native\Libraries\Components\ScrollView
Fixed on https://github.com/facebook/react-native/commit/be260b9f479a3b55ee43d2959d2c49fd3c1eb4ac
patch-package
for0.68.2
(Expo SDK 45 users):Patch
The same for me