Skip to content

feat: add new attributes and descriptions for RN environment components - #113

Merged
wangshunnn merged 1 commit into
mainfrom
feat-mpx2rn-props
Jul 1, 2026
Merged

feat: add new attributes and descriptions for RN environment components#113
wangshunnn merged 1 commit into
mainfrom
feat-mpx2rn-props

Conversation

@wangshunnn

@wangshunnn wangshunnn commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Expanded support for more native component attributes and events across views, scroll views, swipers, movable views, pickers, inputs, textareas, images, and web views.
    • Added new styling, gesture, and interaction options such as hover settings, fast-image support, indicator sizing, and selection controls.
  • Bug Fixes

    • Broadened common attribute handling so shared behavior is available more consistently across native components.
  • Chores

    • Updated component metadata and type definitions to reflect the latest supported attributes and event bindings.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR expands the React Native native component type definitions and documentation. It adds a shared MpxRnCommonAttrs type intersected into all native component attributes, extends numerous component interfaces (view, scroll-view, swiper, movable-view, picker, input, textarea, image) with new props and event handlers, adds a MpxWebView interface, and mirrors these additions in the language-service template metadata.

Changes

RN Native Component Typings and Metadata

Layer / File(s) Summary
Shared common attribute types and index mapping
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes.ts, packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts
Introduces MpxAnimationType, MpxPickerRangeItem, MpxRnCommonAttrs; intersects them into MpxNativeComponents index signature via Kubab2Camel; extends NativeComponentAttrs with new component keys (picker-view-column, web-view, video-room, map, canvas).
View/cover-image/cover-view hover and transition attributes
nativeComponentsTypes(.ts/_refer.ts), packages/language-service/src/data/template.ts
Restructures MpxCoverImage/MpxCoverView via interface extension; adds hover-style, animation/background flags, transition end handlers, and matching template metadata.
Movable-view and scroll-view gesture/refresher attributes
same files
Adds simultaneous-handlers/wait-for/disable-event-passthrough and touch handlers to movable components; expands scroll-view with enhanced/paging/sticky/refresher/observer props and bindscrollend.
Swiper indicator/gesture attributes
same files
Adds indicator sizing/spacing/margin, scale/easing, gesture handler props, disableGesture, and bindchangestart.
Text/button/input/textarea props and event handlers
same files
Adds decode, is-simple, hover-style, placeholder-class, cursor-color, keyboard-type, and additional bind* event handlers.
Picker/picker-view range and mask configuration
same files
Adds range/range-key/value/start/end/fields/custom-item/level props, selection events, and mask-style/indicator-class/enable-wheel-animation props.
Image fast-image flag and new WebView component
same files
Adds enable-fast-image to image types and template; introduces MpxWebView interface with src and message/load/error handlers.
Global RN common attributes documentation
packages/language-service/src/data/template.ts
Adds enable-offset, enable-var, parent-font-size, parent-width, parent-height to globalAttributes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • mpx-ecology/language-tools#6: Both PRs update nativeComponentsTypes_refer.ts by expanding NativeComponentAttrs and component attribute interfaces such as MpxCoverImage/MpxCoverView, MpxMovableView, MpxScrollView, MpxSwiper, MpxView, MpxText.
  • mpx-ecology/language-tools#10: Both PRs modify the MpxNativeComponents type-mapping pipeline using Kubab2Camel, with this PR layering & MpxRnCommonAttrs onto that mapping.

Poem

A rabbit hops through props galore,
Adding handlers, one prop more,
Hover, cursor, scale, and glow,
WebView springs up, row by row,
Native components, richly dressed—
This RN warren is quite blessed! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the PR's main change: adding RN-specific component attributes and related descriptions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-mpx2rn-props

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

♻️ Duplicate comments (2)
packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts (2)

354-360: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Mirrors the bindselectionchange vs bind:selectionchange mismatch flagged in nativeComponentsTypes.ts.

Same concern as nativeComponentsTypes.ts — this file's bindselectionchange (lines 360, 454) does not match the bind:selectionchange naming used in template.ts.

Also applies to: 448-454

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts`
around lines 354 - 360, The native component event typings in
nativeComponentsTypes_refer.ts use bindselectionchange, which is inconsistent
with the bind:selectionchange naming used by template.ts and the related
nativeComponentsTypes.ts entry. Update the affected type definitions in the
corresponding native component interfaces so the event name matches the template
syntax consistently wherever bindselectionchange appears, using the same symbol
group that defines the input-related event props.

195-202: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Mirrors the disableGesture casing inconsistency flagged in nativeComponentsTypes.ts.

Same issue as nativeComponentsTypes.ts line 195 — disableGesture (line 200) should be kebab-case ('disable-gesture') to be consistent with sibling attributes and correctly handled by the Kubab2Camel mapping.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts`
around lines 195 - 202, The native component props type still uses camelCase for
the gesture toggle, which is inconsistent with the other attribute names and
won’t map correctly through Kubab2Camel. Update the prop definition in
nativeComponentsTypes_refer.ts within the native components type block to use
the kebab-case key alongside the existing attributes, and keep the matching
handling aligned with the same shape used in nativeComponentsTypes.ts and
related type codegen helpers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/language-core/src/codegen/globalTypes/nativeComponentsTypes.ts`:
- Around line 349-355: The `bindselectionchange` event name is inconsistent
between `nativeComponentsTypes.ts` and `template.ts`; make both use the same
naming convention. Update the `MpxInput` and `MpxTextarea` event
declaration/docs so the autocomplete metadata and type definitions agree, and
keep the event name aligned with the existing no-colon `bind*` pattern used for
the other handlers.
- Around line 190-197: The native component attribute for disableGesture is
inconsistent with the kebab-case convention used by the generated types, so
update the generated declarations to use the kebab-case form and keep
Kubab2Camel-based consumption consistent. Change the disableGesture property in
nativeComponentsTypes.ts to the kebab-case attribute name, then update the
matching template.ts entry for disableGesture and the
nativeComponentsTypes_refer.ts reference so all three symbols stay aligned.

In `@packages/language-service/src/data/template.ts`:
- Around line 1822-1829: The event name entries for selection change are
inconsistent with the underlying native component property names and the rest of
this template file. Update both `bind:selectionchange` definitions in
`template.ts` to use the no-colon form that matches `MpxInput`/`MpxTextarea`
(`bindselectionchange`), keeping the existing descriptions unchanged so editor
suggestions align with the interface declarations and other event entries.
- Around line 622-659: The template autocomplete metadata for the swiper prop is
using camelCase for the `disableGesture` entry, which is inconsistent with the
other kebab-case attributes. Update the `template.ts` entry under the
swiper-related descriptions to use `disable-gesture`, and make the same casing
change in the corresponding `MpxSwiper` type definitions in
`nativeComponentsTypes.ts` and `nativeComponentsTypes_refer.ts` so autocomplete
and types stay aligned.

---

Duplicate comments:
In
`@packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts`:
- Around line 354-360: The native component event typings in
nativeComponentsTypes_refer.ts use bindselectionchange, which is inconsistent
with the bind:selectionchange naming used by template.ts and the related
nativeComponentsTypes.ts entry. Update the affected type definitions in the
corresponding native component interfaces so the event name matches the template
syntax consistently wherever bindselectionchange appears, using the same symbol
group that defines the input-related event props.
- Around line 195-202: The native component props type still uses camelCase for
the gesture toggle, which is inconsistent with the other attribute names and
won’t map correctly through Kubab2Camel. Update the prop definition in
nativeComponentsTypes_refer.ts within the native components type block to use
the kebab-case key alongside the existing attributes, and keep the matching
handling aligned with the same shape used in nativeComponentsTypes.ts and
related type codegen helpers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 38593323-c855-41b8-abc6-ddce167b6fe7

📥 Commits

Reviewing files that changed from the base of the PR and between bfdad1d and 26c1350.

📒 Files selected for processing (3)
  • packages/language-core/src/codegen/globalTypes/nativeComponentsTypes.ts
  • packages/language-core/src/codegen/globalTypes/nativeComponentsTypes_refer.ts
  • packages/language-service/src/data/template.ts

Comment thread packages/language-service/src/data/template.ts
Comment thread packages/language-service/src/data/template.ts
@wangshunnn
wangshunnn merged commit 2ee2d3f into main Jul 1, 2026
2 checks passed
@wangshunnn
wangshunnn deleted the feat-mpx2rn-props branch July 20, 2026 12:00
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