-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLuggCalloutViewManager.kt
More file actions
38 lines (31 loc) · 1.38 KB
/
LuggCalloutViewManager.kt
File metadata and controls
38 lines (31 loc) · 1.38 KB
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
package com.luggmaps
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.module.annotations.ReactModule
import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.ViewGroupManager
import com.facebook.react.uimanager.ViewManagerDelegate
import com.facebook.react.viewmanagers.LuggCalloutViewManagerDelegate
import com.facebook.react.viewmanagers.LuggCalloutViewManagerInterface
@ReactModule(name = LuggCalloutViewManager.NAME)
class LuggCalloutViewManager :
ViewGroupManager<LuggCalloutView>(),
LuggCalloutViewManagerInterface<LuggCalloutView> {
private val delegate: ViewManagerDelegate<LuggCalloutView> = LuggCalloutViewManagerDelegate(this)
override fun getDelegate(): ViewManagerDelegate<LuggCalloutView> = delegate
override fun getName(): String = NAME
override fun createViewInstance(context: ThemedReactContext): LuggCalloutView = LuggCalloutView(context)
override fun setBubbled(view: LuggCalloutView, value: Boolean) {
view.bubbled = value
}
override fun setAnchor(view: LuggCalloutView, value: ReadableMap?) {
view.anchorX = value?.getDouble("x")?.toFloat() ?: 0.5f
view.anchorY = value?.getDouble("y")?.toFloat() ?: 1.0f
}
override fun onDropViewInstance(view: LuggCalloutView) {
super.onDropViewInstance(view)
view.onDropViewInstance()
}
companion object {
const val NAME = "LuggCalloutView"
}
}