Skip to content

Commit

Permalink
rn-0.75.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas committed Aug 20, 2024
1 parent 7591f84 commit 0c1e75c
Show file tree
Hide file tree
Showing 23 changed files with 1,286 additions and 481 deletions.
5 changes: 3 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ android {
} else {
java.srcDirs += 'src/main/mapbox-v11-compat/v10'
}
java.srcDirs += 'src/main/rn-compat/rn75'
if (safeExtGet("RNMapboxMapsUseV11", false)) {
logger.warn("RNMapboxMapsUseV11 is deprecated, just set RNMapboxMapsVersion to 11.*")
}
Expand Down Expand Up @@ -164,9 +165,9 @@ dependencies {

// Dependencies
customizableDependencies('RNMapboxMapsSupportLibs') {
implementation "com.android.support:support-vector-drawable:28.0.0"
//implementation "com.android.support:support-vector-drawable:28.0.0"
implementation "com.android.support:support-annotations:28.0.0"
implementation "com.android.support:appcompat-v7:28.0.0"
//implementation "com.android.support:appcompat-v7:28.0.0"
}
customizableDependencies('RNMapboxMapsOkHTTPLibs') {
implementation "com.squareup.okhttp3:okhttp:4.9.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.rnmapbox.rnmbx.utils.ViewTagResolver
import com.rnmapbox.rnmbx.utils.extensions.asBooleanOrNull
import com.rnmapbox.rnmbx.utils.extensions.asDoubleOrNull
import com.rnmapbox.rnmbx.utils.extensions.asStringOrNull
import com.rnmapbox.rnmbx.rncompat.dynamic.*

class RNMBXCameraManager(private val mContext: ReactApplicationContext, val viewTagResolver: ViewTagResolver) :
AbstractEventEmitter<RNMBXCamera?>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.mapbox.maps.ImageStretches
import com.rnmapbox.rnmbx.components.AbstractEventEmitter
import com.rnmapbox.rnmbx.events.constants.EventKeys
import com.rnmapbox.rnmbx.events.constants.eventMapOf
import com.rnmapbox.rnmbx.rncompat.dynamic.*
import com.rnmapbox.rnmbx.utils.ImageEntry
import com.rnmapbox.rnmbx.utils.Logger
import com.rnmapbox.rnmbx.utils.ResourceUtils
Expand Down Expand Up @@ -202,15 +203,13 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
images.setNativeImages(nativeImages)
}

override fun customEvents(): Map<String, String>? {
return eventMapOf(
override fun customEvents(): Map<String, String>? { return eventMapOf(
EventKeys.IMAGES_MISSING to "onImageMissing"
)
}

// region RNMBXImage children

override fun addView(parent: RNMBXImages?, childView: View?, childPosition: Int) {
override fun addView(parent: RNMBXImages, childView: View, childPosition: Int) {
if (parent == null || childView == null) {
Logger.e("RNMBXImages", "addView: parent or childView is null")
return
Expand All @@ -225,7 +224,7 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
childView.nativeImageUpdater = parent
}

override fun removeView(parent: RNMBXImages?, view: View?) {
override fun removeView(parent: RNMBXImages, view: View) {
if (parent == null || view == null) {
Logger.e("RNMBXImages", "removeView: parent or view is null")
return
Expand All @@ -234,7 +233,7 @@ class RNMBXImagesManager(private val mContext: ReactApplicationContext) :
parent.mImageViews.remove(view)
}

override fun removeAllViews(parent: RNMBXImages?) {
override fun removeAllViews(parent: RNMBXImages) {
if (parent == null) {
Logger.e("RNMBXImages", "removeAllViews parent is null")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewGroupManager
import com.facebook.react.uimanager.annotations.ReactProp
import com.facebook.react.viewmanagers.RNMBXCustomLocationProviderManagerInterface
import com.rnmapbox.rnmbx.rncompat.dynamic.*
import com.rnmapbox.rnmbx.utils.Logger


class RNMBXCustomLocationProviderManager : ViewGroupManager<RNMBXCustomLocationProvider>(),
RNMBXCustomLocationProviderManagerInterface<RNMBXCustomLocationProvider> {
override fun getName(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.google.gson.Gson
import com.google.gson.stream.JsonWriter
import com.mapbox.bindgen.Value
import com.mapbox.maps.extension.style.expressions.generated.Expression
import com.rnmapbox.rnmbx.rncompat.dynamic.*
import com.rnmapbox.rnmbx.utils.Logger
import com.rnmapbox.rnmbx.utils.extensions.toJsonArray
import java.io.StringWriter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ class NativeMapViewModule(context: ReactApplicationContext, val viewTagResolver:

override fun setHandledMapChangedEvents(
viewRef: ViewRefTag?,
events: ReadableArray,
promise: Promise
events: ReadableArray?,
promise: Promise?
) {
withMapViewOnUIThread(viewRef, promise) {
it.setHandledMapChangedEvents(events.asArrayString())
withMapViewOnUIThread(viewRef, promise!!) {
it.setHandledMapChangedEvents(events!!.asArrayString())
promise.resolve(null)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ open class RNMBXMapViewManager(context: ReactApplicationContext, val viewTagReso
}
}

override fun addView(mapView: RNMBXMapView?, childView: View?, childPosition: Int) {
override fun addView(mapView: RNMBXMapView, childView: View, childPosition: Int) {
mapView!!.addFeature(childView, childPosition)
}

override fun getChildCount(mapView: RNMBXMapView?): Int {
override fun getChildCount(mapView: RNMBXMapView): Int {
return mapView!!.featureCount
}

override fun getChildAt(mapView: RNMBXMapView?, index: Int): View? {
override fun getChildAt(mapView: RNMBXMapView, index: Int): View? {
return mapView!!.getFeatureAt(index)
}

override fun removeViewAt(mapView: RNMBXMapView?, index: Int) {
override fun removeViewAt(mapView: RNMBXMapView, index: Int) {
mapView!!.removeFeatureAt(index)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.facebook.react.viewmanagers.RNMBXStyleImportManagerInterface
import com.rnmapbox.rnmbx.components.AbstractEventEmitter
import com.rnmapbox.rnmbx.components.mapview.RNMBXMapView
import com.mapbox.bindgen.Value
import com.rnmapbox.rnmbx.rncompat.dynamic.*
import com.rnmapbox.rnmbx.utils.Logger
import com.rnmapbox.rnmbx.utils.extensions.toValueHashMap
import org.json.JSONObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.mapbox.maps.extension.style.types.StyleTransition
import com.rnmapbox.rnmbx.components.styles.RNMBXStyleFactory
import com.mapbox.maps.extension.style.expressions.generated.Expression
import com.mapbox.maps.extension.style.light.LightPosition
import com.rnmapbox.rnmbx.rncompat.dynamic.*
import com.rnmapbox.rnmbx.utils.ExpressionParser
import com.rnmapbox.rnmbx.utils.Logger
import java.util.ArrayList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.net.Uri
import android.util.Log
import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper
import com.mapbox.maps.extension.style.sources.generated.ImageSource
import com.rnmapbox.rnmbx.rncompat.resourcedrawableidhelper.*
import com.rnmapbox.rnmbx.utils.LatLngQuad
import java.net.URL

Expand Down Expand Up @@ -66,4 +67,5 @@ class RNMBXImageSource(context: Context?) : RNMBXSource<ImageSource?>(context) {
companion object {
const val LOG_TAG = "RNMBXImageSource"
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ import com.rnmapbox.rnmbx.components.AbstractEventEmitter
abstract class RNMBXTileSourceManager<T : RNMBXTileSource<*>?> internal constructor(
reactApplicationContext: ReactApplicationContext
) : AbstractEventEmitter<T>(reactApplicationContext) {
override fun getChildAt(source: T, childPosition: Int): View {
override fun getChildAt(source: T & Any, childPosition: Int): View {
return source!!.getChildAt(childPosition)
}

override fun getChildCount(source: T): Int {
override fun getChildCount(source: T & Any): Int {
return source!!.childCount
}

override fun addView(source: T, childView: View, childPosition: Int) {
override fun addView(source: T & Any, childView: View, childPosition: Int) {
source!!.addLayer(childView, childPosition)
}

override fun removeViewAt(source: T, childPosition: Int) {
override fun removeViewAt(source: T & Any, childPosition: Int) {
source!!.removeLayer(childPosition)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.ReadableType
import com.mapbox.bindgen.Value
import com.rnmapbox.rnmbx.rncompat.dynamic.*

fun ReadableMap.toValueHashMap(): HashMap<String, Value> {
var result = hashMapOf<String, Value>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import com.mapbox.geojson.MultiPolygon
import com.mapbox.geojson.Point
import com.mapbox.geojson.Polygon
import com.mapbox.maps.EdgeInsets
import com.rnmapbox.rnmbx.rncompat.readable_map.*
import com.rnmapbox.rnmbx.utils.ConvertUtils
import com.rnmapbox.rnmbx.utils.Logger

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.rnmapbox.rnmbx.rncompat.dynamic

import com.facebook.react.bridge.Dynamic
import com.facebook.react.bridge.ReadableType


fun Dynamic.getType(): ReadableType {
return type
}

/*
val Dynamic.type: ReadableType
get() { return this.getType() }
*/
/*
val Dynamic.isNull: Boolean
get() { return this.isNull() }
*/
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.rnmapbox.rnmbx.rncompat.readable_map
import com.facebook.react.bridge.ReadableMap

fun ReadableMap.getEntryIterator(): Iterator<Map. Entry<String, Any>>
{
return this.entryIterator
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.rnmapbox.rnmbx.rncompat.resourcedrawableidhelper;

import com.facebook.react.views.imagehelper.ResourceDrawableIdHelper

public fun ResourceDrawableIdHelper.Companion.getInstance(): ResourceDrawableIdHelper {
return this.instance
}
3 changes: 2 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
Expand Down
2 changes: 1 addition & 1 deletion example/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function (api) {
api.cache(true);

return {
presets: ['babel-preset-expo'],
presets: ['@react-native/babel-preset'], //'babel-preset-expo'],
plugins: [
[
'module-resolver',
Expand Down
Loading

0 comments on commit 0c1e75c

Please sign in to comment.