@@ -3,26 +3,15 @@ import { RNConfig } from "@/lib/common/config";
33import { Logger } from "@/lib/common/logger" ;
44import { filterSurveys , getLanguageCode , getStyling } from "@/lib/common/utils" ;
55import { SurveyStore } from "@/lib/survey/store" ;
6- import type { TOverlay } from "@/types/common" ;
76import { type TUserState , ZJsRNWebViewOnMessageData } from "@/types/config" ;
87import type { TSurvey , SurveyContainerProps } from "@/types/survey" ;
9- import React , { type JSX , useEffect , useMemo , useRef , useState } from "react" ;
8+ import React , { type JSX , useEffect , useRef , useState } from "react" ;
109import { KeyboardAvoidingView , Modal , View , StyleSheet } from "react-native" ;
1110import { WebView , type WebViewMessageEvent } from "react-native-webview" ;
1211
1312const logger = Logger . getInstance ( ) ;
1413logger . configure ( { logLevel : "debug" } ) ;
1514
16- const getOverlayBackgroundColor = ( overlay : TOverlay ) : string => {
17- switch ( overlay ) {
18- case "dark" :
19- return "rgba(51, 65, 85, 0.8)" ;
20- case "light" :
21- return "rgba(148, 163, 184, 0.5)" ;
22- case "none" :
23- return "transparent" ;
24- }
25- } ;
2615
2716const surveyStore = SurveyStore . getInstance ( ) ;
2817
@@ -97,15 +86,6 @@ export function SurveyWebView(
9786 setShowSurvey ( true ) ;
9887 } , [ props . survey . delay , isSurveyRunning , props . survey . name ] ) ;
9988
100- const overlay = appConfig
101- ? ( props . survey . projectOverwrites ?. overlay ?? appConfig . get ( ) . environment . data . project . overlay )
102- : "none" ;
103-
104- const modalContainerStyle = useMemo (
105- ( ) => [ styles . modalContainer , { backgroundColor : getOverlayBackgroundColor ( overlay ) } ] ,
106- [ overlay ]
107- ) ;
108-
10989 if ( ! appConfig ) {
11090 return ;
11191 }
@@ -135,6 +115,8 @@ export function SurveyWebView(
135115 const clickOutside =
136116 props . survey . projectOverwrites ?. clickOutsideClose ??
137117 project . clickOutsideClose ;
118+ const overlay =
119+ props . survey . projectOverwrites ?. overlay ?? project . overlay ;
138120
139121 return (
140122 < Modal
@@ -146,7 +128,7 @@ export function SurveyWebView(
146128 setIsSurveyRunning ( false ) ;
147129 } }
148130 >
149- < View style = { modalContainerStyle } >
131+ < View style = { styles . modalContainer } >
150132 < KeyboardAvoidingView
151133 behavior = "padding"
152134 style = { styles . keyboardAvoidingView }
0 commit comments