ordering-ui-react-native 0.16.6 → 0.16.7

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.6",
3
+ "version": "0.16.7",
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>
@@ -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
@@ -21,7 +21,6 @@ interface Props extends TextInputProps {
21
21
  isSecured?: boolean;
22
22
  style?: ViewStyle;
23
23
  placeholder?: string;
24
- placeholderTextColor?:string;
25
24
  icon?: ImageSourcePropType | string;
26
25
  iconRight?: ImageSourcePropType;
27
26
  iconColor?: string;
@@ -81,7 +80,6 @@ const OInput = (props: Props): React.ReactElement => {
81
80
  onChangeText={(txt: any) => props.name ? props.onChange({ target: { name: props.name, value: txt } }) : props.onChange(txt)}
82
81
  defaultValue={props.value}
83
82
  placeholder={props.placeholder ? props.placeholder : ''}
84
- placeholderTextColor={props?.placeholderTextColor ? props?.placeholderTextColor : 'initial'}
85
83
  keyboardType={props.type || 'default'}
86
84
  multiline={props.multiline}
87
85
  scrollEnabled={props.multiline}
@@ -581,7 +581,6 @@ export interface BusinessSearchParams {
581
581
  setFilters: (filters: any) => void,
582
582
  lazySearch?: boolean,
583
583
  brandList?: any;
584
- tags?: any;
585
584
  }
586
585
 
587
586
  export interface NoNetworkParams {