File tree Expand file tree Collapse file tree 1 file changed +18
-17
lines changed
examples/default/src/screens Expand file tree Collapse file tree 1 file changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,22 @@ export const SurveysScreen: React.FC = () => {
35
35
alignItems : 'stretch' ,
36
36
} ,
37
37
} ) ;
38
+
39
+ const checkIfUserHasResponded = async ( ) => {
40
+ if ( validateUserAttributeForm ( ) ) {
41
+ const hasResponded = await Surveys . hasRespondedToSurvey ( surveyToken ) ;
42
+ toast . show ( {
43
+ description : hasResponded ? 'YES' : 'NO' ,
44
+ } ) ;
45
+ }
46
+ } ;
47
+
48
+ const showSurveyWithToken = ( ) => {
49
+ if ( validateUserAttributeForm ( ) ) {
50
+ Surveys . showSurvey ( surveyToken ) ;
51
+ }
52
+ } ;
53
+
38
54
return (
39
55
< Screen >
40
56
< ListTile
@@ -61,26 +77,11 @@ export const SurveysScreen: React.FC = () => {
61
77
</ View >
62
78
</ View >
63
79
64
- < Button
65
- mt = "4"
66
- onPress = { ( ) => {
67
- if ( validateUserAttributeForm ( ) ) {
68
- Surveys . showSurvey ( surveyToken ) ;
69
- }
70
- } } >
80
+ < Button mt = "4" onPress = { showSurveyWithToken } >
71
81
Show survey
72
82
</ Button >
73
83
74
- < Button
75
- mt = "4"
76
- onPress = { async ( ) => {
77
- if ( validateUserAttributeForm ( ) ) {
78
- const hasResponded = await Surveys . hasRespondedToSurvey ( surveyToken ) ;
79
- toast . show ( {
80
- description : hasResponded ? 'YES' : 'NO' ,
81
- } ) ;
82
- }
83
- } } >
84
+ < Button mt = "4" onPress = { checkIfUserHasResponded } >
84
85
If User has responded survey
85
86
</ Button >
86
87
</ VStack >
You can’t perform that action at this time.
0 commit comments