(
_h: Native.H<Msg>,
options: {
readonly props: ButtonProps
/** The message a click or tap sends. */
readonly onActivate?: View.Handler<NoInfer<Msg>, {}> | undefined
/** What Android shows instead, such as a `Pressable`. */
readonly fallback?: Native.NoTextInput<Msg, R> | undefined
}
)
| 114 | * @since 4.2.0 |
| 115 | */ |
| 116 | export const Button = <Msg, R = never>( |
| 117 | _h: Native.H<Msg>, |
| 118 | options: { |
| 119 | readonly props: ButtonProps |
| 120 | /** The message a click or tap sends. */ |
| 121 | readonly onActivate?: View.Handler<NoInfer<Msg>, {}> | undefined |
| 122 | /** What Android shows instead, such as a `Pressable`. */ |
| 123 | readonly fallback?: Native.NoTextInput<Msg, R> | undefined |
| 124 | } |
| 125 | ): ButtonElement<Msg, R> => { |
| 126 | const { fallback, onActivate, props } = options |
| 127 | const disabled = props.disabled === true |
| 128 | const element = View.withFields(buttonBase as ButtonElement<Msg>, { |
| 129 | elementProps: { |
| 130 | symbol: props.symbol, |
| 131 | label: props.label, |
| 132 | bezel: props.bezel, |
| 133 | tintColor: props.tint, |
| 134 | size: props.size, |
| 135 | disabled, |
| 136 | accessibilityLabel: props.accessibilityLabel ?? props.label |
| 137 | }, |
| 138 | ...(disabled || onActivate === undefined ? {} : { handlers: { activate: onActivate } }) |
| 139 | }) |
| 140 | return fallback === undefined ? element : element.children(fallback) as any |
| 141 | } |
no test coverage detected