|
| 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} from 'react-native'; |
| 15 | +// @ts-ignore |
| 16 | +import openURLInBrowser from 'react-native/Libraries/Core/Devtools/openURLInBrowser'; |
| 17 | +import {Colors} from 'react-native/Libraries/NewAppScreen'; |
| 18 | + |
| 19 | +const links = [ |
| 20 | + { |
| 21 | + title: 'React', |
| 22 | + link: 'https://reactjs.org/', |
| 23 | + description: 'JavaScript library for building user interfaces', |
| 24 | + }, |
| 25 | + { |
| 26 | + title: 'Redux', |
| 27 | + link: 'https://redux.js.org/', |
| 28 | + description: 'A Predictable State Container for JS Apps', |
| 29 | + }, |
| 30 | + { |
| 31 | + title: 'Redux Toolkit', |
| 32 | + link: 'https://redux-toolkit.js.org/', |
| 33 | + description: |
| 34 | + 'The official, opinionated, batteries-included toolset for efficient Redux development', |
| 35 | + }, |
| 36 | + { |
| 37 | + title: 'React Redux', |
| 38 | + link: 'https://react-redux.js.org', |
| 39 | + description: 'Official React bindings for Redux', |
| 40 | + }, |
| 41 | +]; |
| 42 | + |
| 43 | +const LinkList = () => ( |
| 44 | + <View style={styles.container}> |
| 45 | + {links.map((item, index) => { |
| 46 | + return ( |
| 47 | + <React.Fragment key={index}> |
| 48 | + <View style={styles.separator} /> |
| 49 | + <TouchableOpacity |
| 50 | + accessibilityRole={'button'} |
| 51 | + onPress={() => openURLInBrowser(item.link)} |
| 52 | + style={styles.linkContainer}> |
| 53 | + <Text style={styles.link}>{item.title}</Text> |
| 54 | + <Text style={styles.description}>{item.description}</Text> |
| 55 | + </TouchableOpacity> |
| 56 | + </React.Fragment> |
| 57 | + ); |
| 58 | + })} |
| 59 | + </View> |
| 60 | +); |
| 61 | + |
| 62 | +const styles = StyleSheet.create({ |
| 63 | + container: { |
| 64 | + marginTop: 32, |
| 65 | + paddingHorizontal: 24, |
| 66 | + }, |
| 67 | + linkContainer: { |
| 68 | + flexWrap: 'wrap', |
| 69 | + flexDirection: 'row', |
| 70 | + justifyContent: 'space-between', |
| 71 | + alignItems: 'center', |
| 72 | + paddingVertical: 8, |
| 73 | + }, |
| 74 | + link: { |
| 75 | + flex: 2, |
| 76 | + fontSize: 18, |
| 77 | + fontWeight: '400', |
| 78 | + color: Colors.primary, |
| 79 | + }, |
| 80 | + description: { |
| 81 | + flex: 3, |
| 82 | + paddingVertical: 16, |
| 83 | + fontWeight: '400', |
| 84 | + fontSize: 18, |
| 85 | + color: Colors.dark, |
| 86 | + }, |
| 87 | + separator: { |
| 88 | + backgroundColor: Colors.light, |
| 89 | + height: 1, |
| 90 | + }, |
| 91 | +}); |
| 92 | + |
| 93 | +export default LinkList; |
0 commit comments