Skip to content

[Bug/Question]: Map aspect ratio broken inside CarPlay on iOS #2728

Closed as not planned

Description

@nixolas1

Mapbox Implementation

Mapbox

Mapbox Version

default

Platform

iOS

@rnmapbox/maps version

10.0.0-beta.69

Standalone component to reproduce

import styled from "styled-components/native"
import MapView from "../../../components/common/MapView"
import MapboxGL from "@rnmapbox/maps"

export const CarMap = ({}) => {
  return (
    <Container style={{backgroundColor: "blue"}}>
      <MapView  styles={{height: "100%", width: "100%"}} key={Math.random()}>
        <MapboxGL.Camera centerCoordinate={[8.59, 61.7]} zoomLevel={3} />
        <MapboxGL.UserLocation renderMode={"native"} minDisplacement={50} />
      </MapView>
    </Container>
  )
}

// transform: [{scaleY: 1.1}]}

const Container = styled.View`
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
`

Observed behavior and steps to reproduce

image

When using the map inside a CarPlay (iOS) screen, the map layer's aspect ratio or pixel ratio is wrong.
The height of the MapView element itself (and aspect of mapbox attribution and info icon) is correct, it is just the underlying map that is displayed wrong.

Expected behavior

The map should stretch to the top and bottom (no blue visible), and the scale of the text and location pin should be correct.

Notes / preliminary analysis

Any ideas on how to fix this, or where to look for a possible fix? Any native code that uses a specific function to get window height/width, or similar, that only works on a phone, and not in a separate screen (like CarPlay)?

Additional links and references

Using React native carplay https://github.com/birkir/react-native-carplay

Activity

  1. changed the title [-][Bug/Question]: [/-] [+][Bug/Question]: Map aspect ratio broken inside CarPlay on iOS[/+] on Mar 21, 2023
  2. nixolas1 commented on Mar 21, 2023

    @nixolas1
    Author

    Updated to ^10.0.0-rc.0, no change.

  3. added
    iOS
    on Mar 21, 2023
  4. femmon commented on Aug 16, 2023

    @femmon

    I'm having the same problem but when connecting iOS to an external monitor:
    IMG_0085

    Using "@rnmapbox/maps": "10.0.4" and "react-native-external-display": "0.6.1" on "react-native": "0.68.2"
    Device is iPod Touch (7th gen) - 15.7.8

    import React from 'react'
    import { View } from 'react-native'
    import MapboxGL from '@rnmapbox/maps'
    import ExternalDisplay, { useExternalDisplay } from 'react-native-external-display'
    
    const ExternalDisplayWrapper = (props) => {
    	const screens = useExternalDisplay()
    		return (
    			<ExternalDisplay
    				fallbackInMainScreen={true}
    				screen={Object.keys(screens)[0]}
    			>
    				{props.children}
    			</ExternalDisplay>
    		)
     }
    
    export default class App extends React.Component {
    	render(): JSX.Element {
    		return (
    			<View style={{ flex: 1 }}>
    				<ExternalDisplayWrapper>
    					<MapboxGL.MapView
    						style={{ height: '100%', width: '100%' }}
    						styleURL={'mapbox://styles/app/gibberish'}
    						compassEnabled={false}
    						regionDidChangeDebounceTime={50}
    						attributionEnabled={false}
    						scaleBarEnabled={false}
    					/>
    				</ExternalDisplayWrapper>
    			</View>
    		)
    	}
    }
    

    Is there any update on this issue? @mfazekas

  5. added
    todo
    on Dec 9, 2023
  6. mfazekas commented on Dec 9, 2023

    @mfazekas
    Contributor

    Valid bug, but not planned do to lack of resources. Closing as not planned.

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

    iOStodo

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions