41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { router } from 'expo-router'
|
|
import { Dimensions } from 'react-native'
|
|
|
|
export const screenWidth = Dimensions.get('window').width
|
|
export const screenHeight = Dimensions.get('window').height
|
|
|
|
export const push = (path: string, params?: Record<string, string | number>) => {
|
|
const params2 = params || {}
|
|
router.push({
|
|
pathname: path as any,
|
|
params: params2,
|
|
})
|
|
}
|
|
|
|
export const replace = (path: string, params?: Record<string, string | number>) => {
|
|
const params2 = params || {}
|
|
router.replace({
|
|
pathname: path as any,
|
|
params: params2,
|
|
})
|
|
}
|
|
|
|
export const goBack = () => {
|
|
router.back()
|
|
}
|
|
|
|
// 导出存储系统和视频URL缓存
|
|
export { storage, videoUrlCache } from './storage'
|
|
|
|
// 导出WebView工具函数
|
|
export { configureWebBrowser, openUrl, openWebView } from './webview-helper'
|
|
|
|
// 导出文件上传函数
|
|
export { uploadFile } from './uploadFile'
|
|
|
|
// 邮箱格式验证函数
|
|
export const isValidEmail = (email: string) => {
|
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
|
|
return emailRegex.test(email)
|
|
}
|