diff --git a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt index 893d757c0..f53c8b4ff 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/components/styles/sources/RNMBXRasterSourceManager.kt @@ -5,6 +5,8 @@ import com.facebook.react.bridge.ReactApplicationContext import com.facebook.react.uimanager.ThemedReactContext import com.facebook.react.uimanager.annotations.ReactProp import com.facebook.react.viewmanagers.RNMBXRasterSourceManagerInterface +import com.rnmapbox.rnmbx.events.constants.EventKeys +import com.rnmapbox.rnmbx.events.constants.eventMapOf import javax.annotation.Nonnull class RNMBXRasterSourceManager(reactApplicationContext: ReactApplicationContext) : @@ -26,7 +28,10 @@ class RNMBXRasterSourceManager(reactApplicationContext: ReactApplicationContext) } override fun customEvents(): Map? { - return null + return eventMapOf( + EventKeys.RASTER_SOURCE_LAYER_CLICK to "onMapboxRasterSourcePress", + EventKeys.MAP_ANDROID_CALLBACK to "onAndroidCallback" + ) } companion object { diff --git a/android/src/main/java/com/rnmapbox/rnmbx/events/constants/EventKeys.kt b/android/src/main/java/com/rnmapbox/rnmbx/events/constants/EventKeys.kt index d059b2cbc..3882f1e6b 100644 --- a/android/src/main/java/com/rnmapbox/rnmbx/events/constants/EventKeys.kt +++ b/android/src/main/java/com/rnmapbox/rnmbx/events/constants/EventKeys.kt @@ -4,35 +4,37 @@ private fun ns(name: String): String { val namespace = "rct.mapbox" return String.format("%s.%s", namespace, name) } + enum class EventKeys(val value: String) { // map events - MAP_CLICK(ns("map.press")), - MAP_LONG_CLICK(ns("map.longpress")), - MAP_ONCHANGE(ns("map.change")), - MAP_ON_LOCATION_CHANGE(ns("map.location.change")), - MAP_ANDROID_CALLBACK(ns("map.androidcallback")), - MAP_USER_TRACKING_MODE_CHANGE(ns("map.usertrackingmodechange")), + MAP_CLICK("topPress"), + MAP_LONG_CLICK("topLongPress"), + MAP_ONCHANGE("topMapChange"), + MAP_ON_LOCATION_CHANGE("topLocationChange"), + MAP_ANDROID_CALLBACK("topAndroidCallback"), + MAP_USER_TRACKING_MODE_CHANGE("topUserTrackingModeChange"), // point annotation events - POINT_ANNOTATION_SELECTED(ns("pointannotation.selected")), - POINT_ANNOTATION_DESELECTED(ns("pointannotation.deselected")), - POINT_ANNOTATION_DRAG_START(ns("pointannotation.dragstart")), - POINT_ANNOTATION_DRAG(ns("pointannotation.drag")), - POINT_ANNOTATION_DRAG_END(ns("pointannotation.dragend")), + POINT_ANNOTATION_SELECTED("topMapboxPointAnnotationSelected"), + POINT_ANNOTATION_DESELECTED("topMapboxPointAnnotationDeselected"), + POINT_ANNOTATION_DRAG_START("topMapboxPointAnnotationDragStart"), + POINT_ANNOTATION_DRAG("topMapboxPointAnnotationDrag"), + POINT_ANNOTATION_DRAG_END("topMapboxPointAnnotationDragEnd"), // source events - SHAPE_SOURCE_LAYER_CLICK(ns("shapesource.layer.pressed")), - VECTOR_SOURCE_LAYER_CLICK(ns("vectorsource.layer.pressed")), - RASTER_SOURCE_LAYER_CLICK(ns("rastersource.layer.pressed")), + SHAPE_SOURCE_LAYER_CLICK("topMapboxShapeSourcePress"), + VECTOR_SOURCE_LAYER_CLICK("topMapboxVectorSourcePress"), + RASTER_SOURCE_LAYER_CLICK("topMapboxRasterSourcePress"), // images event - IMAGES_MISSING(ns("images.missing")), + IMAGES_MISSING("topImageMissing"), // location events + // TODO: not sure about this one since it is not registered anywhere USER_LOCATION_UPDATE(ns("user.location.update")), // viewport events - VIEWPORT_STATUS_CHANGE(ns("viewport.statuschange")) + VIEWPORT_STATUS_CHANGE("topStatusChanged") } fun eventMapOf(vararg values: Pair): Map { diff --git a/example/android/app/src/main/java/com/rnmapboxglexample/MainApplication.kt b/example/android/app/src/main/java/com/rnmapboxglexample/MainApplication.kt index 500be7504..65241901e 100644 --- a/example/android/app/src/main/java/com/rnmapboxglexample/MainApplication.kt +++ b/example/android/app/src/main/java/com/rnmapboxglexample/MainApplication.kt @@ -29,7 +29,7 @@ class MainApplication : Application(), ReactApplication { SoLoader.init(this, false) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. - load(bridgelessEnabled=false) + load() } } } \ No newline at end of file