mincu-react
Interfaces
Type Aliases
ColorSchemeName
Ƭ ColorSchemeName: "light"
| "dark"
| null
| undefined
States
Ƭ States: Object
Type declaration
Name | Type |
---|---|
colorScheme | ColorSchemeName |
colors | any |
Variables
dataModule
• Const
dataModule: DataModule
eventModule
• Const
eventModule: EventModule
mincu
• Const
mincu: Mincu
mincuCore
• Const
mincuCore: MincuCoreBase
networkModule
• Const
networkModule: NetWorkModule
uiModule
• Const
uiModule: UIModule
Functions
Ready
▸ Ready(props
, context?
): ReactElement
<any
, any
>
Parameters
Name | Type |
---|---|
props | Props |
context? | any |
Returns
ReactElement
<any
, any
>
ReadySSR
▸ ReadySSR(props
, context?
): ReactElement
<any
, any
>
Parameters
Name | Type |
---|---|
props | Props |
context? | any |
Returns
ReactElement
<any
, any
>
useAppReady
▸ useAppReady(reject?
): boolean
Parameters
Name | Type |
---|---|
reject? | () => void |
Returns
boolean
useNativeState
▸ useNativeState<T
>(key
): States
[T
]
返回 app 的状态
Type parameters
Name | Type |
---|---|
T | extends keyof States |
Parameters
Name | Type |
---|---|
key | T |
Returns
States
[T
]
useSafeArea
▸ useSafeArea(): EdgeInsets
Returns
Interfaces
Interface: AppData
Properties
user
• user: Object
Type declaration
Name | Type |
---|---|
colorScheme | ColorSchemeName |
colors | any |
inset | EdgeInsets |
profile | { basicProfile : { app_avatar_url : string ; department : string ; department_id : string ; head_pic_url : string ; max_role_level : number ; message : string ; name : string ; status : number } ; entireProfile : IEntireProfileResponse } |
profile.basicProfile | { app_avatar_url : string ; department : string ; department_id : string ; head_pic_url : string ; max_role_level : number ; message : string ; name : string ; status : number } |
profile.basicProfile.app_avatar_url | string |
profile.basicProfile.department | string |
profile.basicProfile.department_id | string |
profile.basicProfile.head_pic_url | string |
profile.basicProfile.max_role_level | number |
profile.basicProfile.message | string |
profile.basicProfile.name | string |
profile.basicProfile.status | number |
profile.entireProfile | IEntireProfileResponse |
token | string |
Interface: EdgeInsets
Properties
bottom
• bottom: number
left
• left: number
right
• right: number
top
• top: number
Interface: INativeFuncs
Properties
Auth
• Auth: Object
Type declaration
Name | Type |
---|---|
login | (data : { password : string ; username : string }) => number |
refreshToken | () => { token : string } |
Clipboard
• Clipboard: Clipboard
DeviceInfo
• DeviceInfo: DeviceInfo
Linking
• Linking: RNLinking
NetInfo
• NetInfo: NetInfo
Orientation
• Orientation: typeof Orientation
Since
iNCU 5.9.7+
Portal
• Portal: Object
Type declaration
Name | Type |
---|---|
remove | (id : number ) => void |
Share
• Share: Object
Type declaration
Name | Type |
---|---|
openShareMenu | () => void |
setShareConfig | (config : ShareConfig ) => void |
StatusBar
• StatusBar: Object
Type declaration
Name | Type |
---|---|
setBarStyle | (style : StatusBarStyle , animated? : boolean ) => void |
Storage
• Storage: Object
Type declaration
Name | Type |
---|---|
getItem | (key : string ) => any |
remove | (key : string ) => void |
reset | () => void |
setItem | (key : string , value : any ) => void |
Toast
• Toast: Object
Index signature
▪ [key: string
]: (title
: string
, during
: number
) => number
ToastAndroid
• ToastAndroid: ToastAndroidStatic
Vibration
• Vibration: VibrationStatic
Webview
• Webview: Object
Type declaration
Name | Type |
---|---|
bindBackPress | (value : boolean ) => void |
disableAutoSetTitle | () => void |
exitWebView | () => void |
handleShowHeader | (value? : boolean ) => boolean |
toScreen | (e : NavConfig ) => void |
Interface: Mincu
Hierarchy
-
MincuCoreBase
-
DataModule
-
EventModule
-
NetWorkModule
-
UIModule
↳
Mincu
Properties
axiosInterceptors
• axiosInterceptors: () => { error
: (error
: any
) => Promise
<any
> ; request
: (config
: AxiosRequestConfig
<any
>) => AxiosRequestConfig
<any
> ; response
: (response
: AxiosResponse
<any
, any
>) => AxiosResponse
<any
, any
> }
Type declaration
▸ (): Object
Returns
Object
Name | Type |
---|---|
error | (error : any ) => Promise <any > |
request | (config : AxiosRequestConfig <any >) => AxiosRequestConfig <any > |
response | (response : AxiosResponse <any , any >) => AxiosResponse <any , any > |
Inherited from
NetWorkModule.axiosInterceptors
backPress
• backPress: Object
Type declaration
Name | Type |
---|---|
bind | (cb : () => void , onResulst? : (success : boolean ) => void ) => () => void |
unbind | (cb : () => void ) => void |
Inherited from
UIModule.backPress
call
• call: <Class, Method>(baseClass
: Class
, method
: Method
, params
: ParamType
<INativeFuncs
[Class
][Method
]>, success?
: (res?
: { data
: CallReturnType
<INativeFuncs
[Class
][Method
]> }) => any
, failed?
: (...args
: any
[]) => void
) => void
Type declaration
▸ <Class
, Method
>(baseClass
, method
, params
, success?
, failed?
): void
主动请求并触发客户端事件
Type parameters
Name | Type |
---|---|
Class | extends keyof INativeFuncs |
Method | extends string | number | symbol |
Parameters
Name | Type |
---|---|
baseClass | Class |
method | Method |
params | ParamType <INativeFuncs [Class ][Method ]> |
success? | (res? : { data : CallReturnType <INativeFuncs [Class ][Method ]> }) => any |
failed? | (...args : any []) => void |
Returns
void
Inherited from
MincuCoreBase.call
callPromise
• callPromise: <Class, Method>(baseClass
: Class
, method
: Method
, params
: ParamType
<INativeFuncs
[Class
][Method
]>) => Promise
<CallReturnType
<INativeFuncs
[Class
][Method
]>>
Type declaration
▸ <Class
, Method
>(baseClass
, method
, params
): Promise
<CallReturnType
<INativeFuncs
[Class
][Method
]>>
Type parameters
Name | Type |
---|---|
Class | extends keyof INativeFuncs |
Method | extends string | number | symbol |
Parameters
Name | Type |
---|---|
baseClass | Class |
method | Method |
params | ParamType <INativeFuncs [Class ][Method ]> |
Returns
Promise
<CallReturnType
<INativeFuncs
[Class
][Method
]>>
Inherited from
MincuCoreBase.callPromise
fetch
• fetch: any
Deprecated
networkModule.useAxiosInterceptors is for your need
Inherited from
NetWorkModule.fetch
initial
• initial: (resolve
: (value?
: unknown
) => any
, reject?
: (value?
: unknown
) => any
) => void
Type declaration
▸ (resolve
, reject?
): void
Parameters
Name | Type |
---|---|
resolve | (value? : unknown ) => any |
reject? | (value? : unknown ) => any |
Returns
void
Inherited from
MincuCoreBase.initial
listener
• listener: (eventName
: string
, fn
: (data
: any
) => any
) => EventEmitter
Type declaration
▸ (eventName
, fn
): EventEmitter
添加一个原生事件监听器
Parameters
Name | Type |
---|---|
eventName | string |
fn | (data : any ) => any |
Returns
EventEmitter
Inherited from
MincuCoreBase.listener
makeProxyFromNativeFunc
• makeProxyFromNativeFunc: <Class>(func
: Class
) => INativeFuncs
[Class
]
Type declaration
▸ <Class
>(func
): INativeFuncs
[Class
]
Return a proxy handle callPromise from INativeFuncs
Type parameters
Name | Type |
---|---|
Class | extends keyof INativeFuncs |
Parameters
Name | Type |
---|---|
func | Class |
Returns
INativeFuncs
[Class
]
Inherited from
MincuCoreBase.makeProxyFromNativeFunc
once
• once: (eventName
: string
, fn
: (data
: any
) => any
) => EventEmitter
Type declaration
▸ (eventName
, fn
): EventEmitter
添加一个原生事件监听器 (监听一次后立即销毁)
Parameters
Name | Type |
---|---|
eventName | string |
fn | (data : any ) => any |
Returns
EventEmitter
Inherited from
MincuCoreBase.once
orientation
• orientation: typeof Orientation
Since
iNCU 5.9.7+
Inherited from
UIModule.orientation
remove
• remove: (eventName
: string
, fn
: (data
: any
) => any
) => void
Type declaration
▸ (eventName
, fn
): void
移除某个原生事件监听器
Parameters
Name | Type |
---|---|
eventName | string |
fn | (data : any ) => any |
Returns
void
Inherited from
MincuCoreBase.remove
storage
• storage: MincuStorage
Inherited from
DataModule.storage
toast
• toast: Object
Type declaration
Name | Type |
---|---|
fail | (title : string , during? : number ) => Promise <number > |
info | (title : string , during? : number ) => Promise <number > |
loading | (title : string , during? : number ) => Promise <() => void > |
remove | (key : number ) => Promise <void > |
success | (title : string , during? : number ) => Promise <number > |
Inherited from
UIModule.toast
token
• token: string
Inherited from
NetWorkModule.token
Accessors
appData
• get
appData(): AppData
由 iNCU WebView 注入的来自 App 的数据
Returns
Inherited from
MincuCoreBase.appData
colorScheme
• get
colorScheme(): ColorSchemeName
Returns
Inherited from
DataModule.colorScheme
colors
• get
colors(): any
Returns
any
Inherited from
DataModule.colors
inset
• get
inset(): EdgeInsets
Returns
Inherited from
DataModule.inset
isApp
• get
isApp(): boolean
通过 userAgent 判断是否在 iNCU 环境 userAgent: iNCU.*
Returns
boolean
Inherited from
MincuCoreBase.isApp
isDark
• get
isDark(): boolean
Returns
boolean
Inherited from
DataModule.isDark
isReady
• get
isReady(): any
由 App 端注入的数据段,用以判断是否注入成功
Returns
any
Inherited from
MincuCoreBase.isReady
messageChannel
• get
messageChannel(): EventEmitter
与 App 端通信的消息通道
Returns
EventEmitter
Inherited from
MincuCoreBase.messageChannel
userInfo
• get
userInfo(): Object
Returns
Object
Name | Type |
---|---|
colorScheme | ColorSchemeName |
colors | any |
inset | EdgeInsets |
profile | { basicProfile : { app_avatar_url : string ; department : string ; department_id : string ; head_pic_url : string ; max_role_level : number ; message : string ; name : string ; status : number } ; entireProfile : IEntireProfileResponse } |
profile.basicProfile | { app_avatar_url : string ; department : string ; department_id : string ; head_pic_url : string ; max_role_level : number ; message : string ; name : string ; status : number } |
profile.basicProfile.app_avatar_url | string |
profile.basicProfile.department | string |
profile.basicProfile.department_id | string |
profile.basicProfile.head_pic_url | string |
profile.basicProfile.max_role_level | number |
profile.basicProfile.message | string |
profile.basicProfile.name | string |
profile.basicProfile.status | number |
profile.entireProfile | IEntireProfileResponse |
token | string |
Inherited from
DataModule.userInfo
webview
• get
webview(): any
App 端的 Webview JavaScriptInterface,用以向 App 端发送信息
Returns
any
Inherited from
MincuCoreBase.webview
Methods
exit
▸ exit(): void
Returns
void
Inherited from
UIModule.exit
getStoredToken
▸ getStoredToken(): void
Deprecated
should not use
Returns
void
Inherited from
NetWorkModule.getStoredToken
getVersion
▸ getVersion(): Promise
<string
>
Returns
Promise
<string
>
Inherited from
DataModule.getVersion
handleShowHeader
▸ handleShowHeader(value
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
value | boolean |
Returns
Promise
<boolean
>
Inherited from
UIModule.handleShowHeader
login
▸ login(username
, password
): void
Parameters
Name | Type |
---|---|
username | string |
password | string |
Returns
void
Inherited from
EventModule.login
openUrl
▸ openUrl(url
): void
通过系统默认浏览器打开 Web 页面
主要适配一些端内转端外场景和 deeplink
Parameters
Name | Type | Description |
---|---|---|
url | string | 要跳转的链接 |
Returns
void
Inherited from
EventModule.openUrl
refreshToken
▸ refreshToken(): Promise
<string
>
刷新 token 函数
Returns
Promise
<string
>
返回一个新 token 的 Promise 对象
Inherited from
NetWorkModule.refreshToken
setBarStyle
▸ setBarStyle(style
): void
Parameters
Name | Type |
---|---|
style | StatusBarStyle |
Returns
void
Inherited from
UIModule.setBarStyle
setShareConfig
▸ setShareConfig(config
): void
Parameters
Name | Type |
---|---|
config | ShareConfig |
Returns
void
Inherited from
EventModule.setShareConfig
showShare
▸ showShare(): void
Returns
void
Inherited from
EventModule.showShare
toScreen
▸ toScreen(config
): void
Parameters
Name | Type |
---|---|
config | NavConfig |
Returns
void
Inherited from
UIModule.toScreen
useAxiosInterceptors
▸ useAxiosInterceptors(axiosInstance
): void
Exmaple
const fetcher = axios.create() networkModule.useAxiosInterceptors(fetcher)
Parameters
Name | Type |
---|---|
axiosInstance | AxiosInstance |
Returns
void
Inherited from
NetWorkModule.useAxiosInterceptors
Interface: NavConfig
Properties
params
• Optional
params: object
screen
• screen: string
Interface: ShareConfig
Properties
imageUrl
• Optional
imageUrl: string
title
• Optional
title: string
url
• Optional
url: string