@@ -18,9 +18,7 @@ import android.widget.TextView
1818import androidx.appcompat.content.res.AppCompatResources
1919import coil3.ImageLoader
2020import coil3.asDrawable
21- import com.facebook.react.bridge.Arguments
2221import com.facebook.react.bridge.ReadableArray
23- import com.facebook.react.bridge.WritableMap
2422import com.facebook.react.common.assets.ReactFontManager
2523import com.facebook.react.modules.core.ReactChoreographer
2624import com.facebook.react.views.text.ReactTypefaceUtils
@@ -33,8 +31,8 @@ class ReactBottomNavigationView(context: Context) : BottomNavigationView(context
3331 private val iconSources: MutableMap <Int , ImageSource > = mutableMapOf ()
3432 private var isLayoutEnqueued = false
3533 var items: MutableList <TabInfo >? = null
36- var onTabSelectedListener: ((WritableMap ) -> Unit )? = null
37- var onTabLongPressedListener: ((WritableMap ) -> Unit )? = null
34+ var onTabSelectedListener: ((key : String ) -> Unit )? = null
35+ var onTabLongPressedListener: ((key : String ) -> Unit )? = null
3836 private var activeTintColor: Int? = null
3937 private var inactiveTintColor: Int? = null
4038 private val checkedStateSet = intArrayOf(android.R .attr.state_checked)
@@ -62,10 +60,7 @@ class ReactBottomNavigationView(context: Context) : BottomNavigationView(context
6260 private fun onTabLongPressed (item : MenuItem ) {
6361 val longPressedItem = items?.firstOrNull { it.title == item.title }
6462 longPressedItem?.let {
65- val event = Arguments .createMap().apply {
66- putString(" key" , longPressedItem.key)
67- }
68- onTabLongPressedListener?.invoke(event)
63+ onTabLongPressedListener?.invoke(longPressedItem.key)
6964 emitHapticFeedback(HapticFeedbackConstants .LONG_PRESS )
7065 }
7166 }
@@ -93,10 +88,7 @@ class ReactBottomNavigationView(context: Context) : BottomNavigationView(context
9388 }
9489 val selectedItem = items?.first { it.title == item.title }
9590 selectedItem?.let {
96- val event = Arguments .createMap().apply {
97- putString(" key" , selectedItem.key)
98- }
99- onTabSelectedListener?.invoke(event)
91+ onTabSelectedListener?.invoke(selectedItem.key)
10092 emitHapticFeedback(HapticFeedbackConstants .CONTEXT_CLICK )
10193 }
10294 }
0 commit comments