diff --git a/lib/components/edit-user-avatar-provider.react.js b/lib/components/base-edit-user-avatar-provider.react.js rename from lib/components/edit-user-avatar-provider.react.js rename to lib/components/base-edit-user-avatar-provider.react.js --- a/lib/components/edit-user-avatar-provider.react.js +++ b/lib/components/base-edit-user-avatar-provider.react.js @@ -57,7 +57,7 @@ ) => (selection: NativeMediaSelection) => Promise, +children: React.Node, }; -function EditUserAvatarProvider(props: Props): React.Node { +function BaseEditUserAvatarProvider(props: Props): React.Node { const { displayFailureAlert, selectFromGallery, @@ -188,4 +188,4 @@ ); } -export { EditUserAvatarContext, EditUserAvatarProvider }; +export { EditUserAvatarContext, BaseEditUserAvatarProvider }; diff --git a/native/account/registration/avatar-selection.react.js b/native/account/registration/avatar-selection.react.js --- a/native/account/registration/avatar-selection.react.js +++ b/native/account/registration/avatar-selection.react.js @@ -7,7 +7,7 @@ import { EditUserAvatarContext, type UserAvatarSelection, -} from 'lib/components/edit-user-avatar-provider.react.js'; +} from 'lib/components/base-edit-user-avatar-provider.react.js'; import RegistrationButtonContainer from './registration-button-container.react.js'; import RegistrationButton from './registration-button.react.js'; diff --git a/native/account/registration/emoji-avatar-selection.react.js b/native/account/registration/emoji-avatar-selection.react.js --- a/native/account/registration/emoji-avatar-selection.react.js +++ b/native/account/registration/emoji-avatar-selection.react.js @@ -4,7 +4,7 @@ import * as React from 'react'; import { Text } from 'react-native'; -import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; import { getDefaultAvatar } from 'lib/shared/avatar-utils.js'; import RegistrationContainer from './registration-container.react.js'; diff --git a/native/account/registration/registration-server-call.js b/native/account/registration/registration-server-call.js --- a/native/account/registration/registration-server-call.js +++ b/native/account/registration/registration-server-call.js @@ -7,7 +7,7 @@ import { setDataLoadedActionType } from 'lib/actions/client-db-store-actions.js'; import { registerActionTypes, register } from 'lib/actions/user-actions.js'; -import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; import type { LogInStartingPayload } from 'lib/types/account-types.js'; import { useServerCall, diff --git a/native/avatars/edit-user-avatar.react.js b/native/avatars/edit-user-avatar.react.js --- a/native/avatars/edit-user-avatar.react.js +++ b/native/avatars/edit-user-avatar.react.js @@ -5,7 +5,7 @@ import * as React from 'react'; import { ActivityIndicator, TouchableOpacity, View } from 'react-native'; -import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; import { useENSAvatar } from 'lib/hooks/ens-cache.js'; import { getETHAddressForUserInfo } from 'lib/shared/account-utils.js'; import type { GenericUserInfoWithAvatar } from 'lib/types/avatar-types.js'; diff --git a/native/avatars/native-edit-user-avatar-provider.react.js b/native/avatars/native-edit-user-avatar-provider.react.js new file mode 100644 --- /dev/null +++ b/native/avatars/native-edit-user-avatar-provider.react.js @@ -0,0 +1,34 @@ +// @flow + +import * as React from 'react'; +import { Alert } from 'react-native'; + +import { BaseEditUserAvatarProvider } from 'lib/components/base-edit-user-avatar-provider.react.js'; + +import { selectFromGallery, useUploadSelectedMedia } from './avatar-hooks.js'; + +const displayAvatarUpdateFailureAlert = () => + Alert.alert( + 'Couldn’t save avatar', + 'Please try again later', + [{ text: 'OK' }], + { cancelable: true }, + ); + +type Props = { + +children: React.Node, +}; +function NativeEditUserAvatarProvider(props: Props): React.Node { + const { children } = props; + return ( + + {children} + + ); +} + +export default NativeEditUserAvatarProvider; diff --git a/native/media/registration-user-avatar-camera-modal.react.js b/native/media/registration-user-avatar-camera-modal.react.js --- a/native/media/registration-user-avatar-camera-modal.react.js +++ b/native/media/registration-user-avatar-camera-modal.react.js @@ -3,7 +3,7 @@ import invariant from 'invariant'; import * as React from 'react'; -import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; import type { RegistrationNavigationProp } from '../account/registration/registration-navigator.react.js'; import CameraModal from '../media/camera-modal.react.js'; diff --git a/native/media/user-avatar-camera-modal.react.js b/native/media/user-avatar-camera-modal.react.js --- a/native/media/user-avatar-camera-modal.react.js +++ b/native/media/user-avatar-camera-modal.react.js @@ -3,7 +3,7 @@ import invariant from 'invariant'; import * as React from 'react'; -import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; import CameraModal from '../media/camera-modal.react.js'; import type { AppNavigationProp } from '../navigation/app-navigator.react.js'; diff --git a/native/profile/emoji-user-avatar-creation.react.js b/native/profile/emoji-user-avatar-creation.react.js --- a/native/profile/emoji-user-avatar-creation.react.js +++ b/native/profile/emoji-user-avatar-creation.react.js @@ -3,7 +3,7 @@ import invariant from 'invariant'; import * as React from 'react'; -import { EditUserAvatarContext } from 'lib/components/edit-user-avatar-provider.react.js'; +import { EditUserAvatarContext } from 'lib/components/base-edit-user-avatar-provider.react.js'; import { savedEmojiAvatarSelectorForCurrentUser } from 'lib/selectors/user-selectors.js'; import EmojiAvatarCreation from '../avatars/emoji-avatar-creation.react.js'; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -8,7 +8,7 @@ import * as SplashScreen from 'expo-splash-screen'; import invariant from 'invariant'; import * as React from 'react'; -import { Platform, UIManager, StyleSheet, Alert } from 'react-native'; +import { Platform, UIManager, StyleSheet } from 'react-native'; import { GestureHandlerRootView } from 'react-native-gesture-handler'; import Orientation from 'react-native-orientation-locker'; import { @@ -18,17 +18,13 @@ import { Provider } from 'react-redux'; import { PersistGate as ReduxPersistGate } from 'redux-persist/es/integration/react.js'; -import { EditUserAvatarProvider } from 'lib/components/edit-user-avatar-provider.react.js'; import { ENSCacheProvider } from 'lib/components/ens-cache-provider.react.js'; import { MediaCacheProvider } from 'lib/components/media-cache-provider.react.js'; import { actionLogger } from 'lib/utils/action-logger.js'; import { RegistrationContextProvider } from './account/registration/registration-context-provider.react.js'; -import { - selectFromGallery, - useUploadSelectedMedia, -} from './avatars/avatar-hooks.js'; import { EditThreadAvatarProvider } from './avatars/edit-thread-avatar-provider.react.js'; +import NativeEditUserAvatarProvider from './avatars/native-edit-user-avatar-provider.react.js'; import ChatContextProvider from './chat/chat-context-provider.react.js'; import { FeatureFlagsProvider } from './components/feature-flags-provider.react.js'; import PersistedStateGate from './components/persisted-state-gate.js'; @@ -76,14 +72,6 @@ SplashScreen.preventAutoHideAsync().catch(console.log); -const displayAvatarUpdateFailureAlert = () => - Alert.alert( - 'Couldn’t save avatar', - 'Please try again later', - [{ text: 'OK' }], - { cancelable: true }, - ); - function Root() { const navStateRef = React.useRef(); const navDispatchRef = React.useRef(); @@ -276,11 +264,7 @@ - + @@ -306,7 +290,7 @@ - +