Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,14 @@ class MapView extends NativeBridgeComponent(
}
}

if (mapView == null) {

@mfazekas mfazekas May 6, 2025

Copy link
Copy Markdown
Contributor

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 = <></>
}

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

Choose a reason for hiding this comment

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

Yes it dont catches everything. Many times same error also comes, but less frequent

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Med-Li-Jr can you reacheck this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@shahzeb79 , @LukasB-DEV I tried with the init code I don't see the error, Can you share the part of your code that gives the errors ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Med-Li-Jr i face error when lets say i click on icon on map, or state changes on mapscreen. error get triggered but its also random

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@shahzeb79 I see, so that means it's probably a deep error in the project, it may be coming from another file, we'll have to wait for an official resolution😕

mapView = (
<RNMBXMapView {...props} {...callbacks}>
{this.props.children}
</RNMBXMapView>
)
}

return (
<View
onLayout={this._onLayout}
Expand Down
Loading