@@ -3,16 +3,12 @@ package expo.modules.t3nativecontrols
33import android.content.Context
44import android.view.ViewGroup
55import androidx.compose.foundation.layout.WindowInsets
6- import androidx.compose.foundation.layout.Spacer
76import androidx.compose.foundation.layout.fillMaxSize
87import androidx.compose.material3.Icon
98import androidx.compose.material3.MaterialTheme
109import androidx.compose.material3.NavigationBar
1110import androidx.compose.material3.NavigationBarItem
1211import androidx.compose.material3.NavigationBarItemDefaults
13- import androidx.compose.material3.NavigationRail
14- import androidx.compose.material3.NavigationRailItem
15- import androidx.compose.material3.NavigationRailItemDefaults
1612import androidx.compose.material3.Text
1713import androidx.compose.material3.darkColorScheme
1814import androidx.compose.material3.lightColorScheme
@@ -39,7 +35,6 @@ class T3WorkspaceNavigationModule : Module() {
3935 Prop (" selectedTab" ) { view: T3WorkspaceNavigationView , value: String ->
4036 view.selectedTab = value
4137 }
42- Prop (" rail" ) { view: T3WorkspaceNavigationView , value: Boolean -> view.rail = value }
4338 Prop (" dark" ) { view: T3WorkspaceNavigationView , value: Boolean -> view.dark = value }
4439 Prop (" textScale" ) { view: T3WorkspaceNavigationView , value: Float -> view.textScale = value }
4540 Prop (" containerColor" ) { view: T3WorkspaceNavigationView , value: Int ->
@@ -59,7 +54,7 @@ class T3WorkspaceNavigationModule : Module() {
5954 }
6055}
6156
62- /* * One Material3 selection surface moves from below the list to its leading edge . */
57+ /* * Material3 bottom navigation for the compact workspace . */
6358class T3WorkspaceNavigationView (
6459 context : Context ,
6560 appContext : AppContext
@@ -69,7 +64,6 @@ class T3WorkspaceNavigationView(
6964
7065 private val onTabSelected by EventDispatcher ()
7166 var selectedTab by mutableStateOf(" threads" )
72- var rail by mutableStateOf(false )
7367 var dark by mutableStateOf(false )
7468 var textScale by mutableStateOf(1f )
7569 var containerColor by mutableStateOf(0 )
@@ -108,58 +102,29 @@ class T3WorkspaceNavigationView(
108102 setContent {
109103 MaterialTheme (colorScheme = if (dark) darkColorScheme() else lightColorScheme()) {
110104 val tabs = listOf (" threads" , " pullRequests" )
111- if (rail) {
112- NavigationRail (
113- modifier = Modifier .fillMaxSize(),
114- containerColor = Color (containerColor),
115- windowInsets = WindowInsets (0 ),
116- ) {
117- Spacer (Modifier .weight(1f ))
118- tabs.forEach { tab ->
119- NavigationRailItem (
120- selected = selectedTab == tab,
121- onClick = { onTabSelected(mapOf (" tab" to tab)) },
122- icon = { tabIcon(tab) },
123- label = {
124- val title = if (tab == " threads" ) " Chats" else " PRs"
125- Text (title, fontSize = (12 * textScale).sp)
126- },
127- colors = NavigationRailItemDefaults .colors(
128- selectedIconColor = Color (selectedColor),
129- selectedTextColor = Color (selectedColor),
130- indicatorColor = Color (indicatorColor),
131- unselectedIconColor = Color (unselectedColor),
132- unselectedTextColor = Color (unselectedColor),
133- ),
134- )
135- }
136- Spacer (Modifier .weight(1f ))
137- }
138- } else {
139- NavigationBar (
140- modifier = Modifier .fillMaxSize(),
141- containerColor = Color (containerColor),
142- tonalElevation = androidx.compose.ui.unit.Dp (0f ),
143- windowInsets = WindowInsets (0 ),
144- ) {
145- tabs.forEach { tab ->
146- NavigationBarItem (
147- selected = selectedTab == tab,
148- onClick = { onTabSelected(mapOf (" tab" to tab)) },
149- icon = { tabIcon(tab) },
150- label = {
151- val title = if (tab == " threads" ) " Chats" else " Pull requests"
152- Text (title, fontSize = (12 * textScale).sp)
153- },
154- colors = NavigationBarItemDefaults .colors(
155- selectedIconColor = Color (selectedColor),
156- selectedTextColor = Color (selectedColor),
157- indicatorColor = Color (indicatorColor),
158- unselectedIconColor = Color (unselectedColor),
159- unselectedTextColor = Color (unselectedColor),
160- ),
161- )
162- }
105+ NavigationBar (
106+ modifier = Modifier .fillMaxSize(),
107+ containerColor = Color (containerColor),
108+ tonalElevation = androidx.compose.ui.unit.Dp (0f ),
109+ windowInsets = WindowInsets (0 ),
110+ ) {
111+ tabs.forEach { tab ->
112+ NavigationBarItem (
113+ selected = selectedTab == tab,
114+ onClick = { onTabSelected(mapOf (" tab" to tab)) },
115+ icon = { tabIcon(tab) },
116+ label = {
117+ val title = if (tab == " threads" ) " Chats" else " Pull requests"
118+ Text (title, fontSize = (12 * textScale).sp)
119+ },
120+ colors = NavigationBarItemDefaults .colors(
121+ selectedIconColor = Color (selectedColor),
122+ selectedTextColor = Color (selectedColor),
123+ indicatorColor = Color (indicatorColor),
124+ unselectedIconColor = Color (unselectedColor),
125+ unselectedTextColor = Color (unselectedColor),
126+ ),
127+ )
163128 }
164129 }
165130 }
0 commit comments