software-mansion / software-mansion/react-native-screens

Glitchy large header behavior when combaining SafeArea with Scroll

Open
#2,822 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

missing-info missing-repro platform:ios
Dominant language
TypeScript
Stars
3.7k
Forks
714
Avg merge
2d 23h
Merged PRs (30d)
71

Description

Large header on iOS does not feel so smooth when wrapping with SafeArea (which is required in some cases).

You should be able to see a jump when using ScrollView wrapped with SafeAreaView:

without SafeArea with SafeArea
Source code:
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { ScrollView, Text, View, SafeAreaView } from 'react-native';
import {
  createNativeStackNavigator,
} from '@react-navigation/native-stack';

const Stack = createNativeStackNavigator();

export default function NativeNavigation() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen
          name="Home"
          component={Home}
          options={{
            headerLargeTitle: true,
          }}
        />
      </Stack.Navigator>
    </NavigationContainer>
  );
}

const Card = ({text}) => (
  <View style={{
    height: 100,
    borderWidth: 1,
    borderColor: "#f0f",
    justifyContent: 'center',
    alignItems: 'center',
  }}>
    <Text style={{fontSize: 30}}>{text}</Text>
  </View>
);

export function Home() {
  const content = (
    <>
      <Card text="1" />
      <Card text="2" />
      <Card text="3" />
      <Card text="4" />
      <Card text="5" />
      <Card text="6" />
      <Card text="7" />
    </>
  );

  // ScrollView adjusted
  // return (
  //   <ScrollView contentInsetAdjustmentBehavior="automatic">
  //     {content}
  //   </ScrollView>
  // );

  // SafeAreaView with ScrollView
  return (
    <SafeAreaView>
      <ScrollView>
        {content}
      </ScrollView>
    </SafeAreaView>
  );
}


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided React Native reproduction using headerLargeTitle, SafeAreaView, and ScrollView on iOS, comparing it with the contentInsetAdjustmentBehavior="automatic" example. Trace how the large header and safe-area insets interact during scrolling; done means the SafeAreaView version no longer visibly jumps and the existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.