-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS ScrollView contentInset sometimes not applied #23988
Comments
It looks like you are using an older version of React Native. Please update to the latest release, v0.59 and verify if the issue still exists. The "Resolution: Old Version" label will be removed automatically once you edit your original post with the results of running `react-native info` on a project using the latest release.
|
I have the same problem. I changed the snack a little bit. So when initially when the requesting becomes false, the scrollview automatically goes to the top instead of scrolling to the inset. But when we trigger the onRefresh again, it works fine ! @mxmtsk did you get this fixed? |
any updates? i guess we should set negative scrollview offset in setContentInset |
I am looking at the code right now ( @mxmtsk @andreshsingh Does I am thinking about removing this prop. Please LMK if you have any objections. |
@shergin Thanks for looking into that. And sadly no, it wouldn't work, because in that case the |
BTW, why onScroll does not pass the contentInset in the event when scrolling down is triggered as it does with the contentOffset while scrolling up? |
@mxmtsk That sounds like a bug in PullToRefresh (or ScrollView) component. Conceptually, the props represent same thing, right? |
@shergin Sorry for the late reply. What do you mean by conceptually? And which props? |
Theres any update on this? Any quick fix? This bug is very annoying. |
I tried, but failed |
Have you solved it yet? |
Any updates on this? This is still a problem. |
Anyone got any further ideas on how to solve this? |
there maybe reslove it |
Still a problem here too. My use case: I have an absolutely positioned header on top of the screen, and animate it on scroll. Initial offsets are needed to move the refresh control, since padding does not move it's position. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
I know its been a year since you've posted this answer.. but I've noticed that with this, somehow, if you're using a bottomTabNavigator from react-navigation 4.x.x, when you press a tab that you're already on (to scroll all the way up) it doesn't reach the very top like you would if you press on the status bar of the iPhone. instead it goes a bit down to somewhere around your before example. I wanted to ask if by any chance you faced this problem as well? The difference is that im using |
Stopped working after upgraded to React-Native 0.65.1 and iOS 15.0. Here's some test code in a export default class App extends Component {
state = { refreshing: false };
onRefresh = () => {
this.setState({ refreshing: true });
setTimeout(()=>{
this.setState({ refreshing: false });
}, 2000);
};
render() {
return (
<ScrollView style={{ flex: 1 }}
contentInset={{top: 200, left:0,right:0,bottom:0}}
refreshControl={<RefreshControl refreshing={this.state.refreshing} onRefresh={this.onRefresh} />}
contentInsetAdjustmentBehavior='always'>
<View style={{ backgroundColor: 'red', width: 300, height: 400 }} />
</ScrollView>
);
}
} ResultRPReplay_Final1632642386.MP4However, |
🐛 Bug Report
I'm using the
contentInset
prop to offset theScrollView
so that it starts lower but still scrolls behind a fixed header. When the component gets displayed the content starts from the top instead of the position defined incontentInset
. As soon as I touch the ScrollView just a little bit, it instantly jumps to the position I expect it to be.I don't use
paddingTop
or something different because I need theRefreshControl
to be below the headerTo Reproduce
To reproduce create ScrollView with a RefreshControl and a
contentInset
.Expected Behavior
When the component is displayed it should start at the defined
contentInset
.Code Example
Here is a snack that demonstrates the issue:
https://snack.expo.io/@mxmtsk/contentinset-bug
Environment
React Native Environment Info:
System:
OS: macOS 10.14
CPU: (16) x64 Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz
Memory: 65.72 MB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.1.0 - ~/.nvm/versions/node/v10.1.0/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.3.0 - ~/.nvm/versions/node/v10.1.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 25, 26, 27, 28
Build Tools: 27.0.3, 28.0.1
System Images: android-24 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.1 => 0.59.1
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7
The text was updated successfully, but these errors were encountered: