Fix forward-backward to profile step
This commit is contained in:
@@ -79,9 +79,10 @@ export function StepProfile() {
|
|||||||
const {state, dispatch} = React.useContext(Context)
|
const {state, dispatch} = React.useContext(Context)
|
||||||
const [avatar, setAvatar] = React.useState<Avatar>({
|
const [avatar, setAvatar] = React.useState<Avatar>({
|
||||||
image: state.profileStepResults?.image,
|
image: state.profileStepResults?.image,
|
||||||
placeholder: emojiItems.at,
|
placeholder: state.profileStepResults.creatorState?.emoji || emojiItems.at,
|
||||||
backgroundColor: randomColor,
|
backgroundColor:
|
||||||
useCreatedAvatar: false,
|
state.profileStepResults.creatorState?.backgroundColor || randomColor,
|
||||||
|
useCreatedAvatar: state.profileStepResults.isCreatedAvatar,
|
||||||
})
|
})
|
||||||
|
|
||||||
const canvasRef = React.useRef<PlaceholderCanvasRef>(null)
|
const canvasRef = React.useRef<PlaceholderCanvasRef>(null)
|
||||||
@@ -145,17 +146,22 @@ export function StepProfile() {
|
|||||||
imageUri,
|
imageUri,
|
||||||
imageMime: avatar.image?.mime ?? 'image/jpeg',
|
imageMime: avatar.image?.mime ?? 'image/jpeg',
|
||||||
isCreatedAvatar: avatar.useCreatedAvatar,
|
isCreatedAvatar: avatar.useCreatedAvatar,
|
||||||
|
creatorState: {
|
||||||
|
emoji: avatar.placeholder,
|
||||||
|
backgroundColor: avatar.backgroundColor,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch({type: 'next'})
|
dispatch({type: 'next'})
|
||||||
track('OnboardingV2:StepProfile:End')
|
track('OnboardingV2:StepProfile:End')
|
||||||
logEvent('onboarding:profile:nextPressed', {})
|
logEvent('onboarding:profile:nextPressed', {})
|
||||||
}, [avatar.image, avatar.useCreatedAvatar, dispatch, track])
|
}, [avatar, dispatch, track])
|
||||||
|
|
||||||
const onDoneCreating = React.useCallback(() => {
|
const onDoneCreating = React.useCallback(() => {
|
||||||
setAvatar(prev => ({
|
setAvatar(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
|
image: undefined,
|
||||||
useCreatedAvatar: true,
|
useCreatedAvatar: true,
|
||||||
}))
|
}))
|
||||||
creatorControl.close()
|
creatorControl.close()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import {logger} from '#/logger'
|
import {logger} from '#/logger'
|
||||||
|
import {AvatarColor, Emoji} from '#/screens/Onboarding/StepProfile/types'
|
||||||
|
|
||||||
export type OnboardingState = {
|
export type OnboardingState = {
|
||||||
hasPrev: boolean
|
hasPrev: boolean
|
||||||
@@ -41,6 +42,10 @@ export type OnboardingState = {
|
|||||||
}
|
}
|
||||||
imageUri?: string
|
imageUri?: string
|
||||||
imageMime?: string
|
imageMime?: string
|
||||||
|
creatorState?: {
|
||||||
|
emoji: Emoji
|
||||||
|
backgroundColor: AvatarColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +82,10 @@ export type OnboardingAction =
|
|||||||
image?: OnboardingState['profileStepResults']['image']
|
image?: OnboardingState['profileStepResults']['image']
|
||||||
imageUri: string
|
imageUri: string
|
||||||
imageMime: string
|
imageMime: string
|
||||||
|
creatorState?: {
|
||||||
|
emoji: Emoji
|
||||||
|
backgroundColor: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ApiResponseMap = {
|
export type ApiResponseMap = {
|
||||||
@@ -349,6 +358,7 @@ export function reducerReduced(
|
|||||||
image: a.image,
|
image: a.image,
|
||||||
imageUri: a.imageUri,
|
imageUri: a.imageUri,
|
||||||
imageMime: a.imageMime,
|
imageMime: a.imageMime,
|
||||||
|
creatorState: a.creatorState,
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user