Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513014
D14131.id46426.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
D14131.id46426.diff
View Options
diff --git a/native/chat/multimedia-message-multimedia.react.js b/native/chat/multimedia-message-multimedia.react.js
--- a/native/chat/multimedia-message-multimedia.react.js
+++ b/native/chat/multimedia-message-multimedia.react.js
@@ -58,13 +58,12 @@
+keyboardState: ?KeyboardState,
// withOverlayContext
+overlayContext: ?OverlayContextType,
+ +viewRef: { current: ?React.ElementRef<typeof View> },
};
type State = {
+opacity: number | Node,
};
class MultimediaMessageMultimedia extends React.PureComponent<Props, State> {
- view: ?React.ElementRef<typeof View>;
-
constructor(props: Props) {
super(props);
this.state = {
@@ -143,10 +142,10 @@
this.props.style,
];
- const { mediaInfo, pendingUpload, postInProgress } = this.props;
+ const { mediaInfo, pendingUpload, postInProgress, viewRef } = this.props;
return (
<AnimatedView style={wrapperStyles}>
- <View style={styles.expand} onLayout={this.onLayout} ref={this.viewRef}>
+ <View style={styles.expand} onLayout={this.onLayout} ref={viewRef}>
<InlineMultimedia
mediaInfo={mediaInfo}
onPress={this.onPress}
@@ -161,10 +160,6 @@
onLayout = () => {};
- viewRef = (view: ?React.ElementRef<typeof View>) => {
- this.view = view;
- };
-
onPress = () => {
if (!this.props.clickable) {
return;
@@ -175,9 +170,9 @@
}
const {
- view,
- props: { verticalBounds },
+ props: { verticalBounds, viewRef },
} = this;
+ const view = viewRef.current;
if (!view || !verticalBounds) {
return;
}
@@ -224,6 +219,8 @@
const keyboardState = React.useContext(KeyboardContext);
const overlayContext = React.useContext(OverlayContext);
const route = useRoute();
+ const viewRef = React.useRef<?React.ElementRef<typeof View>>();
+
return (
<MultimediaMessageMultimedia
{...props}
@@ -231,6 +228,7 @@
route={route}
keyboardState={keyboardState}
overlayContext={overlayContext}
+ viewRef={viewRef}
/>
);
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 9:39 PM (51 m, 47 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2686265
Default Alt Text
D14131.id46426.diff (2 KB)
Attached To
Mode
D14131: [native] Move view ref in MultimediaMessageMultimedia to functional component
Attached
Detach File
Event Timeline
Log In to Comment