Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import android.text.Editable
import android.text.InputType
import android.text.InputFilter
import android.text.Spanned
import android.text.TextUtils
import android.text.TextWatcher
import android.text.style.ReplacementSpan
import android.util.TypedValue
Expand Down Expand Up @@ -281,10 +282,17 @@ class T3ComposerEditorView(context: Context, appContext: AppContext) : ExpoView(
}

fun setSingleLineCentered(centered: Boolean) {
editor.gravity = if (centered) {
Gravity.CENTER_VERTICAL or Gravity.START
if (centered) {
editor.isSingleLine = true
editor.maxLines = 1
editor.ellipsize = TextUtils.TruncateAt.END
editor.gravity = Gravity.CENTER_VERTICAL or Gravity.START
} else {
Gravity.TOP or Gravity.START
editor.isSingleLine = false
editor.maxLines = Int.MAX_VALUE
editor.ellipsize = null
editor.gravity = Gravity.TOP or Gravity.START
updateInputFlags()
}
}

Expand Down
6 changes: 3 additions & 3 deletions apps/mobile/src/features/threads/ThreadComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -828,8 +828,8 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
onBlur={handleBlur}
onSubmit={handleSend}
scrollEnabled={isExpanded}
// Android: collapsed single line centers natively (gravity) in
// a pill-height box matching the send button; iOS keeps insets.
// Android: collapsed single line centers natively and ellipsizes
// in a pill-height box close to the send button; iOS keeps insets.
singleLineCentered={!isExpanded}
contentInsetVertical={isExpanded || Platform.OS === "android" ? 0 : 6}
style={
Expand All @@ -840,7 +840,7 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer
paddingVertical: 4,
}
: {
height: 36,
minHeight: 40,
}
}
textStyle={{
Expand Down
Loading