Absolute elements jump on the screen with a large title when scrolling
See original GitHub issueAfter scrolling ‘faster’, the position of the screen and/or button changes position more, in a clean application with simple empty screen it occurs less often, while in a larger app it occurs almost every time.
Code:
function First({ navigation }) {
return (
<>
<ScrollView style={{ backgroundColor: 'pink', flex: 1 }}>
<Text>First</Text>
</ScrollView>
<Text style={{ position: 'absolute', padding: 30, backgroundColor: 'red', bottom: 100, alignSelf: 'center' }}>Some Absolute Text</Text>
</>
);
}
export function BugStack() {
return (
<NativeStack.Navigator>
<NativeStack.Screen name='First' component={First} options={{ headerLargeTitle: true }} />
</NativeStack.Navigator>
);
}
Gif with 0.5x speed:
- @react-navigation/native: 5.2.6
- @react-navigation/stack: 5.3.1
- react-native-screens: 2.7.0
platform: iOS
mode: Debug and Release (issue on both)
Device: iPhone XS
OS version: 13.4.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Unexpected jump while changing position from absolute to ...
So the absolutely positioned elements can scroll off screen (to some extent) before scroll handlers are notified of a new scroll position. The ......
Read more >Using Position Absolute Inside A Scrolling Overflow Container
Ben Nadel looks at the way absolutely positioned elements behave inside an "overflow: auto" viewport. And, how to wrap the content in order ......
Read more >Content Jumping (and How To Avoid It) | CSS-Tricks
If the content ends up making the element taller, it can still do that, which isn't great, but it's slightly better than doing...
Read more >How to make absolute positioned elements overlap their ...
This is a good technique, however the downfall is that if the container is scrollable, the absolutely positioned item will not scroll with...
Read more >Advanced layouts with absolute and fixed positioning
Absolutely positioned elements are removed entirely from the document flow. That means they have no effect at all on their parent element or...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Nevermind I see what has to be done. For anybody else that is having the same problem but hasn’t read the docs fully (me. <= bad). Your ScrollView needs to have contentInsetAdjustmentBehavior=“automatic” and your Screen needs to have headerTranslucent: true just like @WoLewicki said.
Example.tsx
With transculent true there is no issue but this isn’t perfect workaround, transculent header brokes another behavior