Skip to content

Commit

Permalink
Merge branch 'typescript' of https://github.com/Fierdetta/stealmoji i…
Browse files Browse the repository at this point in the history
…nto typescript
  • Loading branch information
pylixonly committed Mar 9, 2023
2 parents 715af0f + c62a306 commit 2d5ff3a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/patches/ActionSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { find } from "@vendetta/metro";
import { React } from "@vendetta/metro/common";
import { after, before } from "@vendetta/patcher";
import { React, ReactNative as RN } from "@vendetta/metro/common";
import { General } from "@vendetta/ui/components";
import openEmojiActionSheet from "../lib/utils/openEmojiActionSheet";

const { default: ActionSheet } = find(m => m.default?.render?.name === "ActionSheet");
const { TouchableOpacity } = General;

export default () => before("render", ActionSheet, ([props]) => {
// Checks if the action sheet is for message reactions
Expand All @@ -20,15 +22,15 @@ export default () => before("render", ActionSheet, ([props]) => {

// Wrap the tabs in a TouchableOpacity so we can add a long press handler
tabsRow.props.tabs = tabs.map((tab) => (
<RN.TouchableOpacity
<TouchableOpacity
onPress={() => onSelect(tab.props.index)}
onLongPress={() => {
const { emoji } = tab.props.reaction;
openEmojiActionSheet(emoji);
}}
>
{tab}
</RN.TouchableOpacity>
</TouchableOpacity>
));
} catch {
console.error("Failed to patch reaction header");
Expand Down
9 changes: 5 additions & 4 deletions src/patches/MessageEmojiActionSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { findByProps } from "@vendetta/metro";
import { React, ReactNative as RN } from "@vendetta/metro/common";
import { React } from "@vendetta/metro/common";
import { after } from "@vendetta/patcher";
import { Forms } from "@vendetta/ui/components";
import { Forms, General } from "@vendetta/ui/components";
import openMediaModal from "../lib/utils/openMediaModal";
import StealButtons from "../ui/components/StealButtons";

const MessageEmojiActionSheet = findByProps("GuildDetails");
const { FormDivider } = Forms;
const { TouchableOpacity } = General;

export default () => after("default", MessageEmojiActionSheet, ([{ emojiNode }]: [{ emojiNode: EmojiNode }], res) => {
if (!emojiNode.src) return;
Expand All @@ -19,9 +20,9 @@ export default () => after("default", MessageEmojiActionSheet, ([{ emojiNode }]:
const emoteDetails = res.props?.children[0]?.props?.children;
if (emoteDetails?.[0]?.type?.name === "Icon") {
emoteDetails[0] = (
<RN.TouchableOpacity onPress={() => openMediaModal(emojiNode.src.replace(/\?size=\d+/, ""))}>
<TouchableOpacity onPress={() => openMediaModal(emojiNode.src.split("?")[0])}>
{emoteDetails[0]}
</RN.TouchableOpacity>
</TouchableOpacity>
)
}

Expand Down

0 comments on commit 2d5ff3a

Please sign in to comment.