11/* eslint-disable no-console -- debugging*/
2+ import React , { type JSX , useEffect , useRef , useState } from "react" ;
3+ import { KeyboardAvoidingView , Modal , View , StyleSheet } from "react-native" ;
4+ import { WebView , type WebViewMessageEvent } from "react-native-webview" ;
25import { RNConfig } from "@/lib/common/config" ;
36import { Logger } from "@/lib/common/logger" ;
47import { filterSurveys , getLanguageCode , getStyling } from "@/lib/common/utils" ;
58import { SurveyStore } from "@/lib/survey/store" ;
69import { type TUserState , ZJsRNWebViewOnMessageData } from "@/types/config" ;
710import type { TSurvey , SurveyContainerProps } from "@/types/survey" ;
8- import React , { type JSX , useEffect , useRef , useState } from "react" ;
9- import { KeyboardAvoidingView , Modal , View , StyleSheet } from "react-native" ;
10- import { WebView , type WebViewMessageEvent } from "react-native-webview" ;
1111
1212const logger = Logger . getInstance ( ) ;
1313logger . configure ( { logLevel : "debug" } ) ;
@@ -21,15 +21,15 @@ interface SurveyWebViewProps {
2121
2222export function SurveyWebView (
2323 props : SurveyWebViewProps
24- ) : JSX . Element | undefined {
24+ ) : JSX . Element | null {
2525 const webViewRef = useRef ( null ) ;
2626 const [ isSurveyRunning , setIsSurveyRunning ] = useState ( false ) ;
2727 const [ showSurvey , setShowSurvey ] = useState ( false ) ;
2828 const [ appConfig , setAppConfig ] = useState < RNConfig | null > ( null ) ;
2929 const [ languageCode , setLanguageCode ] = useState ( "default" ) ;
3030
3131 useEffect ( ( ) => {
32- const fetchConfig = async ( ) => {
32+ const fetchConfig = async ( ) : Promise < void > => {
3333 const config = await RNConfig . getInstance ( ) ;
3434 setAppConfig ( config ) ;
3535 } ;
@@ -87,7 +87,7 @@ export function SurveyWebView(
8787 } , [ props . survey . delay , isSurveyRunning , props . survey . name ] ) ;
8888
8989 if ( ! appConfig ) {
90- return ;
90+ return null ;
9191 }
9292
9393 const project = appConfig . get ( ) . environment . data . project ;
0 commit comments