mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-28 21:48:13 +08:00
fix(hippy-react-web): fix error handler
This commit is contained in:
@@ -186,7 +186,7 @@ const Image: React.FC<ImageProps> = React.forwardRef((props: ImageProps, ref) =>
|
||||
|
||||
// delete unsupported props
|
||||
delete restProps.tintColor;
|
||||
delete restProps.ononProgress;
|
||||
delete restProps.onProgress;
|
||||
delete restProps.capInsets;
|
||||
|
||||
return (
|
||||
|
||||
@@ -25,11 +25,16 @@ global.Hippy = {
|
||||
// @ts-ignore
|
||||
Device,
|
||||
on: (eventName: string, handler: Function) => {
|
||||
if (eventName === 'unhandleRejection') {
|
||||
if (eventName.toUpperCase() === 'UNHANDLEDREJECTION') {
|
||||
window.addEventListener('unhandledrejection', (event) => {
|
||||
handler(event);
|
||||
handler(event.reason, event.promise);
|
||||
});
|
||||
}
|
||||
if (eventName.toUpperCase() === 'UNCAUGHTEXCEPTION') {
|
||||
window.onerror = (message, source, lineno, colno, error) => {
|
||||
handler(error, message, source, lineno, colno);
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
global.getTurboModule = () => {
|
||||
|
||||
Reference in New Issue
Block a user