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

Initial sync of StateV2 and LayoutDSL unstable projects #136

Merged
merged 7 commits into from
Feb 29, 2024

Conversation

Johni0702
Copy link
Contributor

No description provided.

Johni0702 and others added 7 commits February 29, 2024 15:33
Source-Commit: d15cb7684623e5662975c6c977e71ff498a6d411
Source-Commit: d15cb7684623e5662975c6c977e71ff498a6d411
Source-Commit: b6aabb62f7a3c09bda97f1853ee805bf92e3b477
This tag system allows us to reduce the amount of piping required when
attempting to find child components which are multiple layers deep,
that don't have a concrete type (e.g. components using LayoutDSL).

To use this, first, create an object (or data class) which inherits `Tag`:
```kt
object MyTag : Tag
```

Then, apply it:
```kt
forEach(list) { item ->
    box(Modifier.tag(MyTag) {
        ...
    }
}```

Finally, further up the call tree, you can use `findChildrenByTag`:
```kt
val component = somethingThatEventuallyCallsTheAboveCode()
val children = component.findChildrenByTag(MyTag, recursive = true)
```

Source-Commit: 5fb37595459b10263b81d4c49c23c1369973ea92
As determined by feature-flags-processor.

Source-Commit: be277773771aec8e52fda63bdd1cf0a72c06823d
Implementing `component1` and `component2` on `State<Pair<A, B>>` allows
it to be destructured into State<A> and State<B> through the following
syntax:
```kt
val (a, b) = stateBy<Pair<String, Int>> { firstState() to secondState() }
```

https://kotlinlang.org/docs/destructuring-declarations.html

Source-Commit: f3adf93fca1a35446adb039a64167da9e72324ac
…ions

Source-Commit: ade472fdc50a18f98a0b5a84ba3e97404b593b08
@Johni0702 Johni0702 merged commit 84bee44 into master Feb 29, 2024
1 check passed
@Johni0702 Johni0702 deleted the unstable/import branch February 29, 2024 14:51
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