File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Random-Generator/app/(tabs) Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -6,10 +6,11 @@ import { Text, View } from '@/components/Themed';
66
77export default function TabTwoScreen ( ) {
88
9- // State variable to hold image URL
9+ // State variable to hold image URL, if useState('') has a default image path, then no need to use useEffect
1010 const [ imageUrl , setImageUrl ] = useState ( '' ) ;
1111 const totalImages = 1400 ;
1212
13+ // useEffect will generate a new image when first open the app
1314 useEffect ( ( ) => {
1415 const randomNumber = Math . floor ( Math . random ( ) * totalImages ) ;
1516
@@ -56,8 +57,8 @@ const styles = StyleSheet.create({
5657 width : '80%' ,
5758 } ,
5859 image : {
59- width : 300 ,
60- height : 300 ,
60+ width : 400 ,
61+ height : 400 ,
6162 resizeMode : 'contain' ,
6263 marginBottom : 20 ,
6364 }
You can’t perform that action at this time.
0 commit comments