ordering-ui-react-native 0.12.82 → 0.12.83
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
|
@@ -259,7 +259,10 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
259
259
|
}, []);
|
|
260
260
|
|
|
261
261
|
return (
|
|
262
|
-
|
|
262
|
+
<KeyboardAvoidingView
|
|
263
|
+
enabled
|
|
264
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
265
|
+
>
|
|
263
266
|
<ScrollView ref={scrollViewRef}>
|
|
264
267
|
{!error && (
|
|
265
268
|
<>
|
|
@@ -710,7 +713,7 @@ export const ProductOptionsUI = (props: any) => {
|
|
|
710
713
|
</View>
|
|
711
714
|
</ProductActions>
|
|
712
715
|
)}
|
|
713
|
-
|
|
716
|
+
</KeyboardAvoidingView>
|
|
714
717
|
);
|
|
715
718
|
};
|
|
716
719
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType } from 'ordering-components/native'
|
|
3
3
|
import { useForm, Controller } from 'react-hook-form'
|
|
4
4
|
import LinearGradient from 'react-native-linear-gradient'
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
RatingTextContainer
|
|
15
15
|
} from './styles'
|
|
16
16
|
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
17
|
-
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
17
|
+
import { TouchableOpacity, StyleSheet, View, I18nManager, Keyboard } from 'react-native';
|
|
18
18
|
import NavBar from '../NavBar'
|
|
19
19
|
import { FloatingBottomContainer } from '../../../../../src/layouts/FloatingBottomContainer'
|
|
20
20
|
import Spinner from 'react-native-loading-spinner-overlay'
|
|
@@ -90,6 +90,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
90
90
|
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
91
91
|
const [comments, setComments] = useState<Array<any>>([])
|
|
92
92
|
const [extraComment, setExtraComment] = useState('')
|
|
93
|
+
const scrollViewRef = useRef<any>()
|
|
93
94
|
|
|
94
95
|
const onSubmit = () => {
|
|
95
96
|
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
@@ -199,9 +200,23 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
199
200
|
setStars({ ...stars, comments: _comment })
|
|
200
201
|
}, [comments, extraComment])
|
|
201
202
|
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
const keyboardDidShowListener = Keyboard.addListener(
|
|
205
|
+
'keyboardDidShow',
|
|
206
|
+
() => {
|
|
207
|
+
scrollViewRef?.current && scrollViewRef?.current?.scrollToEnd()
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
return () => {
|
|
212
|
+
keyboardDidShowListener.remove();
|
|
213
|
+
};
|
|
214
|
+
}, []);
|
|
215
|
+
|
|
216
|
+
|
|
202
217
|
return (
|
|
203
218
|
<>
|
|
204
|
-
<ReviewOrderContainer>
|
|
219
|
+
<ReviewOrderContainer ref={scrollViewRef}>
|
|
205
220
|
<NavBar
|
|
206
221
|
title={t('REVIEW_ORDER', 'Review Order')}
|
|
207
222
|
titleAlign={'center'}
|