|
| 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 |
| 8 | + * @format |
| 9 | + */ |
| 10 | + |
| 11 | +'use strict'; |
| 12 | + |
| 13 | +import React from 'react'; |
| 14 | +import {View, Text, StyleSheet, TouchableOpacity, Linking} from 'react-native'; |
| 15 | +import Colors from './Colors'; |
| 16 | + |
| 17 | +const links = [ |
| 18 | + { |
| 19 | + title: 'The Basics', |
| 20 | + link: 'https://facebook.github.io/react-native/docs/tutorial', |
| 21 | + description: |
| 22 | + 'Read the docs on what to do once seen how to work in React Native.', |
| 23 | + }, |
| 24 | + { |
| 25 | + title: 'Style', |
| 26 | + link: 'https://facebook.github.io/react-native/docs/style', |
| 27 | + description: 'All of the core components accept a prop named style.', |
| 28 | + }, |
| 29 | + { |
| 30 | + title: 'Layout', |
| 31 | + link: 'https://facebook.github.io/react-native/docs/flexbox', |
| 32 | + description: |
| 33 | + 'A component can specify the layout of its children using the flexbox specification.', |
| 34 | + }, |
| 35 | + { |
| 36 | + title: 'Components', |
| 37 | + link: 'https://facebook.github.io/react-native/docs/components-and-apis', |
| 38 | + description: 'The full list of components and APIs inside React Native.', |
| 39 | + }, |
| 40 | + { |
| 41 | + title: 'Navigation', |
| 42 | + link: 'https://facebook.github.io/react-native/docs/navigation', |
| 43 | + description: |
| 44 | + 'How to handle moving between screens inside your application.', |
| 45 | + }, |
| 46 | + { |
| 47 | + title: 'Networking', |
| 48 | + link: 'https://facebook.github.io/react-native/docs/network', |
| 49 | + description: 'How to use the Fetch API in React Native.', |
| 50 | + }, |
| 51 | + { |
| 52 | + title: 'Help', |
| 53 | + link: 'https://facebook.github.io/react-native/help', |
| 54 | + description: |
| 55 | + 'Need more help? There are many other React Native developers who may have the answer.', |
| 56 | + }, |
| 57 | +]; |
| 58 | + |
| 59 | +const LinkList = () => ( |
| 60 | + <View style={styles.container}> |
| 61 | + {links.map((item, index) => { |
| 62 | + return ( |
| 63 | + <React.Fragment key={index}> |
| 64 | + <View style={styles.separator} /> |
| 65 | + <TouchableOpacity |
| 66 | + accessibilityRole={'button'} |
| 67 | + onPress={() => Linking.openURL(item.link)} |
| 68 | + style={styles.linkContainer}> |
| 69 | + <Text style={styles.link}>{item.title}</Text> |
| 70 | + <Text style={styles.description}>{item.description}</Text> |
| 71 | + </TouchableOpacity> |
| 72 | + </React.Fragment> |
| 73 | + ); |
| 74 | + })} |
| 75 | + </View> |
| 76 | +); |
| 77 | + |
| 78 | +const styles = StyleSheet.create({ |
| 79 | + container: { |
| 80 | + marginTop: 32, |
| 81 | + paddingHorizontal: 24, |
| 82 | + }, |
| 83 | + linkContainer: { |
| 84 | + flexWrap: 'wrap', |
| 85 | + flexDirection: 'row', |
| 86 | + justifyContent: 'space-between', |
| 87 | + alignItems: 'center', |
| 88 | + paddingVertical: 8, |
| 89 | + }, |
| 90 | + link: { |
| 91 | + flex: 2, |
| 92 | + fontSize: 18, |
| 93 | + fontWeight: '400', |
| 94 | + color: Colors.primary, |
| 95 | + }, |
| 96 | + description: { |
| 97 | + flex: 3, |
| 98 | + paddingVertical: 16, |
| 99 | + fontWeight: '400', |
| 100 | + fontSize: 18, |
| 101 | + color: Colors.dark, |
| 102 | + }, |
| 103 | + separator: { |
| 104 | + backgroundColor: Colors.light, |
| 105 | + height: 1, |
| 106 | + }, |
| 107 | +}); |
| 108 | + |
| 109 | +export default LinkList; |
0 commit comments