Skip to content

Commit

Permalink
- Added support for keyboardOption and keyboardAction
Browse files Browse the repository at this point in the history
  • Loading branch information
askNilesh committed Mar 21, 2024
1 parent 31297e0 commit b38a4c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
Expand Down Expand Up @@ -91,6 +93,8 @@ import com.tarkalabs.tarkaui.theme.TUITheme
containerColor = TUITheme.colors.surface
),
scrollBehavior: TopAppBarScrollBehavior? = null,
keyboardOption: KeyboardOptions = KeyboardOptions.Default,
keyboardAction: KeyboardActions = KeyboardActions.Default,
tags: TUIAppTopBarTags = TUIAppTopBarTags(),
) {

Expand Down Expand Up @@ -126,7 +130,9 @@ import com.tarkalabs.tarkaui.theme.TUITheme
},
onQueryTextChange = {
onSearchQuery(it)
})
},
keyboardAction = keyboardAction,
keyboardOption = keyboardOption)
} else {
TopAppBar(
title = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
Expand Down Expand Up @@ -37,6 +39,8 @@ import kotlinx.coroutines.delay
query: String,
placeholder: String,
trailingIcon: TarkaIcon = TarkaIcons.Regular.Dismiss24,
keyboardOption: KeyboardOptions = KeyboardOptions.Default,
keyboardAction: KeyboardActions = KeyboardActions.Default,
onQueryTextChange: (String) -> Unit,
leadingIcon: TarkaIcon? = null,
onLeadingIconClick: (() -> Unit)? = null,
Expand All @@ -52,13 +56,9 @@ import kotlinx.coroutines.delay
val leadingIconLambda: @Composable (() -> Unit)? = if (leadingIcon != null) {
{
TUIIconButton(
icon = leadingIcon,
buttonSize = L,
iconButtonStyle = GHOST,
onIconClick = {
icon = leadingIcon, buttonSize = L, iconButtonStyle = GHOST, onIconClick = {
onLeadingIconClick?.invoke()
},
tags = searchBarTags.leadingIconTags
}, tags = searchBarTags.leadingIconTags
)
}
} else null
Expand All @@ -84,6 +84,8 @@ import kotlinx.coroutines.delay
singleLine = true,
interactionSource = interactionSource,
textStyle = TUITheme.typography.body6,
keyboardActions = keyboardAction,
keyboardOptions = keyboardOption
) { innerTextField ->
TextFieldDefaults.DecorationBox(
value = query,
Expand Down

0 comments on commit b38a4c5

Please sign in to comment.