diff --git a/native/account/registration/registration-navigator.react.js b/native/account/registration/registration-navigator.react.js
--- a/native/account/registration/registration-navigator.react.js
+++ b/native/account/registration/registration-navigator.react.js
@@ -15,6 +15,7 @@
import KeyserverSelection from './keyserver-selection.react.js';
import PasswordSelection from './password-selection.react.js';
import UsernameSelection from './username-selection.react.js';
+import RegistrationUserAvatarCameraModal from '../../media/registration-user-avatar-camera-modal.react.js';
import type { RootNavigationProp } from '../../navigation/root-navigator.react.js';
import {
KeyserverSelectionRouteName,
@@ -25,6 +26,7 @@
PasswordSelectionRouteName,
AvatarSelectionRouteName,
EmojiAvatarSelectionRouteName,
+ RegistrationUserAvatarCameraModalRouteName,
type ScreenParamList,
type RegistrationParamList,
} from '../../navigation/route-names.js';
@@ -49,6 +51,10 @@
},
};
+const cameraScreenOptions = {
+ headerShown: false,
+};
+
type Props = {
+navigation: RootNavigationProp<'Registration'>,
...
@@ -89,6 +95,11 @@
name={EmojiAvatarSelectionRouteName}
component={EmojiAvatarSelection}
/>
+
);
}
diff --git a/native/media/camera-modal.react.js b/native/media/camera-modal.react.js
--- a/native/media/camera-modal.react.js
+++ b/native/media/camera-modal.react.js
@@ -34,6 +34,7 @@
import type { Dispatch } from 'lib/types/redux-types.js';
import SendMediaButton from './send-media-button.react.js';
+import type { RegistrationNavigationProp } from '../account/registration/registration-navigator.react.js';
import ContentLoading from '../components/content-loading.react.js';
import ConnectedStatusBar from '../connected-status-bar.react.js';
import type { AppNavigationProp } from '../navigation/app-navigator.react.js';
@@ -41,7 +42,6 @@
OverlayContext,
type OverlayContextType,
} from '../navigation/overlay-context.js';
-import type { OverlayParamList } from '../navigation/route-names.js';
import { updateDeviceCameraInfoActionType } from '../redux/action-types.js';
import { type DimensionsInfo } from '../redux/dimensions-updater.react.js';
import { useSelector } from '../redux/redux-utils.js';
@@ -226,9 +226,11 @@
type BaseProps = {
+handlePhotoCapture: (capture: PhotoCapture) => mixed,
- +navigation: $Values<
- $ObjMapi(K) => AppNavigationProp>,
- >,
+ +navigation:
+ | AppNavigationProp<'ChatCameraModal'>
+ | AppNavigationProp<'UserAvatarCameraModal'>
+ | AppNavigationProp<'ThreadAvatarCameraModal'>
+ | RegistrationNavigationProp<'RegistrationUserAvatarCameraModal'>,
};
type Props = {
...BaseProps,
@@ -502,7 +504,9 @@
static isActive(props) {
const { overlayContext } = props;
- invariant(overlayContext, 'CameraModal should have OverlayContext');
+ if (!overlayContext) {
+ return true;
+ }
return !overlayContext.isDismissing;
}
@@ -580,7 +584,9 @@
get containerStyle() {
const { overlayContext } = this.props;
- invariant(overlayContext, 'CameraModal should have OverlayContext');
+ if (!overlayContext) {
+ return styles.container;
+ }
return {
...styles.container,
opacity: overlayContext.position,
@@ -850,7 +856,12 @@
};
close = () => {
- this.props.navigation.goBackOnce();
+ const { overlayContext, navigation } = this.props;
+ if (overlayContext && navigation.goBackOnce) {
+ navigation.goBackOnce();
+ } else {
+ navigation.goBack();
+ }
};
takePhoto = async () => {
diff --git a/native/media/registration-user-avatar-camera-modal.react.js b/native/media/registration-user-avatar-camera-modal.react.js
new file mode 100644
--- /dev/null
+++ b/native/media/registration-user-avatar-camera-modal.react.js
@@ -0,0 +1,31 @@
+// @flow
+
+import invariant from 'invariant';
+import * as React from 'react';
+
+import type { RegistrationNavigationProp } from '../account/registration/registration-navigator.react.js';
+import { EditUserAvatarContext } from '../avatars/edit-user-avatar-provider.react.js';
+import CameraModal from '../media/camera-modal.react.js';
+import type { NavigationRoute } from '../navigation/route-names.js';
+
+type Props = {
+ +navigation: RegistrationNavigationProp<'RegistrationUserAvatarCameraModal'>,
+ +route: NavigationRoute<'RegistrationUserAvatarCameraModal'>,
+};
+
+function RegistrationUserAvatarCameraModal(props: Props): React.Node {
+ const { navigation } = props;
+
+ const editUserAvatarContext = React.useContext(EditUserAvatarContext);
+ invariant(editUserAvatarContext, 'editUserAvatarContext should be set');
+ const { updateImageUserAvatar } = editUserAvatarContext;
+
+ return (
+
+ );
+}
+
+export default RegistrationUserAvatarCameraModal;
diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js
--- a/native/navigation/route-names.js
+++ b/native/navigation/route-names.js
@@ -115,6 +115,8 @@
export const PasswordSelectionRouteName = 'PasswordSelection';
export const AvatarSelectionRouteName = 'AvatarSelection';
export const EmojiAvatarSelectionRouteName = 'EmojiAvatarSelection';
+export const RegistrationUserAvatarCameraModalRouteName =
+ 'RegistrationUserAvatarCameraModal';
export type RootParamList = {
+LoggedOutModal: void,
@@ -214,6 +216,7 @@
+PasswordSelection: PasswordSelectionParams,
+AvatarSelection: AvatarSelectionParams,
+EmojiAvatarSelection: EmojiAvatarSelectionParams,
+ +RegistrationUserAvatarCameraModal: void,
};
export type InviteLinkParamList = {