Skip to content

MapView occupies whole react-native-cardview space #10

Description

@san37puj

Is this a bug report?

Yes

Have you read the Installation Instructions?

Yes

Environment

Steps to Reproduce

I was using react-native-maps to display google maps in my app. The layout hirarchy was as below:

  • CardView from 'react-native-cardview' ==> style={cardviewContainer}
    |- View from 'react-native' ==> style={defaultContainerStyle}
    |- View from 'react-native' ==> header
    |- View from 'react-native' ==> style={mapContainer}
    |- MapView from 'react-native-maps' [provider='google'] ==> style={map}

Styles:
mapContainer: {
marginLeft: -20,
marginRight: -20,
marginTop: 20,
marginBottom: -20,
height: 300,
}
map: {
...StyleSheet.absoluteFillObject,
}
defaultContainerStyle: {
padding: 20,
paddingTop: 25,
paddingBottom: 25,
}
cardviewContainer: {
backgroundColor: '#fff',
marginLeft: -2,
marginRight: -2,
marginBottom: 10,
}

With above components and their cards map was rendering within required area.
But, when I changed same above configuration with below, the OSM map accoupies whole CardView area. Here the problem is the Card header is not displayed/overlapped by map.

  • CardView from 'react-native-cardview' ==> style={cardviewContainer}
    |- View from 'react-native' ==> style={defaultContainerStyle}
    |- View from 'react-native' ==> header
    |- View from 'react-native' ==> style={mapContainer}
    |- MapView from 'react-native-maps-osmdroid' [provider=PROVIDER_OSMDROID] ==> style={map}

Expected Behavior

using google maps

Actual Behavior

"Some header" and Icon is overlapped here.
using osmdroid map

Reproducible Demo

SampleGoogleMapApp.zip
sample_app_with_google_map

SampleOSMDroidMapApp.zip
sample_app_with_osmdroid_map

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions