Skip to content

Map region lost on navigation (Android only) #5595

Open
@VadymVashchuk

Description

@VadymVashchuk

Summary

I am using @react-navigation/native-stack, react-native 0.79 (new Architecture) and noticed an issue with new versions of this package.
When I navigate from screen with map to another screen and go back, map loses it's position. And it is not even rerendered. Only android.

Reproducible sample code

const MainScreen = () => {
  return (
    <View style={{flex: 1}}>
      <MapView style={{flex: 1}} provider={'google'} />
      <Pressable onPress={() => navigationRef.navigate('Profile'} style={{position: 'absolute', top: 50, left: 50, backgroundColor: 'red', width: 50, height: 50}}></Pressable>
    </View>
  );
};

export default MainScreen;

Steps to reproduce

  1. MainScreen has . It is as simple as it could be.
  2. We navigate to another screen with navigation.navigate('screenB') - common pattern.
  3. We go back go MainScreen (no matter how, swiper or navigation.goBack())
  4. Map loses it's position and shows default position if Africa with max zoom level I suppose.

Expected result

Like in IOS map should not change it's region.

Actual result

Map changes position although it's component is not rerendered.

React Native Maps Version

1.24.3, maybe earlier

What platforms are you seeing the problem on?

Android

React Native Version

0.79.1 (new Architecture)

What version of Expo are you using?

Not using Expo

Device(s)

Samsung A05

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions