NotificationSettingsPage.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import {StyleSheet, Text, View} from 'react-native';
  2. import React, { useState } from 'react';
  3. import fonts from '../theme/fonts';
  4. import NewscoutTitleHeader from '../components/organisms/Headers/NewscoutTitleHeader';
  5. import { List, Switch } from 'react-native-paper';
  6. const NotificationSettingsPage = props => {
  7. const {navigation} = props;
  8. const [soundStatus, setSoundStatus] = useState(false);
  9. const [vibrateStatus, setVibrateStatus] = useState(false);
  10. const [tipStatus, setTipStatus] = useState(false);
  11. const [serviceStatus, setServiceStatus] = useState(false);
  12. const listItems = [
  13. {
  14. title: 'Sound',
  15. id: 0,
  16. state: soundStatus,
  17. onChange: () => setSoundStatus(!soundStatus),
  18. },
  19. {
  20. title: 'Vibrate',
  21. id: 1,
  22. state: vibrateStatus,
  23. onChange: () => setVibrateStatus(!vibrateStatus),
  24. },
  25. {
  26. title: 'New tips available',
  27. id: 2,
  28. state: tipStatus,
  29. onChange: () => setTipStatus(!tipStatus),
  30. },
  31. {
  32. title: 'New service available',
  33. id: 3,
  34. state: serviceStatus,
  35. onChange: () => setServiceStatus(!serviceStatus),
  36. },
  37. ];
  38. return (
  39. <View>
  40. <NewscoutTitleHeader
  41. title={'Notifications'}
  42. backButtonShown={true}
  43. onBackClick={() => navigation.goBack()}
  44. />
  45. {listItems.map(item => (
  46. <List.Item
  47. title={item.title}
  48. titleStyle={styles.listItemText}
  49. style={styles.listItem}
  50. key={item.id}
  51. right={props => (
  52. <Switch
  53. value={item.state}
  54. onValueChange={item.onChange}
  55. />
  56. )}
  57. />
  58. ))}
  59. {/* <List.Item
  60. title={'Face ID'}
  61. titleStyle={styles.listItemText}
  62. style={styles.listItem}
  63. key={'1'}
  64. right={props => (
  65. <Switch
  66. value={soundStatus}
  67. onValueChange={() => setFaceIdStatus(!faceIdStatus)}
  68. />
  69. )}
  70. />
  71. <List.Item
  72. title={'Remember Me'}
  73. titleStyle={styles.listItemText}
  74. style={styles.listItem}
  75. key={'2'}
  76. right={props => (
  77. <Switch
  78. value={rememberMeStatus}
  79. onValueChange={() => setRememberMeStatus(!rememberMeStatus)}
  80. />
  81. )}
  82. />
  83. <List.Item
  84. title={'Touch ID'}
  85. titleStyle={styles.listItemText}
  86. style={styles.listItem}
  87. key={'3'}
  88. right={props => (
  89. <Switch
  90. value={touchIdStatus}
  91. onValueChange={() => setTouchIdStatus(!touchIdStatus)}
  92. />
  93. )}
  94. /> */}
  95. </View>
  96. );
  97. };
  98. export default NotificationSettingsPage;
  99. const styles = StyleSheet.create({
  100. listItemText: {
  101. fontFamily: fonts.type.medium,
  102. },
  103. listItem: {
  104. height: 64,
  105. justifyContent: 'center',
  106. },
  107. });