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

BootstrapModal.jsx 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import React, { useState } from 'react';
  2. import {
  3. Modal,
  4. View,
  5. Text,
  6. Pressable,
  7. StyleSheet,
  8. TouchableWithoutFeedback
  9. } from 'react-native';
  10. const BootstrapModal = ({ visible, setVisible }) => {
  11. return (
  12. <Modal
  13. transparent
  14. animationType="fade"
  15. visible={visible}
  16. onRequestClose={() => setVisible(false)}
  17. >
  18. <TouchableWithoutFeedback onPress={() => setVisible(false)}>
  19. <View style={styles.backdrop} />
  20. </TouchableWithoutFeedback>
  21. <View style={styles.centeredView}>
  22. <View style={styles.modalView}>
  23. <Text style={styles.modalText}>Save as Preset Text?</Text>
  24. <View style={styles.titleInputContainer}>
  25. <Text style={styles.modalSubText}>Set Title</Text>
  26. </View>
  27. <Pressable
  28. style={[styles.button, styles.buttonClose]}
  29. onPress={() => setVisible(false)}
  30. >
  31. <Text style={styles.textStyle}>Save</Text>
  32. </Pressable>
  33. </View>
  34. </View>
  35. </Modal>
  36. );
  37. };
  38. const styles = StyleSheet.create({
  39. centeredView: {
  40. flex: 1,
  41. justifyContent: 'center',
  42. alignItems: 'center',
  43. zIndex: 10,
  44. },
  45. backdrop: {
  46. ...StyleSheet.absoluteFillObject,
  47. backgroundColor: 'rgba(0,0,0,0.5)',
  48. },
  49. modalView: {
  50. width: '80%',
  51. backgroundColor: 'white',
  52. borderRadius: 12,
  53. padding: 20,
  54. alignItems: 'center',
  55. shadowColor: '#000',
  56. shadowOpacity: 0.3,
  57. shadowRadius: 4,
  58. elevation: 5,
  59. },
  60. titleInputContainer: {
  61. alignItems:"flex-start"
  62. },
  63. openButton: {
  64. backgroundColor: '#007bff',
  65. borderRadius: 6,
  66. padding: 10,
  67. elevation: 2,
  68. },
  69. button: {
  70. marginTop: 15,
  71. padding: 10,
  72. borderRadius: 6,
  73. },
  74. buttonClose: {
  75. backgroundColor: '#DD9C49',
  76. borderRadius: 30,
  77. paddingVertical: 10,
  78. paddingHorizontal: 35
  79. },
  80. textStyle: {
  81. color: 'white',
  82. fontWeight: '600',
  83. textAlign: 'center',
  84. },
  85. modalText: {
  86. fontSize: 18,
  87. color: '#396868',
  88. fontWeight: 'bolder'
  89. },
  90. modalSubText: {
  91. fontSize: 12,
  92. color: '#396868',
  93. alignSelf:"flex-start",
  94. fontWeight: 'bolder'
  95. },
  96. textArea: {
  97. height: 220,
  98. borderColor: "#ccc",
  99. borderWidth: 1,
  100. padding: 10,
  101. borderRadius: 8,
  102. textAlignVertical: "top", // Makes text start from the top-left
  103. backgroundColor: "#fff",
  104. marginBottom: 20
  105. }
  106. });
  107. export default BootstrapModal;