/
githubmirror
/
ionic-framework
Обзор
Документация
Войти
/
githubmirror
/
ionic-framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/react/src/components/navigation/IonTabButton.tsx
57 строк
2 KB
Shane
feat(react): fixing support for react 19, adding test app for react 19 (#30217)
03 мар 2025, 19:50
Не верифицирован
03 мар 2025, 19:50
f4941f2
Код
Авторство
О чём код?
import type { JSX as LocalJSX } from '@ionic/core/components'; import React from 'react'; import type { RouterOptions } from '../../models'; import type { IonicReactProps } from '../IonicReactProps'; import { IonTabButtonInner } from '../inner-proxies'; type Props = LocalJSX.IonTabButton & IonicReactProps & { routerOptions?: RouterOptions; ref?: React.Ref<HTMLIonTabButtonElement>; onClick?: (e: CustomEvent) => void; onPointerDown?: React.PointerEventHandler<HTMLIonTabButtonElement>; onTouchEnd?: React.TouchEventHandler<HTMLIonTabButtonElement>; onTouchMove?: React.TouchEventHandler<HTMLIonTabButtonElement>; children?: React.ReactNode; }; export class IonTabButton extends React.Component<Props> { shouldComponentUpdate(): boolean { return true; } constructor(props: Props) { super(props); this.handleIonTabButtonClick = this.handleIonTabButtonClick.bind(this); } handleIonTabButtonClick() { if (this.props.onClick) { this.props.onClick( new CustomEvent('ionTabButtonClick', { detail: { tab: this.props.tab, href: this.props.href, routeOptions: this.props.routerOptions, }, }) ); } } render() { /** * onClick is excluded from the props, since it has a custom * implementation within IonTabBar.tsx. Calling onClick within this * component would result in duplicate handler calls. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars const { onClick, ...rest } = this.props; return <IonTabButtonInner onIonTabButtonClick={this.handleIonTabButtonClick} {...rest}></IonTabButtonInner>; } static get displayName() { return 'IonTabButton'; } }