1
1
import type { ViewStyle } from 'react-native' ;
2
2
3
- import { getTheme } from './FeedbackWidget.theme' ;
3
+ import type { FeedbackWidgetTheme } from './FeedbackWidget.theme' ;
4
4
import type { FeedbackButtonStyles , FeedbackWidgetStyles } from './FeedbackWidget.types' ;
5
5
6
- const defaultStyles : FeedbackWidgetStyles = {
7
- container : {
8
- flex : 1 ,
9
- padding : 20 ,
10
- backgroundColor : getTheme ( ) . background ,
11
- } ,
12
- title : {
13
- fontSize : 24 ,
14
- fontWeight : 'bold' ,
15
- marginBottom : 20 ,
16
- textAlign : 'left' ,
17
- flex : 1 ,
18
- color : getTheme ( ) . foreground ,
19
- } ,
20
- label : {
21
- marginBottom : 4 ,
22
- fontSize : 16 ,
23
- color : getTheme ( ) . foreground ,
24
- } ,
25
- input : {
26
- height : 50 ,
27
- borderColor : getTheme ( ) . border ,
28
- borderWidth : 1 ,
29
- borderRadius : 5 ,
30
- paddingHorizontal : 10 ,
31
- marginBottom : 15 ,
32
- fontSize : 16 ,
33
- color : getTheme ( ) . foreground ,
34
- } ,
35
- textArea : {
36
- height : 100 ,
37
- textAlignVertical : 'top' ,
38
- color : getTheme ( ) . foreground ,
39
- } ,
40
- screenshotButton : {
41
- backgroundColor : getTheme ( ) . background ,
42
- padding : 15 ,
43
- borderRadius : 5 ,
44
- alignItems : 'center' ,
45
- flex : 1 ,
46
- borderWidth : 1 ,
47
- borderColor : getTheme ( ) . border ,
48
- } ,
49
- screenshotContainer : {
50
- flexDirection : 'row' ,
51
- alignItems : 'center' ,
52
- width : '100%' ,
53
- marginBottom : 20 ,
54
- } ,
55
- screenshotThumbnail : {
56
- width : 50 ,
57
- height : 50 ,
58
- borderRadius : 5 ,
59
- marginRight : 10 ,
60
- } ,
61
- screenshotText : {
62
- color : getTheme ( ) . foreground ,
63
- fontSize : 16 ,
64
- } ,
65
- submitButton : {
66
- backgroundColor : getTheme ( ) . accentBackground ,
67
- paddingVertical : 15 ,
68
- borderRadius : 5 ,
69
- alignItems : 'center' ,
70
- marginBottom : 10 ,
71
- } ,
72
- submitText : {
73
- color : getTheme ( ) . accentForeground ,
74
- fontSize : 18 ,
75
- } ,
76
- cancelButton : {
77
- backgroundColor : getTheme ( ) . background ,
78
- padding : 15 ,
79
- borderRadius : 5 ,
80
- alignItems : 'center' ,
81
- borderWidth : 1 ,
82
- borderColor : getTheme ( ) . border ,
83
- } ,
84
- cancelText : {
85
- color : getTheme ( ) . foreground ,
86
- fontSize : 16 ,
87
- } ,
88
- titleContainer : {
89
- flexDirection : 'row' ,
90
- width : '100%' ,
91
- } ,
92
- sentryLogo : {
93
- width : 40 ,
94
- height : 40 ,
95
- tintColor : getTheme ( ) . sentryLogo ,
96
- } ,
6
+ const defaultStyles = ( theme : FeedbackWidgetTheme ) : FeedbackWidgetStyles => {
7
+ return {
8
+ container : {
9
+ flex : 1 ,
10
+ padding : 20 ,
11
+ backgroundColor : theme . background ,
12
+ } ,
13
+ title : {
14
+ fontSize : 24 ,
15
+ fontWeight : 'bold' ,
16
+ marginBottom : 20 ,
17
+ textAlign : 'left' ,
18
+ flex : 1 ,
19
+ color : theme . foreground ,
20
+ } ,
21
+ label : {
22
+ marginBottom : 4 ,
23
+ fontSize : 16 ,
24
+ color : theme . foreground ,
25
+ } ,
26
+ input : {
27
+ height : 50 ,
28
+ borderColor : theme . border ,
29
+ borderWidth : 1 ,
30
+ borderRadius : 5 ,
31
+ paddingHorizontal : 10 ,
32
+ marginBottom : 15 ,
33
+ fontSize : 16 ,
34
+ color : theme . foreground ,
35
+ } ,
36
+ textArea : {
37
+ height : 100 ,
38
+ textAlignVertical : 'top' ,
39
+ color : theme . foreground ,
40
+ } ,
41
+ screenshotButton : {
42
+ backgroundColor : theme . background ,
43
+ padding : 15 ,
44
+ borderRadius : 5 ,
45
+ alignItems : 'center' ,
46
+ flex : 1 ,
47
+ borderWidth : 1 ,
48
+ borderColor : theme . border ,
49
+ } ,
50
+ screenshotContainer : {
51
+ flexDirection : 'row' ,
52
+ alignItems : 'center' ,
53
+ width : '100%' ,
54
+ marginBottom : 20 ,
55
+ } ,
56
+ screenshotThumbnail : {
57
+ width : 50 ,
58
+ height : 50 ,
59
+ borderRadius : 5 ,
60
+ marginRight : 10 ,
61
+ } ,
62
+ screenshotText : {
63
+ color : theme . foreground ,
64
+ fontSize : 16 ,
65
+ } ,
66
+ submitButton : {
67
+ backgroundColor : theme . accentBackground ,
68
+ paddingVertical : 15 ,
69
+ borderRadius : 5 ,
70
+ alignItems : 'center' ,
71
+ marginBottom : 10 ,
72
+ } ,
73
+ submitText : {
74
+ color : theme . accentForeground ,
75
+ fontSize : 18 ,
76
+ } ,
77
+ cancelButton : {
78
+ backgroundColor : theme . background ,
79
+ padding : 15 ,
80
+ borderRadius : 5 ,
81
+ alignItems : 'center' ,
82
+ borderWidth : 1 ,
83
+ borderColor : theme . border ,
84
+ } ,
85
+ cancelText : {
86
+ color : theme . foreground ,
87
+ fontSize : 16 ,
88
+ } ,
89
+ titleContainer : {
90
+ flexDirection : 'row' ,
91
+ width : '100%' ,
92
+ } ,
93
+ sentryLogo : {
94
+ width : 40 ,
95
+ height : 40 ,
96
+ tintColor : theme . sentryLogo ,
97
+ } ,
98
+ } ;
97
99
} ;
98
100
99
- export const defaultButtonStyles : FeedbackButtonStyles = {
100
- triggerButton : {
101
- position : 'absolute' ,
102
- bottom : 30 ,
103
- right : 30 ,
104
- backgroundColor : getTheme ( ) . background ,
105
- padding : 15 ,
106
- borderRadius : 40 ,
107
- justifyContent : 'center' ,
108
- alignItems : 'center' ,
109
- elevation : 5 ,
110
- shadowColor : getTheme ( ) . border ,
111
- shadowOffset : { width : 1 , height : 2 } ,
112
- shadowOpacity : 0.5 ,
113
- shadowRadius : 3 ,
114
- flexDirection : 'row' ,
115
- borderWidth : 1 ,
116
- borderColor : getTheme ( ) . border ,
117
- } ,
118
- triggerText : {
119
- color : getTheme ( ) . foreground ,
120
- fontSize : 18 ,
121
- } ,
122
- triggerIcon : {
123
- width : 24 ,
124
- height : 24 ,
125
- padding : 2 ,
126
- marginEnd : 6 ,
127
- tintColor : getTheme ( ) . sentryLogo ,
128
- } ,
101
+ export const defaultButtonStyles = ( theme : FeedbackWidgetTheme ) : FeedbackButtonStyles => {
102
+ return {
103
+ triggerButton : {
104
+ position : 'absolute' ,
105
+ bottom : 30 ,
106
+ right : 30 ,
107
+ backgroundColor : theme . background ,
108
+ padding : 15 ,
109
+ borderRadius : 40 ,
110
+ justifyContent : 'center' ,
111
+ alignItems : 'center' ,
112
+ elevation : 5 ,
113
+ shadowColor : theme . border ,
114
+ shadowOffset : { width : 1 , height : 2 } ,
115
+ shadowOpacity : 0.5 ,
116
+ shadowRadius : 3 ,
117
+ flexDirection : 'row' ,
118
+ borderWidth : 1 ,
119
+ borderColor : theme . border ,
120
+ } ,
121
+ triggerText : {
122
+ color : theme . foreground ,
123
+ fontSize : 18 ,
124
+ } ,
125
+ triggerIcon : {
126
+ width : 24 ,
127
+ height : 24 ,
128
+ padding : 2 ,
129
+ marginEnd : 6 ,
130
+ tintColor : theme . sentryLogo ,
131
+ } ,
132
+ } ;
129
133
} ;
130
134
131
135
export const modalWrapper : ViewStyle = {
@@ -136,18 +140,20 @@ export const modalWrapper: ViewStyle = {
136
140
bottom : 0 ,
137
141
} ;
138
142
139
- export const modalSheetContainer : ViewStyle = {
140
- backgroundColor : getTheme ( ) . background ,
141
- borderTopLeftRadius : 16 ,
142
- borderTopRightRadius : 16 ,
143
- overflow : 'hidden' ,
144
- alignSelf : 'stretch' ,
145
- shadowColor : '#000' ,
146
- shadowOffset : { width : 0 , height : - 3 } ,
147
- shadowOpacity : 0.1 ,
148
- shadowRadius : 4 ,
149
- elevation : 5 ,
150
- flex : 1 ,
143
+ export const modalSheetContainer = ( theme : FeedbackWidgetTheme ) : ViewStyle => {
144
+ return {
145
+ backgroundColor : theme . background ,
146
+ borderTopLeftRadius : 16 ,
147
+ borderTopRightRadius : 16 ,
148
+ overflow : 'hidden' ,
149
+ alignSelf : 'stretch' ,
150
+ shadowColor : '#000' ,
151
+ shadowOffset : { width : 0 , height : - 3 } ,
152
+ shadowOpacity : 0.1 ,
153
+ shadowRadius : 4 ,
154
+ elevation : 5 ,
155
+ flex : 1 ,
156
+ } ;
151
157
} ;
152
158
153
159
export const topSpacer : ViewStyle = {
0 commit comments