Page MenuHomePhabricator

D5597.diff
No OneTemporary

D5597.diff

diff --git a/native/markdown/markdown-spoiler.react.js b/native/markdown/markdown-spoiler.react.js
--- a/native/markdown/markdown-spoiler.react.js
+++ b/native/markdown/markdown-spoiler.react.js
@@ -6,6 +6,7 @@
import type { ReactElement } from 'lib/shared/markdown';
import { MessageContext } from '../chat/message-context.react';
+import GestureTouchableOpacity from '../components/gesture-touchable-opacity.react';
import { useStyles } from '../themes/colors';
import { MarkdownContext } from './markdown-context';
@@ -30,16 +31,16 @@
const setSpoilerPressActive = markdownContext?.setSpoilerPressActive;
const styleBasedOnSpoilerState = React.useMemo(() => {
- return castedIdentifier && spoilerRevealed?.[messageID]?.[castedIdentifier]
+ return castedIdentifier &&
+ spoilerRevealed?.[messageID]?.[castedIdentifier] === true
? null
: styles.spoilerHidden;
}, [castedIdentifier, spoilerRevealed, messageID, styles.spoilerHidden]);
const onSpoilerClick = React.useCallback(() => {
- if (styleBasedOnSpoilerState === null) {
- setSpoilerPressActive && setSpoilerPressActive(false);
- return;
- }
+ // if (styleBasedOnSpoilerState === null) {
+ // return;
+ // }
if (
spoilerRevealed &&
@@ -51,13 +52,13 @@
...spoilerRevealed,
[messageID]: {
...spoilerRevealed[messageID],
- [castedIdentifier]: true,
+ [castedIdentifier]:
+ !spoilerRevealed?.[messageID]?.[castedIdentifier] ?? true,
},
});
}
- setSpoilerPressActive && setSpoilerPressActive(true);
+ setSpoilerPressActive && setSpoilerPressActive(false);
}, [
- styleBasedOnSpoilerState,
setSpoilerPressActive,
spoilerRevealed,
setSpoilerRevealed,
@@ -67,9 +68,9 @@
const memoizedSpoiler = React.useMemo(() => {
return (
- <Text onPress={onSpoilerClick} style={styleBasedOnSpoilerState}>
- {text}
- </Text>
+ <GestureTouchableOpacity onPress={onSpoilerClick}>
+ <Text style={styleBasedOnSpoilerState}>{text}</Text>
+ </GestureTouchableOpacity>
);
}, [onSpoilerClick, styleBasedOnSpoilerState, text]);

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 11:12 AM (9 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2712791
Default Alt Text
D5597.diff (2 KB)

Event Timeline