///
extends NewLifecycle
{ componentWillMount?(): void componentDidMount?(): void componentWillReceiveProps?(nextProps: Readonly
, nextContext: any): void shouldComponentUpdate?(nextProps: Readonly
, nextState: Readonly, nextContext: any): boolean
componentWillUpdate?(nextProps: Readonly
, nextState: Readonly, nextContext: any): void
componentWillUnmount?(): void
componentDidShow?(): void
componentDidHide?(): void
componentDidCatchError?(err: string): void
componentDidNotFound?(obj: PageNotFoundObject): void
onPullDownRefresh?(): void
onReachBottom?(): void
onPageScroll?(obj: PageScrollObject): void
onShareAppMessage?(obj: ShareAppMessageObject): ShareAppMessageReturn
onTabItemTap?(obj: TabItemTapObject): void
onResize?(obj: any): void
}
interface ComponentOptions {
addGlobalClass?: boolean
styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
}
interface ComponentClass
extends StaticLifecycle
{ new (...args: any[]): Component
propTypes?: any // TODO: Use prop-types type definition. defaultProps?: Partial
displayName?: string
}
// ref: packages/agree-runtime/src/current.ts
interface RouterInfo extends ComponentLifecycle {
$scope?: any
}
class Component {
constructor(props?: Readonly )
/**
* @deprecated
* @see https://reactjs.org/docs/legacy-context.html
*/
constructor(props?: P, context?: any)
config?: Config
options?: ComponentOptions
$componentType: 'PAGE' | 'COMPONENT'
$router: RouterInfo
$preloadData: any
/**
* 使用 `this.$preload` 函数进行页面跳转传参
* @example this.$preload('key', 'val');
* @example this.$preload({
x: 1,
y: 2
});
* @see https://nervjs.github.io/agree/docs/best-practice.html
*/
$preload(key: string, value: any): void
$preload(key: object): void
setState & Readonly<{ children?: React.ReactNode }>
state: Readonly = P & { children?: React.ReactNode }
interface FunctionComponent {
(props: PropsWithChildren , context?: any): React.ReactElement | null
propTypes?: any // TODO: Use prop-types type definition.
defaultProps?: Partial
config?: Config
options?: ComponentOptions
externalClasses?: string[]
}
type FC = FunctionComponent
interface StatelessFunctionComponent {
(): JSX.Element
}
type SFC = StatelessFunctionComponent
class PureComponent extends Component {}
function memo (
FunctionComponent: FunctionComponent ,
compare?: (oldProps: P, newProps: P) => Boolean
): FunctionComponent
interface Show {
componentDidShow?(options?: unknown): void
componentDidHide?(options?: unknown): void
onShow?(options?: unknown): void
onHide?(options?: unknown): void
}
interface AppInstance extends Show {
mount(component: React.ComponentClass | Vue.ComponentOptions, props: P) => Pick | S) | (Pick | S),
callback?: () => any
): void
forceUpdate(callBack?: () => any): void
render(): React.ReactNode
readonly props: Readonly
context: any
refs: {
[key: string]: any
}
}
type PropsWithChildren