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 }, }; type State = { +opacity: number | Node, }; class MultimediaMessageMultimedia extends React.PureComponent { - view: ?React.ElementRef; - 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 ( - + {}; - viewRef = (view: ?React.ElementRef) => { - 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>(); + return ( ); });