Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

LinksSection.tsx 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React, { useCallback, useMemo } from 'react';
  2. import { Linking, View, ViewStyle } from 'react-native';
  3. import { useSelector } from 'react-redux';
  4. import { IReduxState } from '../../../app/types';
  5. import { getLegalUrls } from '../../../base/config/functions.native';
  6. import Button from '../../../base/ui/components/native/Button';
  7. import { BUTTON_TYPES } from '../../../base/ui/constants.native';
  8. import FormSection from './FormSection';
  9. import styles from './styles';
  10. const LinksSection = () => {
  11. const {
  12. privacy,
  13. helpCentre,
  14. terms
  15. } = useSelector((state: IReduxState) => getLegalUrls(state));
  16. const links = useMemo(() => [
  17. {
  18. label: 'settingsView.help',
  19. link: helpCentre
  20. },
  21. {
  22. label: 'settingsView.terms',
  23. link: terms
  24. },
  25. {
  26. label: 'settingsView.privacy',
  27. link: privacy
  28. }
  29. ], [ privacy, helpCentre, terms ]);
  30. const onLinkPress = useCallback(link => () => Linking.openURL(link), [ Linking ]);
  31. return (
  32. <FormSection>
  33. <View style = { styles.linksSection as ViewStyle }>
  34. {
  35. links.map(({ label, link }) => (
  36. <Button
  37. accessibilityLabel = { label }
  38. key = { label }
  39. labelKey = { label }
  40. onClick = { onLinkPress(link) }
  41. style = { styles.linksButton }
  42. type = { BUTTON_TYPES.TERTIARY } />
  43. ))
  44. }
  45. </View>
  46. </FormSection>
  47. );
  48. };
  49. export default LinksSection;