chore(lib/react/native/patches): refactor to one instead patch

This commit is contained in:
PalmDevs 2025-08-19 21:46:32 +07:00
parent 180b8b858d
commit 7b3ede1904
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA

View file

@ -1,19 +1,17 @@
import { after, before } from '@revenge-mod/patcher'
import { instead } from '@revenge-mod/patcher'
import { ReactNative } from '..'
import { sAfterRunApplication, sBeforeRunApplication } from './_internal'
before(ReactNative.AppRegistry, 'runApplication', args => {
instead(ReactNative.AppRegistry, 'runApplication', function (args, orig) {
for (const cb of sBeforeRunApplication)
try {
cb()
} catch {}
return args
})
after(ReactNative.AppRegistry, 'runApplication', res => {
Reflect.apply(orig, this, args)
for (const cb of sAfterRunApplication)
try {
cb()
} catch {}
return res
})