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

Fix background parallax #1230

Merged
merged 4 commits into from
Nov 28, 2023
Merged

Fix background parallax #1230

merged 4 commits into from
Nov 28, 2023

Conversation

mlykotom
Copy link
Contributor

This used to be a feature, but then when replacing with LazyRow, it was dropped.
Let's fix it + use the deferred modifier to properly read scroll state.

@mlykotom mlykotom requested a review from a team as a code owner November 27, 2023 11:27
Copy link
Member

@bentrengrove bentrengrove left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for doing this

@@ -45,20 +47,37 @@ fun Modifier.offsetGradientBackground(
colors: List<Color>,
width: Float,
offset: Float = 0f
) = background(
) = this then background(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the this then here is double adding the modifier because you have implicitly captured this already by not doing Modifier.background but just background which is actually this.background

We probably need another lint check for this as well!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm actually not sure when you're supposed to use which. Happy to write the lint check!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You basically just have to use this somewhere in your implementation. By just writing background you've done it

@mlykotom mlykotom merged commit d8d341b into main Nov 28, 2023
3 checks passed
@mlykotom mlykotom deleted the tm/background-offset branch November 28, 2023 09:43
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

Successfully merging this pull request may close these issues.

2 participants