Skip to content

Commit

Permalink
Merge branch 'fix/avatar-picker-restart-temp' into 'master'
Browse files Browse the repository at this point in the history
Temporarily disable the camera for the avatar picker on Android #4408

See merge request minds/mobile-native!1833
  • Loading branch information
msantang78 committed Aug 5, 2022
2 parents fa96043 + 18ebe46 commit 9c5d7e1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/onboarding/v2/steps/SetupChannelScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import sessionService from '../../../common/services/session.service';
import MText from '../../../common/components/MText';
import { Button as Btn } from '~/common/ui';
import { useKeyboard } from '@react-native-community/hooks';
import { IS_IOS } from '~/config/Config';
const TouchableCustom = withPreventDoubleTap(TouchableOpacity);

/**
Expand Down Expand Up @@ -82,6 +83,16 @@ export default observer(function SetupChannelScreen() {
},
}));

const onAvatarPress = React.useCallback(
IS_IOS
? store.showPicker
: async () => {
await channelStore.upload('avatar', false, () => store.hidePicker());
await sessionService.loadUser();
},
[channelStore, store],
);

const avatarOptions: Array<Array<ItemType>> = useRef([
[
{
Expand Down Expand Up @@ -153,7 +164,7 @@ export default observer(function SetupChannelScreen() {
Avatar
</MText>
<TouchableCustom
onPress={store.showPicker}
onPress={onAvatarPress}
style={[styles.avatar, theme.marginBottom2x]}
disabled={channelStore.uploading}
testID="selectAvatar">
Expand Down

0 comments on commit 9c5d7e1

Please sign in to comment.