Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MapView occupies whole react-native-cardview space #10

Open
san37puj opened this issue Sep 11, 2019 · 4 comments
Open

MapView occupies whole react-native-cardview space #10

san37puj opened this issue Sep 11, 2019 · 4 comments

Comments

@san37puj
Copy link

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

@fqborges
Copy link
Owner

Yes, I noticed that before on some containers views. I did not have the time to debug that yet, but I guess it is related to how react-native merge multiple empty "Views" in a single native view.

No time to fix this right now, though.

@arieldll
Copy link

Hi all,

Any solution for this bug?

Best Regards

@san37puj
Copy link
Author

Yes, a workaroud! :)

I just used CardView (instead of View) inside CardView as below:

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

@arieldll
Copy link

arieldll commented Dec 5, 2019

Hi all,

Working for me too.
Thank you @san37puj

Best Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants