HideGiftButton: actually use findByName

This commit is contained in:
amsyarasyiq 2023-04-03 22:50:26 +08:00
parent 7ac23a90c2
commit 93d6d9b33d
5 changed files with 24 additions and 13 deletions

View file

@ -37,6 +37,7 @@
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"react/react-in-jsx-scope": "off",
"eol-last": "error"
}
}

5
.gitignore vendored
View file

@ -1,6 +1,9 @@
.idea
node_modules/
dist/
pnpm-lock.yaml
yarn.lock
package-lock.json
RichPresence
Themer
FunnyBackground
YouTabRemover

View file

@ -54,7 +54,8 @@ async function buildPlugin(plugin) {
return id.substring(1).replace(/\//g, ".");
const map = {
react: "window.React"
"react": "window.React",
"react-native": "globalThis.vendetta.metro.common.ReactNative"
};
return map[id] || null;
@ -71,7 +72,12 @@ async function buildPlugin(plugin) {
].includes(warning.code) && console.warn(warning);
},
plugins: [
nodeResolve(),
nodeResolve({
resolveOnly: (id) => ![
"react",
"react-native"
].includes(id)
}),
commonjs(),
{
name: "swc",

View file

@ -1,23 +1,24 @@
{
"scripts": {
"build": "node build.mjs",
"watch": "node build.mjs -w",
"lint": "eslint plugins"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
"@swc/core": "^1.3.36",
"@swc/core": "^1.3.42",
"@types/react": "^18.0.28",
"@types/react-native": "^0.70.11",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"esbuild": "^0.17.11",
"eslint": "^8.35.0",
"@types/react-native": "^0.70.12",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"esbuild": "^0.17.12",
"eslint": "^8.36.0",
"eslint-plugin-react": "^7.32.2",
"rollup": "^3.17.3",
"rollup": "^3.20.1",
"rollup-plugin-esbuild": "^5.0.0",
"typescript": "^4.9.5",
"vendetta-types": "^2.3.16"
"vendetta-types": "^2.4.0"
},
"dependencies": {
"@swc/helpers": "^0.4.14"

View file

@ -1,7 +1,7 @@
import { logger } from "@vendetta";
import { find } from "@vendetta/metro";
import { findByName } from "@vendetta/metro";
const ChatInput = find((m) => typeof m?.defaultProps?.hideGiftButton === "boolean");
const ChatInput = findByName("ChatInput");
export default new class HideGiftButton {
origState: boolean;