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

The property currentParagraphStyle doesn't change its state #190

Closed
SanEffect opened this issue Jan 31, 2024 · 0 comments
Closed

The property currentParagraphStyle doesn't change its state #190

SanEffect opened this issue Jan 31, 2024 · 0 comments

Comments

@SanEffect
Copy link

Hello.
I found that the method state.addParagraphStyle(ParagraphStyle(textAlign = TextAlign.Center)) doesn't work. No matter what I specify as a parameter (TextAlign.Center or TextAlign.Right), it always remains the same.
I have the following code:

Button(onClick = {
	state.addParagraphStyle(ParagraphStyle(textAlign = TextAlign.Center))
	log{ "textAlign: ${state.currentParagraphStyle.textAlign}" }
}) {
	Icon(Icons.Outlined.FormatAlignCenter, contentDescription = null)
}

When I click on this button I see the following log - "textAlign: Left".
I also tried specifying state.toggleParagraphStyle(ParagraphStyle(textAlign = TextAlign.Center)).

The changes are reflected in the editor, the text is aligned left and right, as well as centered. But the currentParagraphStyle state does not change, it always remains as Left.

Jetpack Compose Version: 1.6.0
Material3 Version: 1.1.2

@SanEffect SanEffect changed the title Methods addParagraphStyle/toggleParagraphStyle doesn't work The property currentParagraphStyle doesn't change its state Jan 31, 2024
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