All rules

Sheath rule

native-unsupported-event

NativePHP event directives must target an element or child component that can receive them.
Package
NativePHP
Category
Native
Default severity
warning by default
Auto-fix
Manual fix

#Why

An event binding can compile even when the target never dispatches that event. The callback then cannot run.

#Examples

#Bad

{{-- column never dispatches a change event. --}}
<native:column @change="save">
<native:text>Account</native:text>
</native:column>

#Good

{{-- toggle dispatches change events. --}}
<native:toggle @change="save" />

#Elements And Components

Supported events follow the installed NativePHP element catalog. Registered plugin elements can add event support.

Arbitrary custom events work only on registered child components. Reserved native events such as @press and @change are not valid custom event names on a child component:

<native:user-card @saved="refreshCards" />

#Notes

Only final effective event attributes are checked. Blade constructs that are not event bindings are ignored. A valid event must still name a usable callback with enough arguments.

#Options

All NativePHP rules accept nativeViewPaths. The default is ['views/native/']. See Native View Detection for path configuration.

#See Also

Related rules validate handlers and two-way state: