ordering-ui-react-native 0.12.38 → 0.12.42

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.
Files changed (46) hide show
  1. package/package.json +1 -1
  2. package/src/components/AddressForm/index.tsx +5 -5
  3. package/src/components/FacebookLogin/index.tsx +2 -2
  4. package/src/components/LoginForm/index.tsx +1 -1
  5. package/src/components/PaymentOptions/index.tsx +5 -5
  6. package/src/components/SignupForm/index.tsx +2 -2
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +3 -3
  8. package/themes/business/src/components/LoginForm/index.tsx +1 -1
  9. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +2 -2
  10. package/themes/business/src/components/SearchBar/index.tsx +1 -1
  11. package/themes/business/src/components/SignupForm/index.tsx +2 -2
  12. package/themes/doordash/src/components/AddressForm/index.tsx +5 -5
  13. package/themes/doordash/src/components/FacebookLogin/index.tsx +2 -2
  14. package/themes/doordash/src/components/LoginForm/index.tsx +1 -1
  15. package/themes/doordash/src/components/PaymentOptions/index.tsx +5 -5
  16. package/themes/doordash/src/components/SignupForm/index.tsx +2 -2
  17. package/themes/franchises/src/components/AddressForm/index.tsx +5 -5
  18. package/themes/franchises/src/components/FacebookLogin/index.tsx +2 -2
  19. package/themes/franchises/src/components/LoginForm/index.tsx +1 -1
  20. package/themes/franchises/src/components/PaymentOptions/index.tsx +3 -3
  21. package/themes/franchises/src/components/SignupForm/index.tsx +2 -2
  22. package/themes/instacart/src/components/AddressForm/index.tsx +5 -5
  23. package/themes/instacart/src/components/FacebookLogin/index.tsx +2 -2
  24. package/themes/instacart/src/components/LoginForm/index.tsx +1 -1
  25. package/themes/instacart/src/components/PaymentOptions/index.tsx +4 -4
  26. package/themes/instacart/src/components/SignupForm/index.tsx +2 -2
  27. package/themes/original/src/components/AddressForm/index.tsx +5 -5
  28. package/themes/original/src/components/FacebookLogin/index.tsx +2 -2
  29. package/themes/original/src/components/LoginForm/index.tsx +1 -1
  30. package/themes/original/src/components/PaymentOptions/index.tsx +5 -5
  31. package/themes/original/src/components/SignupForm/index.tsx +2 -2
  32. package/themes/single-business/src/components/AddressForm/index.tsx +5 -5
  33. package/themes/single-business/src/components/AppleLogin/index.tsx +2 -2
  34. package/themes/single-business/src/components/FacebookLogin/index.tsx +2 -2
  35. package/themes/single-business/src/components/GoogleLogin/index.tsx +2 -2
  36. package/themes/single-business/src/components/LoginForm/index.tsx +1 -1
  37. package/themes/single-business/src/components/PaymentOptions/index.tsx +4 -4
  38. package/themes/single-business/src/components/ProductForm/index.tsx +7 -6
  39. package/themes/single-business/src/components/ProductForm/styles.tsx +6 -0
  40. package/themes/single-business/src/components/SignupForm/index.tsx +2 -2
  41. package/themes/single-business/src/components/UserProfileForm/index.tsx +3 -2
  42. package/themes/uber-eats/src/components/AddressForm/index.tsx +5 -5
  43. package/themes/uber-eats/src/components/FacebookLogin/index.tsx +2 -2
  44. package/themes/uber-eats/src/components/LoginForm/index.tsx +1 -1
  45. package/themes/uber-eats/src/components/PaymentOptions/index.tsx +5 -5
  46. package/themes/uber-eats/src/components/SignupForm/index.tsx +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.38",
3
+ "version": "0.12.42",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -513,7 +513,7 @@ const AddressFormUI = (props: AddressFormParams) => {
513
513
  }
514
514
  setIsFirstTime(false)
515
515
  },
516
- onSubmitEditing: () => internalNumberRef.current.focus(),
516
+ onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
517
517
  autoCorrect: false,
518
518
  blurOnSubmit: false,
519
519
  returnKeyType: 'next'
@@ -573,7 +573,7 @@ const AddressFormUI = (props: AddressFormParams) => {
573
573
  control={control}
574
574
  name='internal_number'
575
575
  rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
576
- defaultValue={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
576
+ defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
577
577
  render={() => (
578
578
  <OInput
579
579
  name='internal_number'
@@ -582,11 +582,11 @@ const AddressFormUI = (props: AddressFormParams) => {
582
582
  handleChangeInput(text)
583
583
  setValue('internal_number', text)
584
584
  }}
585
- value={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
585
+ value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
586
586
  style={styles.inputsStyle}
587
587
  forwardRef={internalNumberRef}
588
588
  returnKeyType='next'
589
- onSubmitEditing={() => zipCodeRef.current.focus()}
589
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
590
590
  blurOnSubmit={false}
591
591
  />
592
592
  )}
@@ -609,7 +609,7 @@ const AddressFormUI = (props: AddressFormParams) => {
609
609
  style={styles.inputsStyle}
610
610
  forwardRef={zipCodeRef}
611
611
  returnKeyType='next'
612
- onSubmitEditing={() => addressNotesRef.current.focus()}
612
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
613
613
  blurOnSubmit={false}
614
614
  />
615
615
  )}
@@ -26,7 +26,7 @@ export const FacebookLogin = (props: any) => {
26
26
  : t('LOGIN_WITH_FACEBOOK', 'Login with Facebook');
27
27
 
28
28
  const logoutWithFacebook = () => {
29
- LoginManager.logOut();
29
+ LoginManager && LoginManager.logOut();
30
30
  };
31
31
 
32
32
  const handleLoginClick = async (accessToken: string) => {
@@ -57,7 +57,7 @@ export const FacebookLogin = (props: any) => {
57
57
 
58
58
  const loginWithFacebook = () => {
59
59
  handleLoading && handleLoading(true)
60
- LoginManager.logInWithPermissions(['public_profile']).then(
60
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
61
61
  (login: any) => {
62
62
  if (login.isCancelled) {
63
63
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -270,7 +270,7 @@ const LoginFormUI = (props: LoginParams) => {
270
270
  handleData={(val: any) => setPhoneInputData(val)}
271
271
  textInputProps={{
272
272
  returnKeyType: 'next',
273
- onSubmitEditing: () => inputRef.current.focus(),
273
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
274
274
  }}
275
275
  />
276
276
  </View>
@@ -159,7 +159,7 @@ const PaymentOptionsUI = (props: any) => {
159
159
  // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
160
160
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeGateway.includes(p.gateway))}
161
161
  renderItem={renderPaymethods}
162
- keyExtractor={(paymethod: any) => paymethod.id.toString()}
162
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
163
163
  />
164
164
  )}
165
165
  {(paymethodsList.loading || isLoading) && (
@@ -232,7 +232,7 @@ const PaymentOptionsUI = (props: any) => {
232
232
  )}
233
233
 
234
234
  {/* Stripe */}
235
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
235
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
236
236
  <View style={{ width: '100%' }}>
237
237
  <OButton
238
238
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -281,7 +281,7 @@ const PaymentOptionsUI = (props: any) => {
281
281
  <OModal
282
282
  entireModal
283
283
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
284
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
284
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
285
285
  onClose={() => handlePaymethodClick(null)}
286
286
  >
287
287
  <KeyboardAvoidingView
@@ -299,7 +299,7 @@ const PaymentOptionsUI = (props: any) => {
299
299
  </OModal>
300
300
 
301
301
  {/* Stripe Connect */}
302
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
302
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
303
303
  <View>
304
304
  <OButton
305
305
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -365,7 +365,7 @@ const PaymentOptionsUI = (props: any) => {
365
365
  {/* Paypal */}
366
366
  {/* <Modal
367
367
  className='modal-info'
368
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
368
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
369
369
  onClose={() => handlePaymethodClick(null)}
370
370
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
371
371
  >
@@ -368,7 +368,7 @@ const SignupFormUI = (props: SignupParams) => {
368
368
  returnKeyType='next'
369
369
  blurOnSubmit={false}
370
370
  forwardRef={(ref : any) => handleRefs(ref,field.code)}
371
- onSubmitEditing={() => field.code === 'email' ? phoneRef.current.focus() : handleFocusRef(getNextFieldCode(i))}
371
+ onSubmitEditing={() => field.code === 'email' ? phoneRef?.current?.focus?.() : handleFocusRef(getNextFieldCode(i))}
372
372
  />
373
373
  )}
374
374
  name={field.code}
@@ -387,7 +387,7 @@ const SignupFormUI = (props: SignupParams) => {
387
387
  forwardRef={phoneRef}
388
388
  textInputProps={{
389
389
  returnKeyType: 'next',
390
- onSubmitEditing: () => passwordRef.current.focus()
390
+ onSubmitEditing: () => passwordRef?.current?.focus?.()
391
391
  }}
392
392
  />
393
393
  </View>
@@ -138,7 +138,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
138
138
 
139
139
  if (!isFocus) {
140
140
  if (time.length > 1) timerRef.current.clear();
141
- timerRef.current.focus();
141
+ timerRef?.current?.focus?.();
142
142
  handleFocusTimer();
143
143
  }
144
144
  };
@@ -150,7 +150,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
150
150
  }
151
151
 
152
152
  if (!isFocus && textTareaRef?.current) {
153
- textTareaRef.current.focus();
153
+ textTareaRef?.current?.focus?.();
154
154
  }
155
155
  };
156
156
 
@@ -163,7 +163,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
163
163
 
164
164
  const time = parseInt(hour || '0') * 60 + (parseInt(minsToSend) || 0);
165
165
 
166
- let bodyToSend;
166
+ let bodyToSend : any = {};
167
167
  const orderStatus: any = {
168
168
  acceptByBusiness: {
169
169
  prepared_in: time,
@@ -535,7 +535,7 @@ const LoginFormUI = (props: LoginParams) => {
535
535
  onSubmitEditing={() => null}
536
536
  textInputProps={{
537
537
  returnKeyType: 'next',
538
- onSubmitEditing: () => inputRef.current.focus(),
538
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
539
539
  }}
540
540
  />
541
541
  </View>
@@ -250,7 +250,7 @@ export const OrderContentComponent = (props: OrderContent) => {
250
250
  {order?.customer?.zipcode}
251
251
  </OText>
252
252
  )}
253
- {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
253
+ {/* {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
254
254
  <OButton
255
255
  style={styles.btnReview}
256
256
  textStyle={{ color: theme.colors.white }}
@@ -258,7 +258,7 @@ export const OrderContentComponent = (props: OrderContent) => {
258
258
  imgRightSrc={false}
259
259
  onClick={() => setOpenReviewModal(true)}
260
260
  />
261
- )}
261
+ )} */}
262
262
  </OrderCustomer>
263
263
 
264
264
  <OrderProducts>
@@ -27,7 +27,7 @@ export const SearchBar = (props: any) => {
27
27
  };
28
28
 
29
29
  const handleActiveInput = () => {
30
- inputRef.current.focus();
30
+ inputRef?.current?.focus?.();
31
31
  };
32
32
 
33
33
  let timeout: null | any = null;
@@ -392,7 +392,7 @@ const SignupFormUI = (props: SignupParams) => {
392
392
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
393
393
  onSubmitEditing={() =>
394
394
  field.code === 'email'
395
- ? phoneRef.current.focus()
395
+ ? phoneRef?.current?.focus?.()
396
396
  : handleFocusRef(getNextFieldCode(i))
397
397
  }
398
398
  />
@@ -414,7 +414,7 @@ const SignupFormUI = (props: SignupParams) => {
414
414
  onSubmitEditing={() => null}
415
415
  textInputProps={{
416
416
  returnKeyType: 'next',
417
- onSubmitEditing: () => passwordRef.current.focus(),
417
+ onSubmitEditing: () => passwordRef?.current?.focus?.(),
418
418
  }}
419
419
  />
420
420
  </View>
@@ -437,7 +437,7 @@ const AddressFormUI = (props: AddressFormParams) => {
437
437
  }
438
438
  setIsFirstTime(false)
439
439
  },
440
- onSubmitEditing: () => internalNumberRef.current.focus(),
440
+ onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
441
441
  autoCorrect: false,
442
442
  blurOnSubmit: false,
443
443
  returnKeyType: 'next'
@@ -499,7 +499,7 @@ const AddressFormUI = (props: AddressFormParams) => {
499
499
  control={control}
500
500
  name='internal_number'
501
501
  rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
502
- defaultValue={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
502
+ defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
503
503
  render={() => (
504
504
  <OInput
505
505
  name='internal_number'
@@ -508,11 +508,11 @@ const AddressFormUI = (props: AddressFormParams) => {
508
508
  handleChangeInput(text)
509
509
  setValue('internal_number', text)
510
510
  }}
511
- value={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
511
+ value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
512
512
  style={styles.inputsStyle}
513
513
  forwardRef={internalNumberRef}
514
514
  returnKeyType='next'
515
- onSubmitEditing={() => zipCodeRef.current.focus()}
515
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
516
516
  blurOnSubmit={false}
517
517
  inputStyle={{ fontSize: 12 }}
518
518
  />
@@ -538,7 +538,7 @@ const AddressFormUI = (props: AddressFormParams) => {
538
538
  style={styles.inputsStyle}
539
539
  forwardRef={zipCodeRef}
540
540
  returnKeyType='next'
541
- onSubmitEditing={() => addressNotesRef.current.focus()}
541
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
542
542
  blurOnSubmit={false}
543
543
  inputStyle={{ fontSize: 12 }}
544
544
  />
@@ -31,7 +31,7 @@ export const FacebookLogin = (props: any) => {
31
31
  : text;
32
32
 
33
33
  const logoutWithFacebook = () => {
34
- LoginManager.logOut();
34
+ LoginManager && LoginManager.logOut();
35
35
  };
36
36
 
37
37
  const handleLoginClick = async (accessToken: string) => {
@@ -61,7 +61,7 @@ export const FacebookLogin = (props: any) => {
61
61
 
62
62
  const loginWithFacebook = () => {
63
63
  handleLoading && handleLoading(true)
64
- LoginManager.logInWithPermissions(['public_profile']).then(
64
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
65
65
  (login: any) => {
66
66
  if (login.isCancelled) {
67
67
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -355,7 +355,7 @@ const LoginFormUI = (props: LoginParams) => {
355
355
  handleData={(val: any) => setPhoneInputData(val)}
356
356
  textInputProps={{
357
357
  returnKeyType: 'next',
358
- onSubmitEditing: () => inputRef.current.focus(),
358
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
359
359
  }}
360
360
  />
361
361
  </View>
@@ -172,7 +172,7 @@ const PaymentOptionsUI = (props: any) => {
172
172
  // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
173
173
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id))}
174
174
  renderItem={renderPaymethods}
175
- keyExtractor={(paymethod: any) => paymethod.id.toString()}
175
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
176
176
  />
177
177
  )}
178
178
  {(paymethodsList.loading || isLoading) && (
@@ -245,7 +245,7 @@ const PaymentOptionsUI = (props: any) => {
245
245
  )}
246
246
 
247
247
  {/* Stripe */}
248
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
248
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
249
249
  <View>
250
250
  <OButton
251
251
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -295,7 +295,7 @@ const PaymentOptionsUI = (props: any) => {
295
295
  <OModal
296
296
  entireModal
297
297
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
298
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
298
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
299
299
  onClose={() => handlePaymethodClick(null)}
300
300
  overScreen
301
301
  >
@@ -314,7 +314,7 @@ const PaymentOptionsUI = (props: any) => {
314
314
  </OModal>
315
315
 
316
316
  {/* Stripe Connect */}
317
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
317
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
318
318
  <View>
319
319
  <OButton
320
320
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -381,7 +381,7 @@ const PaymentOptionsUI = (props: any) => {
381
381
  {/* Paypal */}
382
382
  {/* <Modal
383
383
  className='modal-info'
384
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
384
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
385
385
  onClose={() => handlePaymethodClick(null)}
386
386
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
387
387
  >
@@ -426,7 +426,7 @@ const SignupFormUI = (props: SignupParams) => {
426
426
  returnKeyType='next'
427
427
  blurOnSubmit={false}
428
428
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
429
- onSubmitEditing={() => field.code === 'email' ? phoneRef.current.focus() : handleFocusRef(getNextFieldCode(i))}
429
+ onSubmitEditing={() => field.code === 'email' ? phoneRef?.current?.focus?.() : handleFocusRef(getNextFieldCode(i))}
430
430
  inputStyle={{ color: theme.colors.textPrimary, fontSize: 12 }}
431
431
  />
432
432
  )}
@@ -451,7 +451,7 @@ const SignupFormUI = (props: SignupParams) => {
451
451
  forwardRef={phoneRef}
452
452
  textInputProps={{
453
453
  returnKeyType: 'next',
454
- onSubmitEditing: () => passwordRef.current.focus(),
454
+ onSubmitEditing: () => passwordRef?.current?.focus?.(),
455
455
  style: { borderWidth: 0, fontSize: 12 }
456
456
  }}
457
457
  textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
@@ -554,7 +554,7 @@ const AddressFormUI = (props: AddressFormParams) => {
554
554
  setAddressEditing(text.length == 0);
555
555
  },
556
556
  onSubmitEditing: () =>
557
- internalNumberRef.current.focus(),
557
+ internalNumberRef?.current?.focus?.(),
558
558
  autoCorrect: false,
559
559
  blurOnSubmit: false,
560
560
  returnKeyType: 'next',
@@ -658,7 +658,7 @@ const AddressFormUI = (props: AddressFormParams) => {
658
658
  defaultValue={
659
659
  address?.internal_number ||
660
660
  formState.changes?.internal_number ||
661
- addressState.address.internal_number ||
661
+ addressState?.address?.internal_number ||
662
662
  ''
663
663
  }
664
664
  render={() => (
@@ -672,13 +672,13 @@ const AddressFormUI = (props: AddressFormParams) => {
672
672
  value={
673
673
  address?.internal_number ||
674
674
  formState.changes?.internal_number ||
675
- addressState.address.internal_number ||
675
+ addressState?.address?.internal_number ||
676
676
  ''
677
677
  }
678
678
  style={{ ...styles.inputsStyle, marginRight: 24 }}
679
679
  forwardRef={internalNumberRef}
680
680
  returnKeyType="next"
681
- onSubmitEditing={() => zipCodeRef.current.focus()}
681
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
682
682
  blurOnSubmit={false}
683
683
  />
684
684
  )}
@@ -719,7 +719,7 @@ const AddressFormUI = (props: AddressFormParams) => {
719
719
  style={styles.inputsStyle}
720
720
  forwardRef={zipCodeRef}
721
721
  returnKeyType="next"
722
- onSubmitEditing={() => addressNotesRef.current.focus()}
722
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
723
723
  blurOnSubmit={false}
724
724
  />
725
725
  )}
@@ -25,7 +25,7 @@ export const FacebookLogin = (props: any) => {
25
25
  : t('CONTINUE_WITH_FACEBOOK', 'Continue with Facebook');
26
26
 
27
27
  const logoutWithFacebook = () => {
28
- LoginManager.logOut();
28
+ LoginManager && LoginManager.logOut();
29
29
  };
30
30
 
31
31
  const handleLoginClick = async (accessToken: string) => {
@@ -48,7 +48,7 @@ export const FacebookLogin = (props: any) => {
48
48
 
49
49
  const loginWithFacebook = () => {
50
50
  handleLoading && handleLoading(true)
51
- LoginManager.logInWithPermissions(['public_profile']).then(
51
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
52
52
  (login: any) => {
53
53
  if (login.isCancelled) {
54
54
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -320,7 +320,7 @@ const LoginFormUI = (props: LoginParams) => {
320
320
  handleData={(val: any) => setPhoneInputData(val)}
321
321
  textInputProps={{
322
322
  returnKeyType: 'next',
323
- onSubmitEditing: () => inputRef.current.focus(),
323
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
324
324
  }}
325
325
  />
326
326
  </View>
@@ -286,7 +286,7 @@ const PaymentOptionsUI = (props: any) => {
286
286
  <OModal
287
287
  entireModal
288
288
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
289
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
289
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
290
290
  onClose={() => handlePaymethodClick(null)}
291
291
  >
292
292
  <KeyboardAvoidingView
@@ -304,7 +304,7 @@ const PaymentOptionsUI = (props: any) => {
304
304
  </OModal>
305
305
 
306
306
  {/* Stripe Connect */}
307
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
307
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
308
308
  <View>
309
309
  <StripeCardsList
310
310
  paymethod={isOpenMethod?.paymethod}
@@ -370,7 +370,7 @@ const PaymentOptionsUI = (props: any) => {
370
370
  {/* Paypal */}
371
371
  {/* <Modal
372
372
  className='modal-info'
373
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
373
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
374
374
  onClose={() => handlePaymethodClick(null)}
375
375
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
376
376
  >
@@ -426,7 +426,7 @@ const SignupFormUI = (props: SignupParams) => {
426
426
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
427
427
  onSubmitEditing={() =>
428
428
  field.code === 'email'
429
- ? phoneRef.current.focus()
429
+ ? phoneRef?.current?.focus?.()
430
430
  : handleFocusRef(getNextFieldCode(i))
431
431
  }
432
432
  />
@@ -446,7 +446,7 @@ const SignupFormUI = (props: SignupParams) => {
446
446
  forwardRef={phoneRef}
447
447
  textInputProps={{
448
448
  returnKeyType: 'next',
449
- onSubmitEditing: () => passwordRef.current.focus(),
449
+ onSubmitEditing: () => passwordRef?.current?.focus?.(),
450
450
  }}
451
451
  />
452
452
  </View>
@@ -437,7 +437,7 @@ const AddressFormUI = (props: AddressFormParams) => {
437
437
  }
438
438
  setIsFirstTime(false)
439
439
  },
440
- onSubmitEditing: () => internalNumberRef.current.focus(),
440
+ onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
441
441
  autoCorrect: false,
442
442
  blurOnSubmit: false,
443
443
  returnKeyType: 'next',
@@ -519,7 +519,7 @@ const AddressFormUI = (props: AddressFormParams) => {
519
519
  control={control}
520
520
  name='internal_number'
521
521
  rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
522
- defaultValue={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
522
+ defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
523
523
  render={() => (
524
524
  <OInput
525
525
  name='internal_number'
@@ -528,11 +528,11 @@ const AddressFormUI = (props: AddressFormParams) => {
528
528
  handleChangeInput(text)
529
529
  setValue('internal_number', text)
530
530
  }}
531
- value={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
531
+ value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
532
532
  style={styles.inputsStyle}
533
533
  forwardRef={internalNumberRef}
534
534
  returnKeyType='next'
535
- onSubmitEditing={() => zipCodeRef.current.focus()}
535
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
536
536
  blurOnSubmit={false}
537
537
  />
538
538
  )}
@@ -556,7 +556,7 @@ const AddressFormUI = (props: AddressFormParams) => {
556
556
  style={styles.inputsStyle}
557
557
  forwardRef={zipCodeRef}
558
558
  returnKeyType='next'
559
- onSubmitEditing={() => addressNotesRef.current.focus()}
559
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
560
560
  blurOnSubmit={false}
561
561
  />
562
562
  )}
@@ -27,7 +27,7 @@ export const FacebookLogin = (props: any) => {
27
27
  : t('Continue_WITH_FACEBOOK', 'Continue with Facebook');
28
28
 
29
29
  const logoutWithFacebook = () => {
30
- LoginManager.logOut();
30
+ LoginManager && LoginManager.logOut();
31
31
  };
32
32
 
33
33
  const handleLoginClick = async (accessToken: string) => {
@@ -57,7 +57,7 @@ export const FacebookLogin = (props: any) => {
57
57
 
58
58
  const loginWithFacebook = () => {
59
59
  handleLoading && handleLoading(true)
60
- LoginManager.logInWithPermissions(['public_profile']).then(
60
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
61
61
  (login: any) => {
62
62
  if (login.isCancelled) {
63
63
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -296,7 +296,7 @@ const LoginFormUI = (props: LoginParams) => {
296
296
  handleData={(val: any) => setPhoneInputData(val)}
297
297
  textInputProps={{
298
298
  returnKeyType: 'next',
299
- onSubmitEditing: () => inputRef.current.focus(),
299
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
300
300
  }}
301
301
  />
302
302
  </View>
@@ -187,7 +187,7 @@ const PaymentOptionsUI = (props: any) => {
187
187
  showsVerticalScrollIndicator={false}
188
188
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id))}
189
189
  renderItem={renderPaymethods}
190
- keyExtractor={(paymethod: any) => paymethod.id.toString()}
190
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
191
191
  ListFooterComponent={renderFooter}
192
192
  />
193
193
  )}
@@ -220,7 +220,7 @@ const PaymentOptionsUI = (props: any) => {
220
220
  />
221
221
  }
222
222
 
223
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
223
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
224
224
  <View>
225
225
  <OButton
226
226
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -325,7 +325,7 @@ const PaymentOptionsUI = (props: any) => {
325
325
  <OModal
326
326
  entireModal
327
327
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
328
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
328
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
329
329
  onClose={() => handlePaymethodClick(null)}
330
330
  >
331
331
  <KeyboardAvoidingView
@@ -343,7 +343,7 @@ const PaymentOptionsUI = (props: any) => {
343
343
  </OModal>
344
344
 
345
345
  {/* Stripe Connect */}
346
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
346
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
347
347
  <View>
348
348
  <OButton
349
349
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -383,7 +383,7 @@ const SignupFormUI = (props: SignupParams) => {
383
383
  returnKeyType='next'
384
384
  blurOnSubmit={false}
385
385
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
386
- onSubmitEditing={() => field.code === 'email' ? phoneRef.current.focus() : handleFocusRef(getNextFieldCode(i))}
386
+ onSubmitEditing={() => field.code === 'email' ? phoneRef?.current?.focus?.() : handleFocusRef(getNextFieldCode(i))}
387
387
  />
388
388
  )}
389
389
  name={field.code}
@@ -403,7 +403,7 @@ const SignupFormUI = (props: SignupParams) => {
403
403
  forwardRef={phoneRef}
404
404
  textInputProps={{
405
405
  returnKeyType: 'next',
406
- onSubmitEditing: () => passwordRef.current.focus()
406
+ onSubmitEditing: () => passwordRef?.current?.focus?.()
407
407
  }}
408
408
  />
409
409
  </View>
@@ -554,7 +554,7 @@ const AddressFormUI = (props: AddressFormParams) => {
554
554
  setAddressEditing(text.length == 0);
555
555
  },
556
556
  onSubmitEditing: () =>
557
- internalNumberRef.current.focus(),
557
+ internalNumberRef?.current?.focus?.(),
558
558
  autoCorrect: false,
559
559
  blurOnSubmit: false,
560
560
  returnKeyType: 'next',
@@ -658,7 +658,7 @@ const AddressFormUI = (props: AddressFormParams) => {
658
658
  defaultValue={
659
659
  address?.internal_number ||
660
660
  formState.changes?.internal_number ||
661
- addressState.address.internal_number ||
661
+ addressState?.address?.internal_number ||
662
662
  ''
663
663
  }
664
664
  render={() => (
@@ -672,13 +672,13 @@ const AddressFormUI = (props: AddressFormParams) => {
672
672
  value={
673
673
  address?.internal_number ||
674
674
  formState.changes?.internal_number ||
675
- addressState.address.internal_number ||
675
+ addressState?.address?.internal_number ||
676
676
  ''
677
677
  }
678
678
  style={{ ...styles.inputsStyle, marginRight: 24 }}
679
679
  forwardRef={internalNumberRef}
680
680
  returnKeyType="next"
681
- onSubmitEditing={() => zipCodeRef.current.focus()}
681
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
682
682
  blurOnSubmit={false}
683
683
  />
684
684
  )}
@@ -719,7 +719,7 @@ const AddressFormUI = (props: AddressFormParams) => {
719
719
  style={styles.inputsStyle}
720
720
  forwardRef={zipCodeRef}
721
721
  returnKeyType="next"
722
- onSubmitEditing={() => addressNotesRef.current.focus()}
722
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
723
723
  blurOnSubmit={false}
724
724
  />
725
725
  )}
@@ -25,7 +25,7 @@ export const FacebookLogin = (props: any) => {
25
25
  : t('CONTINUE_WITH_FACEBOOK', 'Continue with Facebook');
26
26
 
27
27
  const logoutWithFacebook = () => {
28
- LoginManager.logOut();
28
+ LoginManager && LoginManager.logOut();
29
29
  };
30
30
 
31
31
  const handleLoginClick = async (accessToken: string) => {
@@ -48,7 +48,7 @@ export const FacebookLogin = (props: any) => {
48
48
 
49
49
  const loginWithFacebook = () => {
50
50
  handleLoading && handleLoading(true)
51
- LoginManager.logInWithPermissions(['public_profile']).then(
51
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
52
52
  (login: any) => {
53
53
  if (login.isCancelled) {
54
54
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -325,7 +325,7 @@ const LoginFormUI = (props: LoginParams) => {
325
325
  handleData={(val: any) => setPhoneInputData(val)}
326
326
  textInputProps={{
327
327
  returnKeyType: 'next',
328
- onSubmitEditing: () => inputRef.current.focus(),
328
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
329
329
  }}
330
330
  />
331
331
  </View>
@@ -150,7 +150,7 @@ const PaymentOptionsUI = (props: any) => {
150
150
  // data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id)}
151
151
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id))}
152
152
  renderItem={renderPaymethods}
153
- keyExtractor={(paymethod: any) => paymethod.id.toString()}
153
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
154
154
  />
155
155
  )}
156
156
 
@@ -226,7 +226,7 @@ const PaymentOptionsUI = (props: any) => {
226
226
  )}
227
227
 
228
228
  {/* Stripe */}
229
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
229
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
230
230
  <View>
231
231
  <OButton
232
232
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -276,7 +276,7 @@ const PaymentOptionsUI = (props: any) => {
276
276
  <OModal
277
277
  entireModal
278
278
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
279
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
279
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
280
280
  onClose={() => handlePaymethodClick(null)}
281
281
  >
282
282
  <KeyboardAvoidingView
@@ -294,7 +294,7 @@ const PaymentOptionsUI = (props: any) => {
294
294
  </OModal>
295
295
 
296
296
  {/* Stripe Connect */}
297
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
297
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
298
298
  <View>
299
299
  <OButton
300
300
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -360,7 +360,7 @@ const PaymentOptionsUI = (props: any) => {
360
360
  {/* Paypal */}
361
361
  {/* <Modal
362
362
  className='modal-info'
363
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
363
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
364
364
  onClose={() => handlePaymethodClick(null)}
365
365
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
366
366
  >
@@ -443,7 +443,7 @@ const SignupFormUI = (props: SignupParams) => {
443
443
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
444
444
  onSubmitEditing={() =>
445
445
  field.code === 'email'
446
- ? phoneRef.current.focus()
446
+ ? phoneRef?.current?.focus?.()
447
447
  : handleFocusRef(getNextFieldCode(i))
448
448
  }
449
449
  />
@@ -463,7 +463,7 @@ const SignupFormUI = (props: SignupParams) => {
463
463
  forwardRef={phoneRef}
464
464
  textInputProps={{
465
465
  returnKeyType: 'next',
466
- onSubmitEditing: () => passwordRef.current.focus(),
466
+ onSubmitEditing: () => passwordRef?.current?.focus?.(),
467
467
  }}
468
468
  />
469
469
  </View>
@@ -559,7 +559,7 @@ const AddressFormUI = (props: AddressFormParams) => {
559
559
  setAddressEditing(text.length == 0);
560
560
  },
561
561
  onSubmitEditing: () =>
562
- internalNumberRef.current.focus(),
562
+ internalNumberRef?.current?.focus?.(),
563
563
  autoCorrect: false,
564
564
  blurOnSubmit: false,
565
565
  returnKeyType: 'next',
@@ -652,7 +652,7 @@ const AddressFormUI = (props: AddressFormParams) => {
652
652
  defaultValue={
653
653
  address?.internal_number ||
654
654
  formState.changes?.internal_number ||
655
- addressState.address.internal_number ||
655
+ addressState?.address?.internal_number ||
656
656
  ''
657
657
  }
658
658
  render={() => (
@@ -666,13 +666,13 @@ const AddressFormUI = (props: AddressFormParams) => {
666
666
  value={
667
667
  address?.internal_number ||
668
668
  formState.changes?.internal_number ||
669
- addressState.address.internal_number ||
669
+ addressState?.address?.internal_number ||
670
670
  ''
671
671
  }
672
672
  style={{ ...styles.inputsStyle, marginRight: 24 }}
673
673
  forwardRef={internalNumberRef}
674
674
  returnKeyType="next"
675
- onSubmitEditing={() => zipCodeRef.current.focus()}
675
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
676
676
  blurOnSubmit={false}
677
677
  />
678
678
  )}
@@ -713,7 +713,7 @@ const AddressFormUI = (props: AddressFormParams) => {
713
713
  style={styles.inputsStyle}
714
714
  forwardRef={zipCodeRef}
715
715
  returnKeyType="next"
716
- onSubmitEditing={() => addressNotesRef.current.focus()}
716
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
717
717
  blurOnSubmit={false}
718
718
  />
719
719
  )}
@@ -26,7 +26,7 @@ export const AppleLogin = (props: any) => {
26
26
  : t('CONTINUE_WITH_FACEBOOK', 'Continue with Apple');
27
27
 
28
28
  const logoutWithFacebook = () => {
29
- LoginManager.logOut();
29
+ LoginManager && LoginManager.logOut();
30
30
  };
31
31
 
32
32
  const handleLoginClick = async (accessToken: string) => {
@@ -49,7 +49,7 @@ export const AppleLogin = (props: any) => {
49
49
 
50
50
  const loginWithFacebook = () => {
51
51
  handleLoading && handleLoading(true)
52
- LoginManager.logInWithPermissions(['public_profile']).then(
52
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
53
53
  (login: any) => {
54
54
  if (login.isCancelled) {
55
55
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -25,7 +25,7 @@ export const FacebookLogin = (props: any) => {
25
25
  : t('CONTINUE_WITH_FACEBOOK', 'Continue with Facebook');
26
26
 
27
27
  const logoutWithFacebook = () => {
28
- LoginManager.logOut();
28
+ LoginManager && LoginManager.logOut();
29
29
  };
30
30
 
31
31
  const handleLoginClick = async (accessToken: string) => {
@@ -48,7 +48,7 @@ export const FacebookLogin = (props: any) => {
48
48
 
49
49
  const loginWithFacebook = () => {
50
50
  handleLoading && handleLoading(true)
51
- LoginManager.logInWithPermissions(['public_profile']).then(
51
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
52
52
  (login: any) => {
53
53
  if (login.isCancelled) {
54
54
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -26,7 +26,7 @@ export const GoogleLogin = (props: any) => {
26
26
  : t('CONTINUE_WITH_GOOGLE', 'Continue with Google');
27
27
 
28
28
  const logoutWithFacebook = () => {
29
- LoginManager.logOut();
29
+ LoginManager && LoginManager.logOut();
30
30
  };
31
31
 
32
32
  const handleLoginClick = async (accessToken: string) => {
@@ -49,7 +49,7 @@ export const GoogleLogin = (props: any) => {
49
49
 
50
50
  const loginWithFacebook = () => {
51
51
  handleLoading && handleLoading(true)
52
- LoginManager.logInWithPermissions(['public_profile']).then(
52
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
53
53
  (login: any) => {
54
54
  if (login.isCancelled) {
55
55
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -381,7 +381,7 @@ const LoginFormUI = (props: LoginParams) => {
381
381
  handleData={(val: any) => setPhoneInputData(val)}
382
382
  textInputProps={{
383
383
  returnKeyType: 'next',
384
- onSubmitEditing: () => inputRef.current.focus(),
384
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
385
385
  }}
386
386
  />
387
387
  </View>
@@ -240,7 +240,7 @@ const PaymentOptionsUI = (props: any) => {
240
240
  )}
241
241
 
242
242
  {/* Stripe */}
243
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
243
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
244
244
  <View>
245
245
  <OButton
246
246
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -290,7 +290,7 @@ const PaymentOptionsUI = (props: any) => {
290
290
  <OModal
291
291
  entireModal
292
292
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
293
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
293
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
294
294
  onClose={() => handlePaymethodClick(null)}
295
295
  >
296
296
  <KeyboardAvoidingView
@@ -308,7 +308,7 @@ const PaymentOptionsUI = (props: any) => {
308
308
  </OModal>
309
309
 
310
310
  {/* Stripe Connect */}
311
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
311
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
312
312
  <View>
313
313
  <OButton
314
314
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -374,7 +374,7 @@ const PaymentOptionsUI = (props: any) => {
374
374
  {/* Paypal */}
375
375
  {/* <Modal
376
376
  className='modal-info'
377
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
377
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
378
378
  onClose={() => handlePaymethodClick(null)}
379
379
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
380
380
  >
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import {
3
3
  ProductForm as ProductOptions,
4
4
  useSession,
@@ -9,7 +9,7 @@ import {
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { ProductIngredient } from '../ProductIngredient';
11
11
  import { ProductOption } from '../ProductOption';
12
- import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, useWindowDimensions, Keyboard } from 'react-native';
12
+ import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, useWindowDimensions, Keyboard, KeyboardAvoidingView } from 'react-native';
13
13
 
14
14
  import {
15
15
  ProductHeader,
@@ -120,7 +120,7 @@ export const ProductOptionsUI = (props: any) => {
120
120
  const { top, bottom } = useSafeAreaInsets();
121
121
  const { height } = useWindowDimensions();
122
122
  const [selOpt, setSelectedOpt] = useState(0);
123
-
123
+ const scrollViewRef = useRef<any>()
124
124
  const isError = (id: number) => {
125
125
  let bgColor = theme.colors.white;
126
126
  if (errors[`id:${id}`]) {
@@ -241,6 +241,7 @@ export const ProductOptionsUI = (props: any) => {
241
241
  const keyboardDidShowListener = Keyboard.addListener(
242
242
  'keyboardDidShow',
243
243
  () => {
244
+ scrollViewRef?.current && scrollViewRef?.current?.scrollToEnd()
244
245
  setIsKeyboardShow(true);
245
246
  }
246
247
  );
@@ -259,7 +260,7 @@ export const ProductOptionsUI = (props: any) => {
259
260
 
260
261
  return (
261
262
  <>
262
- <ScrollView style={{ height: windowHeight * 0.85 }}>
263
+ <ScrollView ref={scrollViewRef}>
263
264
  {!error && (
264
265
  <>
265
266
  <WrapHeader>
@@ -560,7 +561,7 @@ export const ProductOptionsUI = (props: any) => {
560
561
  )}
561
562
  </>
562
563
  )}
563
- <ProductComment style={{ paddingBottom: isKeyboardShow ? 200 : 0 }}>
564
+ <ProductComment>
564
565
  <SectionTitle>
565
566
  <OText size={16} weight={'600'} lineHeight={24}>
566
567
  {t('SPECIAL_COMMENT', 'Special comment')}
@@ -597,7 +598,7 @@ export const ProductOptionsUI = (props: any) => {
597
598
  )}
598
599
  </ScrollView>
599
600
  {!loading && !error && product && (
600
- <ProductActions style={{ maxHeight: windowHeight * 0.15 }}>
601
+ <ProductActions>
601
602
  <OText size={16} lineHeight={24} weight={'600'}>
602
603
  {productCart.total ? parsePrice(productCart?.total) : ''}
603
604
  </OText>
@@ -59,9 +59,12 @@ export const WrapperSubOption = styled.View`
59
59
  `
60
60
 
61
61
  export const ProductComment = styled.View`
62
+ padding-bottom: 40px
62
63
  `
63
64
 
64
65
  export const ProductActions = styled.View`
66
+ position: absolute;
67
+ bottom: 0px;
65
68
  min-height: 70px;
66
69
  padding: 12px 40px;
67
70
  width: 100%;
@@ -72,7 +75,10 @@ export const ProductActions = styled.View`
72
75
  justify-content: space-between;
73
76
  border-top-width: 1px;
74
77
  border-top-color: ${(props: any) => props.theme.colors.border};
78
+ flex: 1;
79
+ flex-direction: row;
75
80
  `
81
+
76
82
  export const ExtraOptionWrap = styled.ScrollView`
77
83
  margin-horizontal: -40px;
78
84
  `;
@@ -425,7 +425,7 @@ const SignupFormUI = (props: SignupParams) => {
425
425
  forwardRef={(ref: any) => handleRefs(ref, field.code)}
426
426
  onSubmitEditing={() =>
427
427
  field.code === 'email'
428
- ? phoneRef.current.focus()
428
+ ? phoneRef?.current?.focus?.()
429
429
  : handleFocusRef(getNextFieldCode(i))
430
430
  }
431
431
  />
@@ -445,7 +445,7 @@ const SignupFormUI = (props: SignupParams) => {
445
445
  forwardRef={phoneRef}
446
446
  textInputProps={{
447
447
  returnKeyType: 'next',
448
- onSubmitEditing: () => passwordRef.current.focus(),
448
+ onSubmitEditing: () => passwordRef?.current?.focus?.(),
449
449
  }}
450
450
  />
451
451
  </View>
@@ -114,8 +114,9 @@ const ProfileUI = (props: ProfileParams) => {
114
114
  console.log('ImagePicker Error: ', response.errorMessage);
115
115
  showToast(ToastType.Error, response.errorMessage);
116
116
  } else {
117
- if (response.uri) {
118
- const url = `data:${response.type};base64,${response.base64}`;
117
+ if (response?.assets?.[0]?.uri) {
118
+ const image = response?.assets?.[0]
119
+ const url = `data:${image?.type};base64,${image?.base64}`;
119
120
  handleButtonUpdateClick(null, true, url);
120
121
  } else {
121
122
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -523,7 +523,7 @@ const AddressFormUI = (props: AddressFormParams) => {
523
523
  }
524
524
  setIsFirstTime(false)
525
525
  },
526
- onSubmitEditing: () => internalNumberRef.current.focus(),
526
+ onSubmitEditing: () => internalNumberRef?.current?.focus?.(),
527
527
  autoCorrect: false,
528
528
  blurOnSubmit: false,
529
529
  returnKeyType: 'next'
@@ -576,7 +576,7 @@ const AddressFormUI = (props: AddressFormParams) => {
576
576
  control={control}
577
577
  name='internal_number'
578
578
  rules={{ required: isRequiredField && isRequiredField('internal_number') ? t(`VALIDATION_ERROR_INTERNAL_NUMBER_REQUIRED`, `The field internal number is required`) : null }}
579
- defaultValue={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
579
+ defaultValue={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
580
580
  render={() => (
581
581
  <OInput
582
582
  name='internal_number'
@@ -585,11 +585,11 @@ const AddressFormUI = (props: AddressFormParams) => {
585
585
  handleChangeInput(text)
586
586
  setValue('internal_number', text)
587
587
  }}
588
- value={address?.internal_number || formState.changes?.internal_number || addressState.address.internal_number || ''}
588
+ value={address?.internal_number || formState.changes?.internal_number || addressState?.address?.internal_number || ''}
589
589
  style={styles.inputsStyle}
590
590
  forwardRef={internalNumberRef}
591
591
  returnKeyType='next'
592
- onSubmitEditing={() => zipCodeRef.current.focus()}
592
+ onSubmitEditing={() => zipCodeRef?.current?.focus?.()}
593
593
  blurOnSubmit={false}
594
594
  />
595
595
  )}
@@ -617,7 +617,7 @@ const AddressFormUI = (props: AddressFormParams) => {
617
617
  style={styles.inputsStyle}
618
618
  forwardRef={zipCodeRef}
619
619
  returnKeyType='next'
620
- onSubmitEditing={() => addressNotesRef.current.focus()}
620
+ onSubmitEditing={() => addressNotesRef?.current?.focus?.()}
621
621
  blurOnSubmit={false}
622
622
  />
623
623
  )}
@@ -26,7 +26,7 @@ export const FacebookLogin = (props: any) => {
26
26
  : t('LOGIN_WITH_FACEBOOK', 'Login with Facebook');
27
27
 
28
28
  const logoutWithFacebook = () => {
29
- LoginManager.logOut();
29
+ LoginManager && LoginManager.logOut();
30
30
  };
31
31
 
32
32
  const handleLoginClick = async (accessToken: string) => {
@@ -57,7 +57,7 @@ export const FacebookLogin = (props: any) => {
57
57
 
58
58
  const loginWithFacebook = () => {
59
59
  handleLoading && handleLoading(true)
60
- LoginManager.logInWithPermissions(['public_profile']).then(
60
+ LoginManager && LoginManager.logInWithPermissions(['public_profile']).then(
61
61
  (login: any) => {
62
62
  if (login.isCancelled) {
63
63
  const err = t('LOGIN_WITH_FACEBOOK_CANCELLED', 'Login cancelled')
@@ -288,7 +288,7 @@ const LoginFormUI = (props: LoginParams) => {
288
288
  handleData={(val: any) => setPhoneInputData(val)}
289
289
  textInputProps={{
290
290
  returnKeyType: 'next',
291
- onSubmitEditing: () => inputRef.current.focus(),
291
+ onSubmitEditing: () => inputRef?.current?.focus?.(),
292
292
  }}
293
293
  />
294
294
  </View>
@@ -195,7 +195,7 @@ const PaymentOptionsUI = (props: any) => {
195
195
  showsVerticalScrollIndicator={false}
196
196
  data={paymethodsList.paymethods.sort((a: any, b: any) => a.id - b.id).filter((p: any) => !excludeIds.includes(p.id))}
197
197
  renderItem={renderPaymethods}
198
- keyExtractor={(paymethod: any) => paymethod.id.toString()}
198
+ keyExtractor={(paymethod: any) => paymethod?.id?.toString?.()}
199
199
  ListFooterComponent={renderFooter}
200
200
  />
201
201
  )}
@@ -228,7 +228,7 @@ const PaymentOptionsUI = (props: any) => {
228
228
  />
229
229
  }
230
230
 
231
- {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData.id && (
231
+ {isOpenMethod?.paymethod?.gateway === 'stripe' && !paymethodData?.id && (
232
232
  <View>
233
233
  <OButton
234
234
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -333,7 +333,7 @@ const PaymentOptionsUI = (props: any) => {
333
333
  <OModal
334
334
  entireModal
335
335
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
336
- open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData.id}
336
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
337
337
  onClose={() => handlePaymethodClick(null)}
338
338
  >
339
339
  <KeyboardAvoidingView
@@ -351,7 +351,7 @@ const PaymentOptionsUI = (props: any) => {
351
351
  </OModal>
352
352
 
353
353
  {/* Stripe Connect */}
354
- {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData.id && (
354
+ {isOpenMethod?.paymethod?.gateway === 'stripe_connect' && !paymethodData?.id && (
355
355
  <View>
356
356
  <OButton
357
357
  text={t('ADD_PAYMENT_CARD', 'Add New Payment Card')}
@@ -417,7 +417,7 @@ const PaymentOptionsUI = (props: any) => {
417
417
  {/* Paypal */}
418
418
  {/* <Modal
419
419
  className='modal-info'
420
- open={paymethodSelected?.gateway === 'paypal' && !paymethodData.id}
420
+ open={paymethodSelected?.gateway === 'paypal' && !paymethodData?.id}
421
421
  onClose={() => handlePaymethodClick(null)}
422
422
  title={t('PAY_WITH_PAYPAL', 'Pay with PayPal')}
423
423
  >
@@ -370,7 +370,7 @@ const SignupFormUI = (props: SignupParams) => {
370
370
  returnKeyType='next'
371
371
  blurOnSubmit={false}
372
372
  forwardRef={(ref : any) => handleRefs(ref,field.code)}
373
- onSubmitEditing={() => field.code === 'email' ? phoneRef.current.focus() : handleFocusRef(getNextFieldCode(i))}
373
+ onSubmitEditing={() => field.code === 'email' ? phoneRef?.current?.focus?.() : handleFocusRef(getNextFieldCode(i))}
374
374
  />
375
375
  )}
376
376
  name={field.code}
@@ -393,7 +393,7 @@ const SignupFormUI = (props: SignupParams) => {
393
393
  forwardRef={phoneRef}
394
394
  textInputProps={{
395
395
  returnKeyType: 'next',
396
- onSubmitEditing: () => passwordRef.current.focus()
396
+ onSubmitEditing: () => passwordRef?.current?.focus?.()
397
397
  }}
398
398
  />
399
399
  </View>