Skip to content

Fixed Issue : #3756 ( Mapbox [error] ViewTagResolver) #3852

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Med-Li-Jr
Copy link

@Med-Li-Jr Med-Li-Jr commented May 5, 2025

Description

Fixes #3756
File Changed : MapView.tsx

Added your feature that allows ...

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Screenshot OR Video

Component to reproduce the issue you're fixing

…null found with tag )

It's a fix for this issue : rnmapbox#3756
@Med-Li-Jr Med-Li-Jr temporarily deployed to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Inactive
@Med-Li-Jr Med-Li-Jr had a problem deploying to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Error
@Med-Li-Jr Med-Li-Jr temporarily deployed to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Inactive
@Med-Li-Jr Med-Li-Jr temporarily deployed to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Inactive
@Med-Li-Jr Med-Li-Jr temporarily deployed to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Inactive
@Med-Li-Jr Med-Li-Jr temporarily deployed to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Inactive
@Med-Li-Jr Med-Li-Jr temporarily deployed to CI with Mapbox Tokens May 5, 2025 23:25 — with GitHub Actions Inactive
@@ -1171,6 +1171,14 @@ class MapView extends NativeBridgeComponent(
}
}

if (mapView == null) {
Copy link
Contributor

@mfazekas mfazekas May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is good way to solve the issue.
mapView will be null if on layout has not been called yet.

Can't we just add an else to set mapView to an empty fragment instead of null?

if (this.state.isReady) {
  ...
} else {
  mapView = <></>
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Med-Li-Jr code works. @mfazekas your suggestion does not work

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfazekas, yeah me too, I didn't think it was a good way to solve it, but it was the only one amongs the things I tried that solved it on my side, I tried the following, but other errors appeared :

  • Attemp 1 :

       let mapView = {} as NativeMapViewActual;
       if (this.state.isReady) {
          ...
        }
    
  • Attemp 2 :

        let mapView = <RNMBXMapView> </RNMBXMapView>;
        if (this.state.isReady) {
          ...
        }
    
  • Attemp 3 :

        let mapView = <></>;
        if (this.state.isReady) {
          ...
        }
    
  • etc....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LukasB-DEV, I see, then just changed it on your local code, maybe later, there will be an update that will fix it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Med-Li-Jr is there a code to reproduce the issue? It's not clear in #3756 how to reproduce the issue

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfazekas it's a new project with the version 10.1.37, I just tried to create a new complete project with the latest version of expo and rnmapbox, but it didn't work too.

Step to reproduce the issue :

  • npx create-expo-app --template default@53.0.7
  • npm i @rnmapbox/maps@10.1.37
  • npm run reset-project

in the app/index.tsx file :

  import Mapbox from '@rnmapbox/maps';
  import React from 'react';
  import { StyleSheet, View } from 'react-native';
  
  Mapbox.setAccessToken('xxxxxxxxxxxxxxxx');
  
  const App = () => {
    return (
      <View style={styles.page}>
        <View style={styles.container}>
          <Mapbox.MapView style={styles.map} />
        </View>
      </View>
    );
  }
  
  export default App;
  
  const styles = StyleSheet.create({
    page: {
      flex: 1,
      justifyContent: 'center',
      alignItems: 'center',
    },
    container: {
      height: 300,
      width: 300,
    },
    map: {
      flex: 1
    }
  });
  • npx expo prebuild --clean
  • npm run android

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