software-mansion / react-native-screens

Native navigation primitives for your React Native app.
https://docs.swmansion.com/react-native-screens/
MIT License
3.1k stars 521 forks source link

LayoutAnimation breaks headerLargeTitle #1597

Open miladdev85 opened 2 years ago

miladdev85 commented 2 years ago

Description

When using LayoutAnimation.configureNext(LayoutAnimation.Presets.linear) - the header is no longer collapsing or updating.

Steps to reproduce

   React.useLayoutEffect(() => {
    navigation.setOptions({
      headerTitle: () => (
        <SegmentedControl
          values={['A', 'B']}
          selectedIndex={0}
          onChange={event => {
            LayoutAnimation.configureNext(LayoutAnimation.Presets.linear);   <------- This line breaks collapsing header
            setIndex(event.nativeEvent.selectedSegmentIndex);
          }}
        />
      ),
      headerSearchBarOptions: {
        onChangeText: event => setSearch(event.nativeEvent.text),
        hideWhenScrolling: true,
        cancelButtonText: translations.navigation.cancel,
        placeholder: translations.navigation.search,
      },
    });
  }, [navigation, search]);

Snack or a link to a repository

I don't have any

Screens version

3.15.0

React Native version

0.69.3

Platforms

iOS

JavaScript runtime

No response

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Real device

Device model

iPhone 13 Pro

Acknowledgements

Yes

github-actions[bot] commented 2 years ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?