File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
android/src/main/java/com/reactnativecommunity/imageeditor Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,15 @@ class ImageEditorModuleImpl(private val reactContext: ReactApplicationContext) {
87
87
}
88
88
}
89
89
90
+ /* *
91
+ * React Native
92
+ * - 0.77.x: toHashMap(): HashMap<String, Any?>?
93
+ * - 0.76.x: toHashMap(): HashMap<String, Any>?
94
+ */
95
+ fun <V > safeConvert (map : HashMap <String , V >? ): HashMap <String , Any >? {
96
+ return map?.filterValues { it != null } as ? HashMap <String , Any >
97
+ }
98
+
90
99
/* *
91
100
* Crop an image. If all goes well, the promise will be resolved with the file:// URI of the new
92
101
* image as the only argument. This is a temporary file - consider using
@@ -102,7 +111,7 @@ class ImageEditorModuleImpl(private val reactContext: ReactApplicationContext) {
102
111
fun cropImage (uri : String? , options : ReadableMap , promise : Promise ) {
103
112
val headers =
104
113
if (options.hasKey(" headers" ) && options.getType(" headers" ) == ReadableType .Map )
105
- options.getMap(" headers" )?.toHashMap()
114
+ safeConvert( options.getMap(" headers" )?.toHashMap() )
106
115
else null
107
116
val format = if (options.hasKey(" format" )) options.getString(" format" ) else null
108
117
val offset = if (options.hasKey(" offset" )) options.getMap(" offset" ) else null
You can’t perform that action at this time.
0 commit comments