mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-17 18:54:11 +08:00
feat(react): add custom elements bundle (#23896)
This commit is contained in:
@ -2,7 +2,13 @@ import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import { OverlayEventDetail } from './interfaces';
|
||||
import { StencilReactForwardedRef, attachProps, setRef } from './utils';
|
||||
import {
|
||||
StencilReactForwardedRef,
|
||||
attachProps,
|
||||
dashToPascalCase,
|
||||
defineCustomElement,
|
||||
setRef,
|
||||
} from './utils';
|
||||
|
||||
interface OverlayElement extends HTMLElement {
|
||||
present: () => Promise<void>;
|
||||
@ -22,9 +28,13 @@ export const createOverlayComponent = <
|
||||
OverlayComponent extends object,
|
||||
OverlayType extends OverlayElement
|
||||
>(
|
||||
displayName: string,
|
||||
controller: { create: (options: any) => Promise<OverlayType> }
|
||||
tagName: string,
|
||||
controller: { create: (options: any) => Promise<OverlayType> },
|
||||
customElement?: any
|
||||
) => {
|
||||
defineCustomElement(tagName, customElement);
|
||||
|
||||
const displayName = dashToPascalCase(tagName);
|
||||
const didDismissEventName = `on${displayName}DidDismiss`;
|
||||
const didPresentEventName = `on${displayName}DidPresent`;
|
||||
const willDismissEventName = `on${displayName}WillDismiss`;
|
||||
|
Reference in New Issue
Block a user