-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWebsiteDefaultUPIScreen.tsx
41 lines (39 loc) · 1.39 KB
/
WebsiteDefaultUPIScreen.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import React from 'react';
import { Linking } from 'react-native';
import { WebView } from 'react-native-webview';
const WebsiteDefaultUpiPaymentScreen: React.FC = ({ }) => {
const checkIsUPIIntentLink = (link: string)=>{
// eslint-disable-next-line eqeqeq
if(link != undefined &&
(link.startsWith('upi://pay')
|| link.startsWith('tez://')|| link.startsWith('gpay://')
|| link.startsWith('paytmmp://')
|| link.startsWith('phonepe://'))
){
return true;
}
return false;
};
return (
<WebView
source={{ uri: 'https://internal.prodint.cashfree.com/checkout?pt=session_gtWonxb3Ar1da2aDwulXbrQu6PVufNjZ6GASzzFWdut_f466GAe9M8ELVHuuqMrvyC8pCtoMzCvF2N8JsmaqYzGmoZBV3wsPBtBQr6ONLFgXcY39mVBAzecpayment' }}
style={{ flex: 1 }}
onShouldStartLoadWithRequest={event => {
console.log('Current URL Loading', event.url);
if(checkIsUPIIntentLink(event.url)) {
Linking.canOpenURL(event.url).then(supported => {
if (supported) {
console.log('able to open');
Linking.openURL(event.url);
}else{
console.log('Not able to open');
}
});
return false;
}
return true;
}}
/>
);
};
export default WebsiteDefaultUpiPaymentScreen;