1- import type { ReactNode } from 'react'
21import { useEffect , useState } from 'react'
32
43import { css } from '@emotion/native'
@@ -9,32 +8,20 @@ import {
98 updateRouteOnCompletion ,
109 setValueField
1110} from 'common/store/pages/signon/actions'
12- import { ImageBackground , SafeAreaView } from 'react-native'
13- import Animated , {
14- CurvedTransition ,
15- FadeIn ,
16- FadeOut ,
17- SlideInUp
18- } from 'react-native-reanimated'
11+ import { useDarkMode } from 'react-native-dynamic'
1912import { useSafeAreaInsets } from 'react-native-safe-area-context'
20- import { usePrevious } from 'react-use'
2113
2214import {
15+ Divider ,
2316 Flex ,
24- IconAudiusLogoHorizontalColorNew ,
2517 IconAudiusLogoHorizontalNew ,
26- Paper ,
27- RadialGradient ,
2818 Text ,
2919 TextLink ,
30- useTheme
20+ ThemeProvider as HarmonyThemeProvider
3121} from '@audius/harmony-native'
32- import DJBackground from 'app/assets/images/DJportrait.jpg'
3322import type { NonLinkProps } from 'app/harmony-native/components/TextLink/types'
3423import { dispatch } from 'app/store'
3524
36- import { AudiusValues } from '../components/AudiusValues'
37- import { PANEL_EXPAND_DURATION } from '../constants'
3825import type { SignOnScreenParamList } from '../types'
3926
4027import { CreateEmailScreen } from './CreateEmailScreen'
@@ -46,102 +33,25 @@ const messages = {
4633 createAccount : 'Create an Account'
4734}
4835
49- const AnimatedPaper = Animated . createAnimatedComponent ( Paper )
50- const AnimatedFlex = Animated . createAnimatedComponent ( Flex )
51-
5236const CreateAccountLink = ( props : NonLinkProps ) => {
5337 const { onPress } = props
54- const { spacing } = useTheme ( )
55-
56- return (
57- < AnimatedFlex
58- alignItems = 'center'
59- justifyContent = 'flex-end'
60- style = { css ( { flexGrow : 1 } ) }
61- entering = { FadeIn }
62- exiting = { FadeOut }
63- >
64- < SafeAreaView style = { { paddingBottom : spacing [ '3xl' ] } } >
65- < Text
66- variant = 'title'
67- strength = 'weak'
68- textAlign = 'center'
69- color = 'inverse'
70- style = { { justifyContent : 'flex-end' } }
71- >
72- { messages . newToAudius } { ' ' }
73- < TextLink showUnderline onPress = { onPress } >
74- { messages . createAccount }
75- </ TextLink >
76- </ Text >
77- </ SafeAreaView >
78- </ AnimatedFlex >
79- )
80- }
8138
82- const Background = ( ) => {
8339 return (
8440 < Flex
85- h = '100%'
86- w = '100%'
8741 alignItems = 'center'
8842 justifyContent = 'flex-end'
89- style = { css ( {
90- position : 'absolute' ,
91- top : 0 ,
92- left : 0
93- } ) }
43+ style = { css ( { flexGrow : 1 } ) }
9444 >
95- < RadialGradient
96- style = { css ( { position : 'absolute' , zIndex : 1 } ) }
97- colors = { [
98- 'rgba(91, 35, 225, 0.8)' ,
99- 'rgba(113, 41, 230, 0.64)' ,
100- 'rgba(162, 47, 235, 0.5)'
101- ] }
102- stops = { [ 0 , 0.67 , 1 ] }
103- radius = { 100 }
104- />
105- < ImageBackground
106- source = { DJBackground }
107- style = { {
108- width : '100%' ,
109- height : '100%' ,
110- position : 'absolute' ,
111- top : 0
112- } }
113- resizeMode = 'cover'
114- />
45+ < Text variant = 'title' strength = 'weak' textAlign = 'center' color = 'subdued' >
46+ { messages . newToAudius } { ' ' }
47+ < TextLink showUnderline onPress = { onPress } >
48+ { messages . createAccount }
49+ </ TextLink >
50+ </ Text >
11551 </ Flex >
11652 )
11753}
11854
119- type ExpandablePanelProps = {
120- children : ReactNode
121- }
122-
123- const ExpandablePanel = ( props : ExpandablePanelProps ) => {
124- const { children } = props
125- const insets = useSafeAreaInsets ( )
126- const { cornerRadius } = useTheme ( )
127- return (
128- < AnimatedPaper
129- entering = { SlideInUp . duration ( PANEL_EXPAND_DURATION ) }
130- layout = { CurvedTransition }
131- style = { css ( {
132- overflow : 'hidden' ,
133- paddingTop : insets . top ,
134- borderBottomLeftRadius : cornerRadius [ '3xl' ] ,
135- borderBottomRightRadius : cornerRadius [ '3xl' ]
136- } ) }
137- >
138- < Flex gap = '2xl' ph = 'l' pv = '2xl' >
139- { children }
140- </ Flex >
141- </ AnimatedPaper >
142- )
143- }
144-
14555export type SignOnScreenParams = {
14656 screen : SignOnScreenType
14757 guestEmail ?: string
@@ -158,15 +68,14 @@ type SignOnScreenProps = {
15868 */
15969export const SignOnScreen = ( props : SignOnScreenProps ) => {
16070 const { isSplashScreenDismissed } = props
161- const theme = useTheme ( )
16271 const { params } = useRoute < RouteProp < SignOnScreenParamList , 'SignOn' > > ( )
16372 const {
16473 screen : screenParam = 'sign-up' ,
16574 guestEmail,
16675 routeOnCompletion
16776 } = params ?? { }
16877 const [ screen , setScreen ] = useState < SignOnScreenType > ( screenParam )
169- const previousScreen = usePrevious ( screen )
78+ const insets = useSafeAreaInsets ( )
17079
17180 useEffect ( ( ) => {
17281 if ( guestEmail ) {
@@ -181,38 +90,41 @@ export const SignOnScreen = (props: SignOnScreenProps) => {
18190 setScreen ( screenParam )
18291 } , [ guestEmail , routeOnCompletion , screenParam ] )
18392
93+ const isDarkMode = useDarkMode ( )
94+ const signOnThemeName = isDarkMode ? 'default-dark' : 'default-light'
95+
96+ if ( ! isSplashScreenDismissed ) return null
97+
18498 return (
185- < >
186- < Background />
187- { isSplashScreenDismissed ? (
188- < Flex flex = { 1 } style = { css ( { flexGrow : 1 , zIndex : 2 } ) } h = '100%' >
189- < ExpandablePanel >
190- { theme . type === 'dark' ? (
191- < IconAudiusLogoHorizontalNew
192- style = { css ( { alignSelf : 'center' } ) }
193- width = { 200 }
194- color = 'inverse'
195- />
196- ) : (
197- < IconAudiusLogoHorizontalColorNew
198- style = { css ( { alignSelf : 'center' } ) }
199- />
200- ) }
201- { screen === 'sign-up' ? (
202- < CreateEmailScreen onChangeScreen = { setScreen } />
203- ) : (
204- < SignInScreen />
205- ) }
206- </ ExpandablePanel >
99+ < HarmonyThemeProvider themeName = { signOnThemeName } >
100+ < Flex
101+ flex = { 1 }
102+ h = '100%'
103+ backgroundColor = 'surface1'
104+ style = { css ( { paddingTop : insets . top } ) }
105+ >
106+ < Divider />
107+ < Flex
108+ flex = { 1 }
109+ alignItems = 'stretch'
110+ style = { css ( { gap : 48 , paddingHorizontal : 16 , paddingVertical : 80 } ) }
111+ >
112+ < IconAudiusLogoHorizontalNew
113+ style = { css ( { alignSelf : 'center' } ) }
114+ height = { 48 }
115+ width = { 236 }
116+ color = 'default'
117+ />
207118 { screen === 'sign-up' ? (
208- < AudiusValues
209- isPanelExpanded = { previousScreen && previousScreen !== screen }
210- />
119+ < CreateEmailScreen onChangeScreen = { setScreen } />
211120 ) : (
212- < CreateAccountLink onPress = { ( ) => setScreen ( 'sign-up' ) } />
121+ < SignInScreen />
213122 ) }
123+ { screen === 'sign-in' ? (
124+ < CreateAccountLink onPress = { ( ) => setScreen ( 'sign-up' ) } />
125+ ) : null }
214126 </ Flex >
215- ) : null }
216- </ >
127+ </ Flex >
128+ </ HarmonyThemeProvider >
217129 )
218130}
0 commit comments