-
Notifications
You must be signed in to change notification settings - Fork 120
/
Copy pathImageEditorModule.kt
46 lines (37 loc) · 1.53 KB
/
ImageEditorModule.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.reactnativecommunity.imageeditor
import com.facebook.imagepipeline.core.ImagePipeline
import com.facebook.react.bridge.Promise
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.views.image.ReactCallerContextFactory
@ReactModule(name = ImageEditorModule.NAME)
class ImageEditorModule : NativeRNCImageEditorSpec {
private val moduleImpl: ImageEditorModuleImpl
constructor(reactContext: ReactApplicationContext) : super(reactContext) {
moduleImpl = ImageEditorModuleImpl(reactContext, this, null, null)
}
constructor(reactContext: ReactApplicationContext, callerContext: Any?) : super(reactContext) {
moduleImpl = ImageEditorModuleImpl(reactContext, callerContext, null, null)
}
constructor(
reactContext: ReactApplicationContext,
imagePipeline: ImagePipeline?,
callerContextFactory: ReactCallerContextFactory?
) : super(reactContext) {
moduleImpl = ImageEditorModuleImpl(reactContext, null, callerContextFactory, imagePipeline)
}
override fun getName(): String {
return ImageEditorModuleImpl.NAME
}
override fun invalidate() {
moduleImpl.invalidate()
super.invalidate()
}
override fun cropImage(uri: String, cropData: ReadableMap, promise: Promise) {
moduleImpl.cropImage(uri, cropData, promise)
}
companion object {
const val NAME = ImageEditorModuleImpl.NAME
}
}