Interaction and lifecycle modifiers - #27
Merged
Merged
Conversation
…Change, disabled)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second parity tier: gestures and lifecycle. Adds closure-carrying modifiers, which register a callback against the resolve context and embed its id in the emitted node — wired to Compose
clickable/DisposableEffect/LaunchedEffect.New modifiers
.onTapGesture— folds toModifier.clickable.onAppear/.onDisappear— aDisposableEffectkeyed within the node's identity scope, so appear fires once on entry and disappear on exit, surviving recomposition.task— launched once on appear as a SwiftTask(v1 does not cancel on disappear).onChange(of:)— fires when a value token changes between evaluations (skipping the initial composition).disabled(_:)— dims content;Buttonalso drops interactivity via itsenabledparameterCore change
Modifiers previously emitted a context-free node. Added
_ContextualModifierProvider(preferred over the plain_modifierNodeproperty when present) and_CallbackModifier, so a modifier can register a callback at resolve time. Additive — existing modifiers and conformers are untouched.Verification
swift test— 4 new emission tests (incl. invoking a registered tap callback), 39 total passingDeferred
.taskcancellation on disappear; gesture variants beyond tap (drag/long-press). Environment-scoped.disabledpropagation (applies where set / directly on a Button for now).