mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +08:00
- 新增 sentry-react-native、react-native-video、react-native-static-server、expo-network、expo-intent-launcher、expo-clipboard、expo-file-system 的 web shim - 重写 react-native-pager-view shim,通过 useImperativeHandle 暴露 setPage 方法 - 修复 sentry-react-native shim 缺少 ErrorBoundary 导致的渲染崩溃 - 在 _layout.tsx 中加载 Ionicons 字体,修复 web 端字体 404 - 更新 metro.config.js 中 sentry shim 路径为 .tsx
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
/** Web shim for @sentry/react-native - no-op stubs for web platform */
|
|
import React from 'react';
|
|
|
|
export const init = (_options?: unknown) => {};
|
|
export const wrap = <T>(component: T): T => component;
|
|
export const captureException = (_error: unknown, _hint?: unknown) => '';
|
|
export const captureMessage = (_message: string, _level?: unknown) => '';
|
|
export const setUser = (_user: unknown) => {};
|
|
export const setTag = (_key: string, _value: unknown) => {};
|
|
export const setExtra = (_key: string, _extra: unknown) => {};
|
|
export const addBreadcrumb = (_breadcrumb: unknown) => {};
|
|
export const configureScope = (_callback: unknown) => {};
|
|
export const withScope = (_callback: unknown) => {};
|
|
export const getCurrentHub = () => ({ getClient: () => undefined });
|
|
export const ReactNativeTracing = class {};
|
|
export const ReactNavigationInstrumentation = class {};
|
|
export const TouchEventBoundary = ({ children }: { children: React.ReactNode }) => children;
|
|
|
|
export class ErrorBoundary extends React.Component<
|
|
{ fallback: React.ReactNode; children: React.ReactNode },
|
|
{ hasError: boolean }
|
|
> {
|
|
state = { hasError: false };
|
|
static getDerivedStateFromError() { return { hasError: true }; }
|
|
render() {
|
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
}
|
|
}
|
|
|
|
export default { init, wrap, captureException, captureMessage, setUser, setTag, setExtra };
|