Skip to content

Commit

Permalink
fix(android): fix point annotation child view management (#3414)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored Mar 9, 2024
1 parent 0b94b33 commit 2a98da2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class RNMBXPointAnnotation(private val mContext: Context, private val mManager:
private var mCalloutSymbol: PointAnnotation? = null
private var mCalloutBitmap: Bitmap? = null
private var mCalloutBitmapId: String? = null

private val childViews = mutableListOf<View>();
override fun addView(childView: View, childPosition: Int) {
if (childView is RNMBXCallout) {
calloutView = childView
Expand All @@ -55,6 +57,20 @@ class RNMBXPointAnnotation(private val mContext: Context, private val mManager:
childView.addOnLayoutChangeListener(this)

mMapView?.offscreenAnnotationViewContainer?.addView(childView)
childViews.add(childPosition, childView)
}

override fun getChildAt(childPosition: Int): View {
return childViews.get(childPosition)
}

override fun getChildCount(): Int {
return childViews.size
}

override fun removeViewAt(index: Int) {
val view = childViews.removeAt(index)
removeView(view)
}

override fun removeView(childView: View) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class RNMBXPointAnnotationManager(reactApplicationContext: ReactApplicationConte
)
}

// TODO: check why it does not work correctly
override fun createViewInstance(reactContext: ThemedReactContext): RNMBXPointAnnotation {
return RNMBXPointAnnotation(reactContext!!, this)
}
Expand Down

0 comments on commit 2a98da2

Please sign in to comment.