@mornya/react-social-libs
Version:
The project of React.js Social Share and Widget modules.
64 lines (63 loc) • 2.41 kB
TypeScript
import { Platform } from '@mornya/platform-libs';
import React from 'react';
import BaseComponent from './BaseComponent';
interface Props<T extends Social.IExtra> {
title?: string;
extra?: T;
defaultIconSize?: number;
className?: string;
style?: React.CSSProperties;
onBefore?(): any;
onComplete?(isSuccess: boolean, response: any): void;
onError?(error: {
type: string;
message: string;
}): void;
children?(childrenParams: ShareChildrenParams): React.ReactElement;
}
interface State<T extends Social.IExtra> {
OG?: Social.IMetaContent;
extra?: T;
defaultIconScale: number;
defaultIconPos: number;
apiStep: number;
isRunning: boolean;
}
export declare class BaseShareComponent<T extends Social.IExtra> extends BaseComponent<Props<T>, State<T>> {
static defaultProps: {
defaultIconSize: number;
onBefore(): void;
onComplete(): void;
onError(err: {
message: string;
}): void;
};
readonly state: State<T>;
protected deviceInfo: Platform.Info;
protected readonly id: string;
protected shareId: string;
private shareName;
private defaultExtra;
private SHARE_ERRORS;
constructor(props: Props<T>);
static getDerivedStateFromProps(nextProps: Props<Social.IExtra>): {
defaultIconScale: number;
defaultIconPos: number;
};
componentDidMount(): void;
componentDidUpdate(prevProps: Props<T>, prevState: State<T>): void;
componentWillUnmount(): void;
initialize(shareId: string, defaultExtra: T): void;
getApiStep(): number;
setApiStep(callback?: (...args: any[]) => any): void;
onInit(): void;
onMount(_extra: T): void;
onShare(_extra: T, _OG: Social.IMetaContent): void;
onComplete(isSuccess: boolean, response: any): void;
onError(type: string): void;
onClickShare(): void;
onUnmount(_extra: T): void;
renderShareButton: ({ id, label, className, style }: RenderShareButtonParams) => React.ReactNode;
render(): string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
}
export {};