Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BasicRichTextEditor doesn't scroll down when the text reaches the end. #434

Open
easy-apps-2018 opened this issue Nov 22, 2024 · 1 comment

Comments

@easy-apps-2018
Copy link

This is my implementation of BasicRichTextEditor:

BasicRichTextEditor(
                state = textState,
                readOnly = readOnly,
                decorationBox = { innerTextField ->
                    RichTextEditorDefaults.RichTextEditorDecorationBox(
                        enabled = true,
                        singleLine = false,
                        placeholder = {
                            Text(
                                text = rememberString(id = R.string.note),
                                style = MaterialTheme.typography.bodyLarge
                            )
                        },
                        value = textState.toText(),
                        innerTextField = innerTextField,
                        interactionSource = interactionSource,
                        colors = RichTextEditorDefaults.richTextEditorColors(
                            placeholderColor = Color.LightGray,
                            containerColor = Color.Transparent,
                            focusedIndicatorColor = Color.Transparent,
                            unfocusedIndicatorColor = Color.Transparent,
                            cursorColor = MaterialTheme.colorScheme.secondary
                        ),
                        visualTransformation = VisualTransformation.None,
                        contentPadding = RichTextEditorDefaults.richTextEditorWithoutLabelPadding(
                            end = 6.dp,
                            top = 10.dp,
                            start = 6.dp,
                            bottom = 10.dp
                        )
                    )

                },
                interactionSource = interactionSource,
                textStyle = MaterialTheme.typography.bodyLarge,
                modifier = Modifier.weight(weight = 1f).fillMaxSize(),
                cursorBrush = SolidColor(value = MaterialTheme.colorScheme.secondary)
            )

and the problem is when the text reaches the end it goes behind the keyboard instead of scrolling down. Also, when you move cursor, the scrolling doesn't work.

I added this line to the MainActivity
WindowCompat.setDecorFitsSystemWindows(window, false)

and modified manifest by adding
android:windowSoftInputMode="adjustResize"

I tried to add them one by one and replaced by by each other. No effect.

Screen_recording_20241122_102939.webm

Any thoughts? Thanks

@easy-apps-2018
Copy link
Author

If I add imePadding() to the Modifier of BasicRichTextEditor, it works, but adds huge padding between keyboard and the BasicRichTextEditor.
Any other solution to make it scrollable once cursor reaches end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant