Created
June 5, 2024 08:38
-
-
Save mkhuda/312ffc08f3bb29de8990a775f213e9f5 to your computer and use it in GitHub Desktop.
GameItem.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { View, Text, Image, StyleSheet, TouchableOpacity } from 'react-native'; | |
const GameItem = () => { | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.headerText}>Game section bang</Text> | |
<Image | |
style={styles.image} | |
source={{ uri: 'https://reactnative.dev/img/tiny_logo.png' }} | |
/> | |
<View style={styles.bottomContainer}> | |
<TouchableOpacity style={styles.playButton} onPress={() => console.log('play')}> | |
<Text style={styles.playButtonText}>PLAY</Text> | |
</TouchableOpacity> | |
<Text style={styles.titleText}>Numbers Blitz</Text> | |
<Text style={styles.descriptionText}> | |
Jago berhitung? Yuk buktikan dengan menemukan nilai dari variabel tersembunyi! | |
</Text> | |
</View> | |
</View> | |
); | |
}; | |
const styles = StyleSheet.create({ | |
container: { | |
backgroundColor: 'darkblue', | |
borderRadius: 40, | |
alignItems: 'center', | |
paddingBottom: 20, | |
marginBottom: 20, | |
}, | |
headerText: { | |
color: 'red', | |
marginTop: 20, | |
}, | |
image: { | |
width: 100, | |
height: 100, | |
alignSelf: 'center', | |
marginTop: 10, | |
}, | |
bottomContainer: { | |
backgroundColor: 'plum', | |
borderRadius: 40, | |
padding: 20, | |
width: '100%', | |
alignItems: 'center', | |
marginTop: -20, | |
paddingTop: 40, // Create space for the play button | |
}, | |
playButton: { | |
backgroundColor: 'darkblue', | |
borderColor: 'plum', | |
borderWidth: 2, | |
borderRadius: 25, | |
paddingVertical: 10, | |
paddingHorizontal: 30, | |
position: 'absolute', // Keep it absolute to overlap | |
top: 0, // Adjust based on your requirement | |
alignSelf: 'center', | |
zIndex: 1, | |
}, | |
playButtonText: { | |
color: 'white', | |
fontSize: 16, | |
fontWeight: 'bold', | |
}, | |
titleText: { | |
marginTop: 10, // Adjust to create space after the play button | |
fontSize: 20, | |
fontWeight: 'bold', | |
color: '#fff', | |
textAlign: 'center', | |
}, | |
descriptionText: { | |
fontSize: 16, | |
color: '#fff', | |
textAlign: 'center', | |
marginTop: 10, | |
}, | |
}); | |
export default GameItem; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment