react-native-navigation的迁移库

CocktailDetailsScreen.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. const React = require('react');
  2. const { Image, Platform, SafeAreaView, StyleSheet, Text, View } = require('react-native');
  3. class CocktailDetailsScreen extends React.Component {
  4. static options() {
  5. return {
  6. ...Platform.select({
  7. android: {
  8. statusBar: {
  9. style: 'dark',
  10. backgroundColor: 'white'
  11. }
  12. }
  13. }),
  14. topBar: {
  15. title: {
  16. text: 'Cocktails'
  17. }
  18. }
  19. }
  20. }
  21. render() {
  22. return (
  23. <SafeAreaView style={styles.root}>
  24. <View nativeID={'backdrop'} style={[styles.backdrop, { backgroundColor: this.props.color }]}/>
  25. <View style={styles.header}>
  26. <Image
  27. source={this.props.image}
  28. nativeID={`image${this.props.id}Dest`}
  29. style={styles.image}
  30. />
  31. <Text style={styles.title} nativeID={`title${this.props.id}Dest`}>{this.props.name}</Text>
  32. </View>
  33. <Text
  34. nativeID='description'
  35. style={styles.description}>
  36. {this.props.description}
  37. </Text>
  38. </SafeAreaView >
  39. );
  40. }
  41. }
  42. module.exports = CocktailDetailsScreen;
  43. const SIZE = 120;
  44. const HEADER = 150;
  45. const styles = StyleSheet.create({
  46. root: {
  47. marginTop: 0
  48. },
  49. header: {
  50. marginTop: -HEADER,
  51. flexDirection: 'row',
  52. alignItems: 'flex-end',
  53. height: HEADER,
  54. },
  55. backdrop: {
  56. height: HEADER,
  57. width: '100%',
  58. zIndex: 0
  59. },
  60. title: {
  61. fontSize: 32,
  62. color: 'whitesmoke',
  63. marginLeft: 16,
  64. marginBottom: 16,
  65. zIndex: 2
  66. },
  67. description: {
  68. fontSize: 15,
  69. letterSpacing: 0.2,
  70. lineHeight: 25,
  71. marginTop: 32,
  72. marginHorizontal: 24
  73. },
  74. image: {
  75. height: SIZE,
  76. width: SIZE,
  77. zIndex: 1,
  78. marginLeft: 24,
  79. marginBottom: -24
  80. }
  81. });