@@ -18,6 +18,7 @@ import ResultDiaplay from '../Components/Global/ReaultDiaplay';
1818
1919export const CodePage = ( { navigation} ) => {
2020 const windowWidth = Dimensions . get ( 'window' ) . width ;
21+ const windowHeight = Dimensions . get ( 'window' ) . height ;
2122 const [ input , setInput ] = useState ( '' ) ;
2223 const [ loading , setloading ] = useState ( false ) ;
2324 const [ code , setCode ] = useState ( '' ) ;
@@ -54,11 +55,9 @@ export const CodePage = ({navigation}) => {
5455 . request ( config )
5556 . then ( r => {
5657 setCode ( r . data . candidates [ 0 ] . content ) ;
57- setInput ( '' ) ;
5858 setloading ( false ) ;
5959 } )
6060 . catch ( e => {
61- setInput ( '' ) ;
6261 setloading ( false ) ;
6362 if ( e . message === 'Network Error' ) {
6463 toast . show ( 'No Internet 😟' , {
@@ -90,13 +89,20 @@ export const CodePage = ({navigation}) => {
9089 overflow : 'hidden' ,
9190 } } >
9291 < TextInput
92+ clearButtonMode = "while-editing"
93+ multiline = { true }
94+ scrollEnabled = { true }
95+ numberOfLines = { 6 }
9396 placeholder = { 'Problem statement' }
9497 value = { input }
9598 onChangeText = { text => {
9699 setInput ( text ) ;
97100 } }
98101 placeholderTextColor = { 'rgb(197, 195, 195)' }
99102 style = { {
103+ maxHeight : windowHeight * 0.35 ,
104+ alignItems : 'flex-start' ,
105+ textAlignVertical : 'top' ,
100106 backgroundColor : '#292250' ,
101107 padding : 15 ,
102108 color : 'white' ,
@@ -107,30 +113,60 @@ export const CodePage = ({navigation}) => {
107113 </ View >
108114 </ View >
109115 { ! loading && (
110- < TouchableOpacity
111- onPress = { ( ) => {
112- if ( ! loading ) {
113- GenerateCode ( ) ;
114- }
115- } }
116+ < View
116117 style = { {
117- backgroundColor : '#4341c2' ,
118- marginHorizontal : 20 ,
119- alignItems : 'center' ,
120- justifyContent : 'center' ,
121- height : 50 ,
122- borderBottomRightRadius : 10 ,
123- borderBottomLeftRadius : 10 ,
118+ flexDirection : 'row' ,
119+ gap : 2 ,
124120 } } >
125- < Text
121+ < TouchableOpacity
122+ onPress = { ( ) => {
123+ if ( ! loading ) {
124+ setInput ( '' ) ;
125+ }
126+ } }
126127 style = { {
127- textAlign : 'center' ,
128- fontSize : windowWidth * 0.035 ,
129- color : 'rgb(236, 236, 236)' ,
128+ backgroundColor : '#4341c2' ,
129+ marginLeft : 20 ,
130+ alignItems : 'center' ,
131+ justifyContent : 'center' ,
132+ height : 50 ,
133+ flex : 1 ,
134+ borderBottomLeftRadius : 10 ,
130135 } } >
131- Generate
132- </ Text >
133- </ TouchableOpacity >
136+ < Text
137+ style = { {
138+ textAlign : 'center' ,
139+ fontSize : windowWidth * 0.032 ,
140+ color : 'rgb(236, 236, 236)' ,
141+ } } >
142+ Clear text
143+ </ Text >
144+ </ TouchableOpacity >
145+ < TouchableOpacity
146+ onPress = { ( ) => {
147+ if ( ! loading ) {
148+ GenerateCode ( ) ;
149+ }
150+ } }
151+ style = { {
152+ backgroundColor : '#4341c2' ,
153+ marginRight : 20 ,
154+ alignItems : 'center' ,
155+ justifyContent : 'center' ,
156+ height : 50 ,
157+ flex : 1 ,
158+ borderBottomRightRadius : 10 ,
159+ } } >
160+ < Text
161+ style = { {
162+ textAlign : 'center' ,
163+ fontSize : windowWidth * 0.032 ,
164+ color : 'rgb(236, 236, 236)' ,
165+ } } >
166+ Generate
167+ </ Text >
168+ </ TouchableOpacity >
169+ </ View >
134170 ) }
135171 { loading && (
136172 < View
0 commit comments