import * as React from 'react'; import { SafeAreaView } from 'react-native'; import { connect } from "react-redux"; import { WebView } from 'react-native-webview'; import { Container } from 'native-base'; import Elements from '../../components/elements' import Theme from '../../components/theme.style.js'; class VerificationWebview extends React.Component { constructor(props) { super(props) } state = { loading: false, verificationUrl: this.props.route.params?.verificationUrl, referenceNumber: this.props.route.params?.referenceNumber } componentDidMount() { } componentWillUnmount() { } onStateChange = (webViewState) => { let url = webViewState.url if(url.includes('www.paymaya.com') && !webViewState.loading) { this.props.route.params?.onSuccessAuthentication(this.state.referenceNumber) setTimeout(() => { this.props.navigation.goBack() }, 500); } } render() { return ( this.onStateChange(webViewState)} /> ) } } const mapStateToProps = (state) => { return { userinfo: state.appUserInfoReducer.userinfo, app_theme: state.appThemeReducer.theme } } export default connect(mapStateToProps, null)(VerificationWebview)