Skip to content

feat: add dynamic toast presentation and richer interactions - #4

Merged
victorycodedev merged 6 commits into
mainfrom
feat/toast-polish
Oct 21, 2026
Merged

victorycodedev merged 6 commits into
mainfrom
feat/toast-polish

Conversation

@victorycodedev

Copy link
Copy Markdown
Owner

What changed?

  • Added polished toast presentation controls, including predefined icon sizes, expanded animation options, independent animation direction, and content-update crossfades.
  • Added presentation('dynamic') and the dynamic() shortcut with expanding/collapsing foreground-pill designs for iOS and Android.
  • Added whole-toast press handling through the new ToastPressed event.
  • Added optional JSON-serializable data() payloads for body-press and action events. Toast body presses remain opt-in and are enabled only when non-empty data is attached.
  • Added actions() for one or two actions while preserving the existing action(string $label, string $id) API.
  • Added optional per-action colors, with fallback to actionColor() or the platform default.
  • Preserved automatic dismissal after action presses and ensured action/close controls do not also emit body-press events.
  • Improved Android queued transitions and dynamic-action alignment.
  • Improved accessibility, RTL-aware layouts, native renderer behavior, and Android/iOS parity.
  • Updated PHP and JavaScript builders, native bridge normalization, native renderers, events, tests, manifest declarations, and documentation.

Why?

ToastKit needed a richer presentation mode for foreground notifications, smoother visual updates, actionable whole-toast interactions, and support for compact two-choice workflows without breaking existing applications.

This change keeps the established single-action and standard-presentation behavior intact while adding opt-in dynamic presentation, attached event context, and multiple actions.

How was it tested?

Automated checks:

  • composer validate --strict
  • composer test — 190 tests passed, 378 assertions
  • node --test resources/js/tests/*.test.js — 37 tests passed
  • node --check resources/js/*.js
  • nativephp.json parsed with JSON_THROW_ON_ERROR
  • Relevant Swift sources parsed with xcrun swiftc -parse
  • git diff --check

Manual/runtime checks:

  • Tested the new and existing toast behavior in generated NativePHP applications.
  • Verified standard, dynamic, and native presentations on Android and iOS emulators.
  • Verified entrance/exit animations, queued transitions, content updates, swipe dismissal, close controls, whole-toast presses, attached data, single actions, two actions, action colors, and automatic action dismissal.
  • Verified that existing toasts without attached data do not become body-tappable.

Platforms tested

  • PHP
  • JavaScript
  • Android
  • iOS
  • Not applicable / documentation only

Breaking changes?

None.

The existing action(string $label, string $id) API and legacy single-action bridge payload remain supported. Dynamic presentation, attached data, body presses, multiple actions, and individual action colors are opt-in.

When action() and actions() are both used on the same builder, the last method called wins.

Checklist

  • Tests were added or updated where appropriate.
  • Existing relevant tests pass.
  • Documentation was updated where necessary.
  • Public API and event/bridge compatibility were considered.
  • Android/iOS behavior parity was considered where relevant.
  • No unnecessary native dependencies were introduced.
  • No secrets, tokens, temporary logging, or debugging code were committed.
  • Native changes were tested in a generated NativePHP application where practical.

@victorycodedev
victorycodedev merged commit 2f1ffec into main Oct 21, 2026
2 checks passed
@victorycodedev
victorycodedev deleted the feat/toast-polish branch October 21, 2026 20:12
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.

1 participant