LearnMoreLinks.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @flow strict-local
  8. * @format
  9. */
  10. 'use strict';
  11. import Colors from './Colors';
  12. import type {Node} from 'react';
  13. import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser';
  14. import {View, Text, StyleSheet, TouchableOpacity} from 'react-native';
  15. import React from 'react';
  16. const links = [
  17. {
  18. id: 1,
  19. title: 'The Basics',
  20. link: 'https://reactnative.dev/docs/tutorial',
  21. description: 'Explains a Hello World for React Native.',
  22. },
  23. {
  24. id: 2,
  25. title: 'Style',
  26. link: 'https://reactnative.dev/docs/style',
  27. description:
  28. 'Covers how to use the prop named style which controls the visuals.',
  29. },
  30. {
  31. id: 3,
  32. title: 'Layout',
  33. link: 'https://reactnative.dev/docs/flexbox',
  34. description: 'React Native uses flexbox for layout, learn how it works.',
  35. },
  36. {
  37. id: 4,
  38. title: 'Components',
  39. link: 'https://reactnative.dev/docs/components-and-apis',
  40. description: 'The full list of components and APIs inside React Native.',
  41. },
  42. {
  43. id: 5,
  44. title: 'Navigation',
  45. link: 'https://reactnative.dev/docs/navigation',
  46. description:
  47. 'How to handle moving between screens inside your application.',
  48. },
  49. {
  50. id: 6,
  51. title: 'Networking',
  52. link: 'https://reactnative.dev/docs/network',
  53. description: 'How to use the Fetch API in React Native.',
  54. },
  55. {
  56. id: 7,
  57. title: 'Help',
  58. link: 'https://reactnative.dev/help',
  59. description:
  60. 'Need more help? There are many other React Native developers who may have the answer.',
  61. },
  62. {
  63. id: 8,
  64. title: 'Follow us on Twitter',
  65. link: 'https://twitter.com/reactnative',
  66. description:
  67. 'Stay in touch with the community, join in on Q&As and more by following React Native on Twitter.',
  68. },
  69. ];
  70. const LinkList = (): Node => (
  71. <View style={styles.container}>
  72. {links.map(({id, title, link, description}) => {
  73. return (
  74. <React.Fragment key={id}>
  75. <View style={styles.separator} />
  76. <TouchableOpacity
  77. accessibilityRole={'button'}
  78. onPress={() => openURLInBrowser(link)}
  79. style={styles.linkContainer}>
  80. <Text style={styles.link}>{title}</Text>
  81. <Text style={styles.description}>{description}</Text>
  82. </TouchableOpacity>
  83. </React.Fragment>
  84. );
  85. })}
  86. </View>
  87. );
  88. const styles = StyleSheet.create({
  89. container: {
  90. marginTop: 32,
  91. paddingHorizontal: 24,
  92. },
  93. linkContainer: {
  94. flexWrap: 'wrap',
  95. flexDirection: 'row',
  96. justifyContent: 'space-between',
  97. alignItems: 'center',
  98. paddingVertical: 8,
  99. },
  100. link: {
  101. flex: 2,
  102. fontSize: 18,
  103. fontWeight: '400',
  104. color: Colors.primary,
  105. },
  106. description: {
  107. flex: 3,
  108. paddingVertical: 16,
  109. fontWeight: '400',
  110. fontSize: 18,
  111. color: Colors.dark,
  112. },
  113. separator: {
  114. backgroundColor: Colors.light,
  115. height: 1,
  116. },
  117. });
  118. export default LinkList;