Нет описания

explore.tsx 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import { Image } from 'expo-image';
  2. import { Platform, StyleSheet } from 'react-native';
  3. import { Collapsible } from '@/components/ui/collapsible';
  4. import { ExternalLink } from '@/components/external-link';
  5. import ParallaxScrollView from '@/components/parallax-scroll-view';
  6. import { ThemedText } from '@/components/themed-text';
  7. import { ThemedView } from '@/components/themed-view';
  8. import { IconSymbol } from '@/components/ui/icon-symbol';
  9. import { Fonts } from '@/constants/theme';
  10. export default function TabTwoScreen() {
  11. return (
  12. <ParallaxScrollView
  13. headerBackgroundColor={{ light: '#D0D0D0', dark: '#353636' }}
  14. headerImage={
  15. <IconSymbol
  16. size={310}
  17. color="#808080"
  18. name="chevron.left.forwardslash.chevron.right"
  19. style={styles.headerImage}
  20. />
  21. }>
  22. <ThemedView style={styles.titleContainer}>
  23. <ThemedText
  24. type="title"
  25. style={{
  26. fontFamily: Fonts.rounded,
  27. }}>
  28. Explore
  29. </ThemedText>
  30. </ThemedView>
  31. <ThemedText>This app includes example code to help you get started.</ThemedText>
  32. <Collapsible title="File-based routing">
  33. <ThemedText>
  34. This app has two screens:{' '}
  35. <ThemedText type="defaultSemiBold">app/(tabs)/index.tsx</ThemedText> and{' '}
  36. <ThemedText type="defaultSemiBold">app/(tabs)/explore.tsx</ThemedText>
  37. </ThemedText>
  38. <ThemedText>
  39. The layout file in <ThemedText type="defaultSemiBold">app/(tabs)/_layout.tsx</ThemedText>{' '}
  40. sets up the tab navigator.
  41. </ThemedText>
  42. <ExternalLink href="https://docs.expo.dev/router/introduction">
  43. <ThemedText type="link">Learn more</ThemedText>
  44. </ExternalLink>
  45. </Collapsible>
  46. <Collapsible title="Android, iOS, and web support">
  47. <ThemedText>
  48. You can open this project on Android, iOS, and the web. To open the web version, press{' '}
  49. <ThemedText type="defaultSemiBold">w</ThemedText> in the terminal running this project.
  50. </ThemedText>
  51. </Collapsible>
  52. <Collapsible title="Images">
  53. <ThemedText>
  54. For static images, you can use the <ThemedText type="defaultSemiBold">@2x</ThemedText> and{' '}
  55. <ThemedText type="defaultSemiBold">@3x</ThemedText> suffixes to provide files for
  56. different screen densities
  57. </ThemedText>
  58. <Image
  59. source={require('@/assets/images/react-logo.png')}
  60. style={{ width: 100, height: 100, alignSelf: 'center' }}
  61. />
  62. <ExternalLink href="https://reactnative.dev/docs/images">
  63. <ThemedText type="link">Learn more</ThemedText>
  64. </ExternalLink>
  65. </Collapsible>
  66. <Collapsible title="Light and dark mode components">
  67. <ThemedText>
  68. This template has light and dark mode support. The{' '}
  69. <ThemedText type="defaultSemiBold">useColorScheme()</ThemedText> hook lets you inspect
  70. what the user&apos;s current color scheme is, and so you can adjust UI colors accordingly.
  71. </ThemedText>
  72. <ExternalLink href="https://docs.expo.dev/develop/user-interface/color-themes/">
  73. <ThemedText type="link">Learn more</ThemedText>
  74. </ExternalLink>
  75. </Collapsible>
  76. <Collapsible title="Animations">
  77. <ThemedText>
  78. This template includes an example of an animated component. The{' '}
  79. <ThemedText type="defaultSemiBold">components/HelloWave.tsx</ThemedText> component uses
  80. the powerful{' '}
  81. <ThemedText type="defaultSemiBold" style={{ fontFamily: Fonts.mono }}>
  82. react-native-reanimated
  83. </ThemedText>{' '}
  84. library to create a waving hand animation.
  85. </ThemedText>
  86. {Platform.select({
  87. ios: (
  88. <ThemedText>
  89. The <ThemedText type="defaultSemiBold">components/ParallaxScrollView.tsx</ThemedText>{' '}
  90. component provides a parallax effect for the header image.
  91. </ThemedText>
  92. ),
  93. })}
  94. </Collapsible>
  95. </ParallaxScrollView>
  96. );
  97. }
  98. const styles = StyleSheet.create({
  99. headerImage: {
  100. color: '#808080',
  101. bottom: -90,
  102. left: -35,
  103. position: 'absolute',
  104. },
  105. titleContainer: {
  106. flexDirection: 'row',
  107. gap: 8,
  108. },
  109. });