diff --git a/native/user-profile/user-profile-avatar.react.js b/native/user-profile/user-profile-avatar.react.js index 065217394..7ee75877f 100644 --- a/native/user-profile/user-profile-avatar.react.js +++ b/native/user-profile/user-profile-avatar.react.js @@ -1,73 +1,77 @@ // @flow import { useNavigation, useRoute } from '@react-navigation/native'; import invariant from 'invariant'; import * as React from 'react'; import { View, TouchableOpacity } from 'react-native'; -import { userProfileUserInfoContainerHeight } from './user-profile-constants.js'; import UserAvatar from '../avatars/user-avatar.react.js'; import { OverlayContext } from '../navigation/overlay-context.js'; import { UserProfileAvatarModalRouteName } from '../navigation/route-names.js'; +import { useSelector } from '../redux/redux-utils.js'; +import { derivedDimensionsInfoSelector } from '../selectors/dimensions-selectors.js'; // We need to set onAvatarLayout in order to allow .measure() to be on the ref const onAvatarLayout = () => {}; type Props = { userID: ?string, }; function UserProfileAvatar(props: Props): React.Node { const { userID } = props; const { navigate } = useNavigation(); const route = useRoute(); const overlayContext = React.useContext(OverlayContext); const avatarRef = React.useRef>(); + const dimensions = useSelector(derivedDimensionsInfoSelector); + const fullScreenHeight = dimensions.height; + const onPressAvatar = React.useCallback(() => { invariant(overlayContext, 'UserProfileAvatar should have OverlayContext'); overlayContext.setScrollBlockingModalStatus('open'); const currentAvatarRef = avatarRef.current; if (!currentAvatarRef) { return; } currentAvatarRef.measure((x, y, width, height, pageX, pageY) => { const coordinates = { x: pageX, y: pageY, width, height, }; const verticalBounds = { - height: userProfileUserInfoContainerHeight, - y: pageY, + height: fullScreenHeight, + y: 0, }; navigate<'UserProfileAvatarModal'>({ name: UserProfileAvatarModalRouteName, params: { presentedFrom: route.key, initialCoordinates: coordinates, verticalBounds, userID, }, }); }); - }, [navigate, overlayContext, route.key, userID]); + }, [navigate, overlayContext, route.key, userID, fullScreenHeight]); return ( ); } export default UserProfileAvatar;