@remax/framework-shared
Version:
使用真正的 React 构建跨平台小程序
68 lines (67 loc) • 2.52 kB
TypeScript
import * as React from 'react';
import { Callback } from './lifecycle';
export interface PageProps<Q = Record<string, string | undefined>> {
location: {
query: Q;
};
}
export default function createPageWrapper(Page: React.ComponentType<any>, name: string): {
new (props: any): {
pageComponentInstance: any;
callbacks: Map<string, {
callbacks: Callback[];
}>;
callLifecycle(phase: string, ...args: any[]): any;
render(): React.FunctionComponentElement<React.ProviderProps<any>>;
context: any;
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{
page: any;
query: any;
}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
forceUpdate(callback?: (() => void) | undefined): void;
readonly props: Readonly<{
page: any;
query: any;
}> & Readonly<{
children?: React.ReactNode;
}>;
state: Readonly<{}>;
refs: {
[key: string]: React.ReactInstance;
};
componentDidMount?(): void;
shouldComponentUpdate?(nextProps: Readonly<{
page: any;
query: any;
}>, nextState: Readonly<{}>, nextContext: any): boolean;
componentWillUnmount?(): void;
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
getSnapshotBeforeUpdate?(prevProps: Readonly<{
page: any;
query: any;
}>, prevState: Readonly<{}>): any;
componentDidUpdate?(prevProps: Readonly<{
page: any;
query: any;
}>, prevState: Readonly<{}>, snapshot?: any): void;
componentWillMount?(): void;
UNSAFE_componentWillMount?(): void;
componentWillReceiveProps?(nextProps: Readonly<{
page: any;
query: any;
}>, nextContext: any): void;
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{
page: any;
query: any;
}>, nextContext: any): void;
componentWillUpdate?(nextProps: Readonly<{
page: any;
query: any;
}>, nextState: Readonly<{}>, nextContext: any): void;
UNSAFE_componentWillUpdate?(nextProps: Readonly<{
page: any;
query: any;
}>, nextState: Readonly<{}>, nextContext: any): void;
};
contextType?: React.Context<any> | undefined;
};