ordering-ui-react-native 0.16.5 → 0.16.8

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.16.5",
3
+ "version": "0.16.8",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -49,7 +49,7 @@ const DriverTipsUI = (props: any) => {
49
49
  const [{ configs }] = useConfig();
50
50
  const [{loading}] = useOrder()
51
51
 
52
- const [value, setvalue] = useState(0);
52
+ const [value, setvalue] = useState('');
53
53
  const [valueOption,setValueOption] = useState(0)
54
54
 
55
55
  const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
@@ -57,9 +57,12 @@ const DriverTipsUI = (props: any) => {
57
57
  : `0${configs?.format_number_currency?.value}`
58
58
 
59
59
  const handleChangeDriverTip = (val: any) => {
60
- let tip = parseFloat(val)
61
- tip = isNaN(tip) ? 0 : tip
62
- setvalue(tip)
60
+ const tip = Number(val)
61
+ if ((isNaN(tip) || tip < 0)) {
62
+ setvalue(value)
63
+ return
64
+ }
65
+ setvalue(val)
63
66
  }
64
67
 
65
68
  const handleChangeOptionCustom = (val : any) => {
@@ -110,6 +113,8 @@ const DriverTipsUI = (props: any) => {
110
113
  <OInput
111
114
  placeholder={placeholderCurrency}
112
115
  style={style.inputStyle}
116
+ value={value}
117
+ type={'numeric'}
113
118
  onChange={handleChangeDriverTip}
114
119
  autoCapitalize='none'
115
120
  autoCorrect={false}
@@ -121,10 +126,10 @@ const DriverTipsUI = (props: any) => {
121
126
  textStyle={{ color: 'white', fontSize: 18, maxWidth: 110, minWidth: 60 }}
122
127
  imgRightSrc={null}
123
128
  textProps={{numberOfLines: 1}}
124
- isDisabled={!(value > 0 && value !== driverTip) || !value}
129
+ isDisabled={parseFloat(value || '0') < 0 || parseFloat(value || '0') === driverTip || value === ''}
125
130
  onClick={() => {
126
131
  handlerChangeOption(value)
127
- setvalue(0)
132
+ setvalue('')
128
133
  }}
129
134
  />
130
135
  </DTWrapperInput>
@@ -305,9 +305,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
305
305
  onCancel={() => handleChangeSearch('')}
306
306
  placeholder={t('SEARCH', 'Search')}
307
307
  height={26}
308
- isDisabled={configs?.advanced_business_search_enabled?.value === '1' || !businessTypes}
308
+ isDisabled={!businessTypes}
309
309
  inputStyle={{ ...styles.searchInput, ...Platform.OS === 'ios' ? {} : { paddingBottom: 4 } }}
310
- onPress={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes }) }}
310
+ onSubmitEditing={() => { configs?.advanced_business_search_enabled?.value === '1' && navigation.navigate('BusinessSearch', { businessTypes, defaultTerm: searchValue }) }}
311
311
  />
312
312
  )}
313
313
 
@@ -48,16 +48,19 @@ const DriverTipsUI = (props: any) => {
48
48
  }
49
49
  })
50
50
 
51
- const [value, setvalue] = useState(0);
51
+ const [value, setvalue] = useState('');
52
52
 
53
53
  const placeholderCurrency = (configs?.currency_position?.value || 'left') === 'left'
54
54
  ? `${configs?.format_number_currency?.value}0`
55
55
  : `0${configs?.format_number_currency?.value}`
56
56
 
57
57
  const handleChangeDriverTip = (val: any) => {
58
- let tip = parseFloat(val)
59
- tip = isNaN(tip) ? 0 : tip
60
- setvalue(tip)
58
+ const tip = Number(val)
59
+ if ((isNaN(tip) || tip < 0)) {
60
+ setvalue(value)
61
+ return
62
+ }
63
+ setvalue(val)
61
64
  }
62
65
 
63
66
  return (
@@ -97,6 +100,8 @@ const DriverTipsUI = (props: any) => {
97
100
  <OInput
98
101
  placeholder={placeholderCurrency}
99
102
  style={style.inputStyle}
103
+ value={value}
104
+ type={'numeric'}
100
105
  onChange={handleChangeDriverTip}
101
106
  autoCapitalize='none'
102
107
  autoCorrect={false}
@@ -108,10 +113,10 @@ const DriverTipsUI = (props: any) => {
108
113
  textStyle={{ color: 'white', fontSize: 14 }}
109
114
  imgRightSrc={null}
110
115
  style={{ borderRadius: 5, height: 44 }}
111
- isDisabled={!(value > 0 && value !== driverTip) || !value}
116
+ isDisabled={parseFloat(value || '0') < 0 || parseFloat(value || '0') === driverTip || value === ''}
112
117
  onClick={() => {
113
118
  handlerChangeOption(value)
114
- setvalue(0)
119
+ setvalue('')
115
120
  }}
116
121
  />
117
122
  </DTWrapperInput>
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Platform, StyleSheet, View } from 'react-native'
2
+ import { View } from 'react-native'
3
3
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
4
4
  import { useTheme } from 'styled-components/native'
5
- import CheckBox from '@react-native-community/checkbox';
5
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
6
6
  import {
7
7
  PaymentOptionWallet as PaymentOptionWalletController,
8
8
  useLanguage,
@@ -41,13 +41,6 @@ const PaymentOptionWalletUI = (props: any) => {
41
41
  const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
42
42
  const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
43
43
 
44
- const styles = StyleSheet.create({
45
- checkBoxStyle: {
46
- width: 25,
47
- height: 25,
48
- }
49
- });
50
-
51
44
  const [checkedState, setCheckedState] = useState(
52
45
  new Array(walletsState.result?.length).fill(false)
53
46
  );
@@ -104,20 +97,19 @@ const PaymentOptionWalletUI = (props: any) => {
104
97
  disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
105
98
  >
106
99
  <SectionLeft>
107
- <CheckBox
108
- value={checkedState[idx]}
109
- disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
110
- boxType={'square'}
111
- tintColors={{
112
- true: theme.colors.primary,
113
- false: theme.colors.disabled
114
- }}
115
- onChange={() => handleOnChange(idx, wallet)}
116
- tintColor={theme.colors.disabled}
117
- onCheckColor={theme.colors.primary}
118
- onTintColor={theme.colors.primary}
119
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
120
- />
100
+ {checkedState[idx] ? (
101
+ <MaterialCommunityIcons
102
+ name="checkbox-marked"
103
+ size={25}
104
+ color={theme.colors.primary}
105
+ />
106
+ ) : (
107
+ <MaterialCommunityIcons
108
+ name="checkbox-blank-outline"
109
+ size={25}
110
+ color={theme.colors.disabled}
111
+ />
112
+ )}
121
113
  <View style={{ alignItems: 'baseline', marginLeft: 5 }}>
122
114
  <View>
123
115
  <OText
@@ -20,7 +20,9 @@ export const SearchBar = (props: any) => {
20
20
  inputStyle,
21
21
  onPress,
22
22
  isDisabled,
23
- iconCustomRight
23
+ iconCustomRight,
24
+ onSubmitEditing,
25
+ blurOnSubmit
24
26
  } = props
25
27
 
26
28
  const theme = useTheme();
@@ -88,6 +90,7 @@ export const SearchBar = (props: any) => {
88
90
  inputStyle={{padding: 0, paddingTop: Platform.OS == 'android' ? 2 : 0, ...inputStyle}}
89
91
  onPress={() => onPress && onPress()}
90
92
  iconCustomRight={iconCustomRight}
93
+ onSubmitEditing={() => onSubmitEditing && onSubmitEditing()}
91
94
  />
92
95
  {isCancelButtonShow && (
93
96
  <OButton