react-native-bootpay-api 13.8.43 → 13.13.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/Bootpay.tsx CHANGED
@@ -1,482 +1,338 @@
1
-
2
-
3
1
  import React, { Component } from 'react';
4
- import { SafeAreaView, Modal, TouchableOpacity, Image, StyleSheet, Platform } from 'react-native';
5
- // import { StyleSheet, Platform } from 'react-native';
6
- // import { Platform, StyleSheet, Dimensions } from 'react-native';
7
- import WebView, {WebViewMessageEvent} from 'react-native-webview-bootpay';
8
- import { BootpayTypesProps, Payload, Extra, Item, User } from './BootpayTypes';
9
- import {debounce} from 'lodash';
10
- import UserInfo from './UserInfo'
11
- import { WebViewErrorEvent } from 'react-native-webview-bootpay/lib/BPCWebViewNativeComponent';
12
- // import Loader from './Loader'
13
- // import ClipLoader from "react-spinners/ClipLoader";
14
- // import Spinner from 'react-native-loading-spinner-overlay';
15
-
2
+ import {
3
+ SafeAreaView,
4
+ Modal,
5
+ TouchableOpacity,
6
+ Image,
7
+ StyleSheet,
8
+ Platform,
9
+ } from 'react-native';
10
+ import WebView, { WebViewMessageEvent } from 'react-native-webview-bootpay';
11
+ import { BootpayTypesProps, Payload, Item, User, Extra } from './BootpayTypes';
12
+ import { debounce } from 'lodash';
13
+ import UserInfo from './UserInfo';
14
+
15
+ const SDK_VERSION = '13.13.4';
16
+ const DEBUG_MODE = false;
16
17
 
17
18
  export class Bootpay extends Component<BootpayTypesProps> {
18
- // webView = useRef<WebView>(null);
19
-
20
- webView: React.RefObject<WebView>;
21
-
22
- constructor(props: BootpayTypesProps) {
23
- super(props);
24
-
25
- this.webView = React.createRef();
26
- }
27
-
28
- payload?: Payload
29
-
30
- state = {
31
- visibility: false,
32
- script: '',
33
- firstLoad: false,
34
- showCloseButton: false,
35
- isShowProgress: false
36
- }
37
- // _payload = {}
38
- _VERSION = "13.8.2"
39
- _DEBUG = false;
40
-
41
-
42
- dismiss = () => {
43
- this.setState(
44
- {
45
- visibility: false
46
- }
47
- )
48
- }
49
-
50
-
51
- showProgressBar = (isShow: boolean) => {
52
- this.setState(
53
- {
54
- isShowProgress: isShow
55
- }
56
- )
57
- }
58
-
59
-
60
- closeDismiss = () => {
61
- if(this.props.onClose != undefined) this.props.onClose();
62
- this.dismiss();
63
- }
64
-
65
-
66
-
67
- onMessage = async (event: WebViewMessageEvent) => {
68
-
69
- if (event == undefined) return;
70
- console.log(event.nativeEvent.data);
71
-
72
- const res = JSON.parse(JSON.stringify(event.nativeEvent.data));
73
-
74
- console.log(res);
75
-
76
-
77
- if(res == 'close') {
78
- this.showProgressBar(false);
79
- this.closeDismiss();
80
- return;
81
- }
82
-
83
-
84
- const data = JSON.parse(res);
85
- // console.log(`redirect: ${JSON.stringify(data)}`);
86
-
87
- var redirect = false
88
- let show_success = false
89
- let show_error = false
90
-
91
-
92
- if(this.payload?.extra != undefined) {
93
- if(this.payload.extra?.open_type == 'redirect') {
94
- redirect = true;
95
- }
96
- if(this.payload.extra?.display_error_result == true) {
97
- show_error = true;
98
- }
99
- if(this.payload.extra?.display_success_result == true) {
100
- show_success = true;
101
- }
102
-
103
- }
104
-
105
- if(redirect === true) {
106
- switch (data.event) {
107
- case 'cancel':
108
- this.showProgressBar(false);
109
- if(this.props.onCancel != undefined) this.props.onCancel(data);
110
- this.closeDismiss();
111
- break;
112
- case 'error':
113
- this.showProgressBar(false);
114
- if(this.props.onError != undefined) this.props.onError(data);
115
- if(show_error == false) {
116
- this.closeDismiss();
117
- }
118
- break;
119
- case 'issued':
120
- this.showProgressBar(false);
121
- if(this.props.onIssued != undefined) this.props.onIssued(data);
122
- if(show_success == false) {
123
- this.closeDismiss();
124
- }
125
- break;
126
- case 'confirm':
127
- this.showProgressBar(true);
128
- // if(this.props.onConfirm != undefined) this.props.onConfirm(data);
129
- if(this.props.onConfirm != undefined) {
130
- if(this.props.onConfirm(data)) {
131
- this.transactionConfirm();
132
- }
133
- }
134
- break;
135
- case 'done':
136
- this.showProgressBar(false);
137
- if(this.props.onDone != undefined) this.props.onDone(data);
138
- if(show_success == false) {
139
- this.closeDismiss();
140
- }
141
- break;
142
- case 'close':
143
- this.showProgressBar(false);
144
- this.closeDismiss();
145
- break;
146
- }
147
- } else {
148
- switch (data.event) {
149
- case 'cancel':
150
- this.showProgressBar(false);
151
- if(this.props.onCancel != undefined) this.props.onCancel(data);
152
- break;
153
- case 'error':
154
- this.showProgressBar(false);
155
- if(this.props.onError != undefined) this.props.onError(data);
156
- break;
157
- case 'issued':
158
- this.showProgressBar(false);
159
- if(this.props.onIssued != undefined) this.props.onIssued(data);
160
- break;
161
- case 'confirm':
162
- this.showProgressBar(true);
163
- if(this.props.onConfirm != undefined) {
164
- if(this.props.onConfirm(data)) {
165
- this.transactionConfirm();
166
- }
167
- }
168
- break;
169
- case 'done':
170
- this.showProgressBar(false);
171
- if(this.props.onDone != undefined) this.props.onDone(data);
172
- break;
173
- case 'close':
174
- this.showProgressBar(false);
175
- this.closeDismiss();
176
- break;
177
- }
178
- }
179
- }
180
-
181
- onShouldStartLoadWithRequest = (_ : string) => {
182
- return true;
183
- }
184
-
185
- getSDKVersion = () => {
186
- if(Platform.OS == 'ios') {
187
- return "Bootpay.setVersion('" + this._VERSION + "', 'ios_react_native')"
188
- // return "Bootpay.setDevice('IOS');";
189
- } else if(Platform.OS == 'android'){
190
- return "Bootpay.setVersion('" + this._VERSION + "', 'android_react_native')"
191
- // return "Bootpay.setDevice('ANDROID');";
192
- } else {
193
- return ""
194
- }
195
- }
196
-
197
- getEnvironmentMode = () => {
198
- if(this._DEBUG) {
199
- return "Bootpay.setEnvironmentMode('development');";
200
-
201
- }
202
- return "";
203
- }
204
-
205
- getBootpayPlatform = () => {
206
- if(Platform.OS == 'ios') {
207
- return "Bootpay.setDevice('IOS');";
208
- } else if(Platform.OS == 'android'){
209
- return "Bootpay.setDevice('ANDROID');";
210
- } else {
211
- return ""
212
- }
213
- }
214
-
215
- // setPayScript = () => {
216
- // const fullScript = this.generateScript(this.state.script);
217
- // this.injectJavaScript(fullScript);
218
- // if(this.state.showCloseButton == true) {
219
- // if(this.webView == null || this.webView == undefined) return;
220
- // this.webView.showCloseButton( );
221
- // }
222
- // }
223
-
224
- transactionConfirm = () => {
225
- const script = "Bootpay.confirm()"
226
- +
227
- ".then( function (res) {" +
228
- this.confirm() +
229
- this.issued() +
230
- this.done() +
231
- "}, function (res) {" +
232
- this.error() +
233
- this.cancel() +
234
- "})";
235
-
236
- this.callJavaScript(script);
237
- }
238
-
239
- removePaymentWindow = () => {
240
- this.dismiss();
241
- // this.callJavaScript(`
242
- // Bootpay.removePaymentWindow();
243
- // `);
244
- }
245
-
246
- callJavaScript = (script: string) => {
247
- if(this.webView == null || this.webView == undefined) return
248
-
249
- this.webView.current?.injectJavaScript(`
250
- setTimeout(function() { ${script} }, 30);
251
- `)
252
- }
253
-
254
- getAnalyticsData = async () => {
255
- const uuid = await UserInfo.getBootpayUUID();
256
- // const bootpaySK = await UserInfo.getBootpaySK();
257
- const bootLastTime = await UserInfo.getBootpayLastTime();
258
-
259
-
260
- const elaspedTime = Date.now() - bootLastTime;
261
- return `window.Bootpay.$analytics.setAnalyticsData({uuid:'${uuid}', time:${elaspedTime}});`;
262
- // this.callJavaScript(`window.BootPay.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',sk_time:${bootLastTime},time:${elaspedTime}});`);
263
- }
264
-
265
- confirm = () => {
266
- return "if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
267
- }
268
-
269
- done = () => {
270
- return "else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
271
- }
272
-
273
- issued = () => {
274
- return "else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
275
- }
276
-
277
- error = () => {
278
- return "if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
279
- }
280
-
281
- cancel = () => {
282
- return "else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
283
- }
284
-
285
- close = () => {
286
- return "document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";
287
- }
288
-
289
-
290
-
291
- async componentWillUnmount() {
292
- this.setState(
293
- {
294
- visibility: false,
295
- firstLoad: false,
296
- showCloseButton: false
297
- }
298
- )
299
- UserInfo.setBootpayLastTime(Date.now());
300
- }
301
-
302
-
303
- componentDidMount() {
304
- this.closeDismiss = debounce(this.closeDismiss, 30);
305
- }
306
-
307
- render() {
308
- return (
309
- <Modal
310
- animationType={'slide'}
311
- transparent={false}
312
- onRequestClose={()=> {
313
- this.closeDismiss();
314
- // console.log(1234);
315
- // this.dismiss();
316
- }}
317
-
318
- visible={this.state.visibility}>
319
- <SafeAreaView style={{ flex: 1 }}>
320
- {
321
- this.state.showCloseButton &&
322
- <TouchableOpacity
323
- onPress={() => {
324
- var cancelData = {
325
- action: 'BootpayCancel',
326
- message: '사용자에 의해 취소되었습니다'
327
- }
328
-
329
- if(this.props.onCancel != undefined) this.props.onCancel(cancelData);
330
- if(this.props.onClose != undefined) this.props.onClose();
331
-
332
- this.setState({visibility: false})
333
-
334
- // this.showProgressBar(true);
335
-
336
- } }>
337
- <Image
338
- style={[styles.overlay]}
339
- source={require('../images/close.png')} />
340
- </TouchableOpacity>
341
- }
342
-
343
- <WebView
344
- ref={this.webView}
345
- originWhitelist={['*']}
346
- source={{
347
- uri: 'https://webview.bootpay.co.kr/5.0.0-beta.25'
348
- }}
349
- injectedJavaScript={this.state.script}
350
- javaScriptEnabled={true}
351
- javaScriptCanOpenWindowsAutomatically={true}
352
- // scalesPageToFit={true}
353
- onMessage={this.onMessage}
354
- onError={(syntheticEvent) => {
355
- const { nativeEvent } = syntheticEvent;
356
- if(nativeEvent.code == 3) {
357
- this.showProgressBar(false);
358
- if(this.props.onError != undefined) this.props.onError({
359
- code: nativeEvent.code,
360
- message: nativeEvent.description
361
- });
362
- this.closeDismiss();
363
- }
364
- }}
365
- // onError={ error => {
366
- // if(error.code == 3) {
367
- // console.log()
368
- // }
369
- // }}
370
- // onError={syntheticEvent => {
371
- // const { nativeEvent } = syntheticEvent;
372
- // console.warn('WebView error: ', nativeEvent);
373
- // }}
374
- // onError={}
375
- />
376
- </SafeAreaView>
377
-
378
-
379
- </Modal>
380
- )
381
- }
382
-
383
- // onMessage = async (event: WebViewMessageEvent) => {
384
-
385
-
386
-
387
-
388
- requestPayment = async (payload: Payload, items: [Item], user: User, extra: Extra) => {
389
-
390
- this.bootpayRequest(payload, items, user, extra, "requestPayment");
391
- }
392
-
393
- requestSubscription = async (payload: Payload, items: [Item], user: User, extra: Extra) => {
394
- this.bootpayRequest(payload, items, user, extra, "requestSubscription");
395
- }
396
-
397
- requestAuthentication = async (payload: Payload, items: [Item], user: User, extra: Extra) => {
398
- this.bootpayRequest(payload, items, user, extra, "requestAuthentication");
399
- }
400
-
401
- bootpayRequest = async (payload: Payload, items: [Item], user: User, extra: Extra, requestMethod: string) => {
402
-
403
- payload.application_id = Platform.OS == 'ios' ? this.props.ios_application_id : this.props.android_application_id;
404
- payload.items = items;
405
- payload.user = user;
406
-
407
-
408
- payload.user = Object.assign(new User(), user); //set default value from class optional parameter value
409
- payload.extra = Object.assign(new Extra(), extra); //set default value from class optional parameter value
410
-
411
-
412
- this.payload = payload
413
-
414
- this.setState(
415
- {
416
- visibility: true,
417
- script: `
418
- ${await this.getMountJavascript()}
419
- ${this.generateScript(payload, requestMethod)}
420
- `,
421
- firstLoad: false,
422
- showCloseButton: extra.show_close_button || false,
423
- spinner: false
424
- }
425
- )
426
-
427
-
428
- UserInfo.updateInfo();
429
- }
430
-
431
-
432
- getMountJavascript = async () => {
433
- return `
19
+ getMountJavascript = async () => {
20
+ return `
434
21
  ${this.getSDKVersion()}
435
22
  ${this.getEnvironmentMode()}
436
23
  ${this.getBootpayPlatform()}
437
24
  ${this.close()}
438
25
  ${await this.getAnalyticsData()}
439
- `;
26
+ `;
27
+ };
28
+
29
+ webView: React.RefObject<WebView>;
30
+ payload?: Payload;
31
+
32
+ constructor(props: BootpayTypesProps) {
33
+ super(props);
34
+ this.webView = React.createRef();
35
+ }
36
+
37
+ state = {
38
+ visibility: false,
39
+ script: '',
40
+ firstLoad: false,
41
+ showCloseButton: false,
42
+ isShowProgress: false,
43
+ };
44
+
45
+ dismiss = () => {
46
+ this.setState({ visibility: false });
47
+ };
48
+
49
+ showProgressBar = (isShow: boolean) => {
50
+ this.setState({ isShowProgress: isShow });
51
+ };
52
+
53
+ closeDismiss = () => {
54
+ if (this.props.onClose) this.props.onClose();
55
+ this.dismiss();
56
+ };
57
+
58
+ callJavaScript = (script: string) => {
59
+ this.webView.current?.injectJavaScript(
60
+ `setTimeout(function() { ${script} }, 30);`
61
+ );
62
+ };
63
+
64
+ transactionConfirm = () => {
65
+ const script = `
66
+ Bootpay.confirm()
67
+ .then(res => {
68
+ ${this.confirm()}
69
+ ${this.issued()}
70
+ ${this.done()}
71
+ }, res => {
72
+ ${this.error()}
73
+ ${this.cancel()}
74
+ });
75
+ `;
76
+ this.callJavaScript(script);
77
+ };
78
+
79
+ confirm = () => {
80
+ return "if (res.event === 'confirm') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
81
+ };
82
+
83
+ done = () => {
84
+ return "else if (res.event === 'done') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
85
+ };
86
+
87
+ issued = () => {
88
+ return "else if (res.event === 'issued') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
89
+ };
90
+
91
+ error = () => {
92
+ return "if (res.event === 'error') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
93
+ };
94
+
95
+ cancel = () => {
96
+ return "else if (res.event === 'cancel') { window.BootpayRNWebView.postMessage( JSON.stringify(res) ); }";
97
+ };
98
+
99
+ close = () => {
100
+ return "document.addEventListener('bootpayclose', function (e) { window.BootpayRNWebView.postMessage('close'); });";
101
+ };
102
+
103
+ onMessage = async (event: WebViewMessageEvent) => {
104
+ if (!event) return;
105
+
106
+ try {
107
+ const res = JSON.parse(event.nativeEvent.data);
108
+ // console.log(res);
109
+
110
+ if (res === 'close') {
111
+ this.showProgressBar(false);
112
+ this.closeDismiss();
113
+ return;
114
+ }
115
+
116
+ const data = typeof res === 'string' ? JSON.parse(res) : res;
117
+
118
+ // let redirect = false;
119
+ let show_success = false;
120
+ let show_error = false;
121
+
122
+ if (this.payload?.extra) {
123
+ // redirect = this.payload.extra?.open_type === 'redirect';
124
+ show_error = !!this.payload.extra?.display_error_result;
125
+ show_success = !!this.payload.extra?.display_success_result;
126
+ }
127
+
128
+ const handleEvent = (_eventName, callback, showResult) => {
129
+ this.showProgressBar(false);
130
+ if (callback) callback(data);
131
+ if (!showResult) this.closeDismiss();
132
+ };
133
+
134
+ switch (data.event) {
135
+ case 'cancel':
136
+ handleEvent('cancel', this.props.onCancel, false);
137
+ break;
138
+ case 'error':
139
+ handleEvent('error', this.props.onError, show_error);
140
+ break;
141
+ case 'issued':
142
+ handleEvent('issued', this.props.onIssued, show_success);
143
+ break;
144
+ case 'confirm':
145
+ this.showProgressBar(true);
146
+ if (this.props.onConfirm && this.props.onConfirm(data)) {
147
+ this.transactionConfirm();
148
+ }
149
+ break;
150
+ case 'done':
151
+ handleEvent('done', this.props.onDone, show_success);
152
+ break;
153
+ case 'close':
154
+ this.showProgressBar(false);
155
+ this.closeDismiss();
156
+ break;
157
+ default:
158
+ console.warn(`Unknown event type: ${data.event}`);
159
+ break;
160
+ }
161
+ } catch (error) {
162
+ console.error('Error processing message:', error);
440
163
  }
441
-
442
-
443
- generateScript= (payload: Payload, requestMethod: string) => {
444
- const script = "Bootpay." + requestMethod +
445
- `(${JSON.stringify(payload)})` +
446
- ".then( function (res) {" +
447
- this.confirm() +
448
- this.issued() +
449
- this.done() +
450
- "}, function (res) {" +
451
- this.error() +
452
- this.cancel() +
453
- "}); void(0);";
454
-
455
- return script;
456
- }
457
-
164
+ };
165
+
166
+ generateScript = (payload: Payload, requestMethod: string) => {
167
+ return `
168
+ Bootpay.${requestMethod}(${JSON.stringify(payload)})
169
+ .then(res => {
170
+ ${this.confirm()}
171
+ ${this.issued()}
172
+ ${this.done()}
173
+ }, res => {
174
+ ${this.error()}
175
+ ${this.cancel()}
176
+ });
177
+ `;
178
+ };
179
+
180
+ getSDKVersion = () => {
181
+ const os = Platform.OS;
182
+ return `Bootpay.setVersion('${SDK_VERSION}', '${os}_react_native')`;
183
+ };
184
+
185
+ getEnvironmentMode = () => {
186
+ return DEBUG_MODE ? "Bootpay.setEnvironmentMode('development');" : '';
187
+ };
188
+
189
+ getBootpayPlatform = () => {
190
+ return Platform.OS === 'ios'
191
+ ? "Bootpay.setDevice('IOS');"
192
+ : "Bootpay.setDevice('ANDROID');";
193
+ };
194
+
195
+ async componentWillUnmount() {
196
+ this.setState({
197
+ visibility: false,
198
+ firstLoad: false,
199
+ showCloseButton: false,
200
+ });
201
+ UserInfo.setBootpayLastTime(Date.now());
202
+ }
203
+
204
+ componentDidMount() {
205
+ this.closeDismiss = debounce(this.closeDismiss, 30);
206
+ }
207
+
208
+ removePaymentWindow = () => {
209
+ this.dismiss();
210
+ // this.callJavaScript(`
211
+ // Bootpay.removePaymentWindow();
212
+ // `);
213
+ };
214
+
215
+ getAnalyticsData = async () => {
216
+ const uuid = await UserInfo.getBootpayUUID();
217
+ const bootpaySK = await UserInfo.getBootpaySK();
218
+ const bootLastTime = await UserInfo.getBootpayLastTime();
219
+
220
+ const elaspedTime = Date.now() - bootLastTime;
221
+
222
+ console.log(uuid, bootpaySK, bootLastTime);
223
+
224
+ return `window.Bootpay.$analytics.setAnalyticsData({uuid:'${uuid}',sk:'${bootpaySK}',time:${elaspedTime}});`;
225
+ };
226
+
227
+ requestPayment = async (
228
+ payload: Payload,
229
+ items: [Item],
230
+ user: User,
231
+ extra: Extra
232
+ ) => {
233
+ this.bootpayRequest(payload, items, user, extra, 'requestPayment');
234
+ };
235
+
236
+ requestSubscription = async (
237
+ payload: Payload,
238
+ items: [Item],
239
+ user: User,
240
+ extra: Extra
241
+ ) => {
242
+ this.bootpayRequest(payload, items, user, extra, 'requestSubscription');
243
+ };
244
+
245
+ requestAuthentication = async (
246
+ payload: Payload,
247
+ items: [Item],
248
+ user: User,
249
+ extra: Extra
250
+ ) => {
251
+ this.bootpayRequest(payload, items, user, extra, 'requestAuthentication');
252
+ };
253
+
254
+ bootpayRequest = async (
255
+ payload: Payload,
256
+ items: [Item],
257
+ user: User,
258
+ extra: Extra,
259
+ requestMethod: string
260
+ ) => {
261
+ payload.application_id =
262
+ Platform.OS === 'ios'
263
+ ? this.props.ios_application_id
264
+ : this.props.android_application_id;
265
+ payload.items = items;
266
+ payload.user = user;
267
+
268
+ payload.user = Object.assign(new User(), user); //set default value from class optional parameter value
269
+ payload.extra = Object.assign(new Extra(), extra); //set default value from class optional parameter value
270
+
271
+ this.payload = payload;
272
+
273
+ this.setState({
274
+ visibility: true,
275
+ script: `
276
+ ${await this.getMountJavascript()}
277
+ ${this.generateScript(payload, requestMethod)}
278
+ `,
279
+ firstLoad: false,
280
+ showCloseButton: extra.show_close_button || false,
281
+ spinner: false,
282
+ });
283
+
284
+ UserInfo.updateInfo();
285
+ };
286
+
287
+ render() {
288
+ return (
289
+ <Modal
290
+ animationType="slide"
291
+ transparent={false}
292
+ visible={this.state.visibility}
293
+ onRequestClose={this.closeDismiss}
294
+ >
295
+ <SafeAreaView style={{ flex: 1 }}>
296
+ {this.state.showCloseButton && (
297
+ <TouchableOpacity onPress={this.closeDismiss}>
298
+ <Image
299
+ style={styles.overlay}
300
+ source={require('../images/close.png')}
301
+ />
302
+ </TouchableOpacity>
303
+ )}
304
+ <WebView
305
+ ref={this.webView}
306
+ originWhitelist={['*']}
307
+ source={{ uri: 'https://webview.bootpay.co.kr/5.1.0' }}
308
+ injectedJavaScript={this.state.script}
309
+ javaScriptEnabled
310
+ javaScriptCanOpenWindowsAutomatically
311
+ onMessage={this.onMessage}
312
+ onError={(syntheticEvent) => {
313
+ const { nativeEvent } = syntheticEvent;
314
+ if (nativeEvent.code === 3) {
315
+ this.showProgressBar(false);
316
+ if (this.props.onError)
317
+ this.props.onError({
318
+ code: nativeEvent.code,
319
+ message: nativeEvent.description,
320
+ });
321
+ this.closeDismiss();
322
+ }
323
+ }}
324
+ />
325
+ </SafeAreaView>
326
+ </Modal>
327
+ );
328
+ }
458
329
  }
459
330
 
460
-
461
- var styles = StyleSheet.create({
462
- container: {
463
- flex: 1,
464
- justifyContent: 'center',
465
- alignItems: 'center',
466
- backgroundColor: '#F5FCFF',
467
- },
468
- welcome: {
469
- fontSize: 20,
470
- textAlign: 'center',
471
- margin: 10,
472
- },
473
- // Flex to fill, position absolute,
474
- // Fixed left/top, and the width set to the window width
475
- overlay: {
476
- width: 25,
477
- height: 25,
478
- right: 5,
479
- alignSelf: 'flex-end'
480
- }
331
+ const styles = StyleSheet.create({
332
+ overlay: {
333
+ width: 25,
334
+ height: 25,
335
+ right: 5,
336
+ alignSelf: 'flex-end',
337
+ },
481
338
  });
482
-