Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3543552
D5597.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5597.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5597: [IGNORE] GestureTouchableOpacity Spoiler changes
Attached
Detach File
Event Timeline
Log In to Comment