Skip to content

Add TextInput widget for text entry support - #12

Merged
jappeace merged 2 commits into
jappeace:masterfrom
jappeace-sloth:text-input-widget
Mar 27, 2026
Merged

jappeace merged 2 commits into
jappeace:masterfrom
jappeace-sloth:text-input-widget

Conversation

@jappeace-sloth

Copy link
Copy Markdown

Summary

  • Adds TextInput constructor to Widget ADT (placeholder, value, onChange callback)
  • Full-stack implementation: Haskell FFI, C bridge, Android JNI/Java (EditText + TextWatcher)
  • Text change events dispatch without re-render to avoid EditText cursor/flicker issues
  • 5 new tests covering text callbacks, ID space sharing, and callback reset

Test plan

  • cabal build passes
  • cabal test — all 26 tests pass (21 existing + 5 new)
  • APK builds and TextInput works on Android emulator/device

🤖 Generated with Claude Code

jappeace-sloth and others added 2 commits March 27, 2026 11:21
Extends the declarative UI framework with a TextInput widget that follows
a controlled-component pattern (Haskell owns the state). The widget takes
a placeholder hint, current value, and onChange callback.

Changes across the full stack:
- Widget ADT: new TextInput constructor
- UIBridge.h/hs: UI_NODE_TEXT_INPUT, UI_PROP_HINT, UI_EVENT_TEXT_CHANGE
- Render.hs: separate text callback registry, dispatchTextEvent
- HaskellMobile.hs: haskellOnUITextChange FFI export (no re-render to
  avoid EditText cursor flicker)
- Android JNI/Java: EditText creation, setHint, TextWatcher integration
- 5 new tests covering text callbacks, ID space sharing, and reset

Prompt: Implement TextInput widget for haskell-mobile as Phase 1 of gym PR tracker app

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds visibility: public to haskell-mobile-lifecycle and haskell-mobile-ui
sub-libraries, allowing external packages (like prrrrrrrrr) to depend on
them directly for Backpack instantiation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jappeace-sloth pushed a commit to jappeace-sloth/prrrrrrrrr that referenced this pull request Mar 27, 2026
PRRRRRRRRR — Olympic weightlifting 1RM personal record tracker using
haskell-mobile as the UI framework with Backpack signature instantiation.

Features:
- 12 Olympic weightlifting and strength exercises
- SQLite storage via bundled amalgamation (raw FFI)
- Two-screen UI: exercise list with PRs, weight entry with text input
- Controlled-component TextInput pattern for weight entry
- Weight parsing with validation (positive numbers only)

Architecture:
- Backpack: prrrrrrrrr-app-impl provides HaskellMobile.App
- prrrrrrrrr-app instantiates haskell-mobile with our implementation
- unsafePerformIO global state for DB init (same pattern as counter demo)
- Nix: shell.nix for dev, nix/android.nix for cross-compilation,
  nix/apk.nix for APK assembly

15 tests: model (3), storage (2), views (4), weight parsing (6)

Depends on haskell-mobile text-input-widget branch (jappeace/hatter#12)

Prompt: Implement prrrrrrrrr gym PR tracker as Phases 2-8 of plan

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jappeace
jappeace merged commit c09652b into jappeace:master Mar 27, 2026
2 checks passed
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