ordering-ui-react-native 0.12.39 → 0.12.40

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.39",
3
+ "version": "0.12.40",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -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>
@@ -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'));