ordering-ui-react-native 0.16.6 → 0.16.9

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.9",
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>
@@ -212,7 +212,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
212
212
  {category?.description?.length > 80 && (
213
213
  <OButton
214
214
  style={{ height: 15, paddingRight: 0, paddingLeft: 0, borderWidth: 0 }}
215
- text={t('SEE_MORE', 'See more')}
215
+ text={t('VIEW_MORE', 'View more')}
216
216
  parentStyle={{ padding: 0 }}
217
217
  onClick={() => setOpenDescription(category)}
218
218
  bgColor='transparent'
@@ -327,7 +327,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
327
327
  style={{ borderRadius: 7.6 }}
328
328
  />
329
329
  )}
330
- <OText mBottom={40}>{openDescription?.description}</OText>
330
+ <OText mBottom={60}>{openDescription?.description}</OText>
331
331
  </ScrollView>
332
332
  </OModal>
333
333
  </ProductsContainer>
@@ -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>
@@ -99,7 +99,10 @@ const LoginFormUI = (props: LoginParams) => {
99
99
  const theme = useTheme();
100
100
  const isOtpEmail = loginTab === 'otp' && otpType === 'email'
101
101
  const isOtpCellphone = loginTab === 'otp' && otpType === 'cellphone'
102
+
102
103
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
104
+ const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
105
+ const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
103
106
 
104
107
  const loginStyle = StyleSheet.create({
105
108
  btnOutline: {
@@ -704,7 +707,8 @@ const LoginFormUI = (props: LoginParams) => {
704
707
  <ButtonsWrapper>
705
708
  <SocialButtons>
706
709
  {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
707
- configs?.facebook_id?.value && (
710
+ configs?.facebook_id?.value &&
711
+ facebookLoginEnabled && (
708
712
  <FacebookLogin
709
713
  notificationState={notificationState}
710
714
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -721,7 +725,7 @@ const LoginFormUI = (props: LoginParams) => {
721
725
  handleSuccessGoogleLogin={handleSuccessFacebook}
722
726
  />
723
727
  )}
724
- {(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && (
728
+ {(configs?.apple_login_client_id?.value !== '' && configs?.google_login_client_id?.value !== null) && appleLoginEnabled && (
725
729
  <AppleLogin
726
730
  notificationState={notificationState}
727
731
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -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
@@ -136,6 +136,8 @@ const SignupFormUI = (props: SignupParams) => {
136
136
 
137
137
  const showInputPhoneNumber = (validationFields?.fields?.checkout?.cellphone?.enabled ?? false) || configs?.verification_phone_required?.value === '1'
138
138
  const googleLoginEnabled = configs?.google_login_enabled?.value === '1' || !configs?.google_login_enabled?.enabled
139
+ const facebookLoginEnabled = configs?.facebook_login_enabled?.value === '1' || !configs?.facebook_login_enabled?.enabled
140
+ const appleLoginEnabled = configs?.apple_login_enabled?.value === '1' || !configs?.apple_login_enabled?.enabled
139
141
 
140
142
  const handleRefs = (ref: any, code: string) => {
141
143
  switch (code) {
@@ -780,7 +782,9 @@ const SignupFormUI = (props: SignupParams) => {
780
782
  <ButtonsWrapper>
781
783
  <SocialButtons>
782
784
  {(configs?.facebook_login?.value === 'true' || configs?.facebook_login?.value === '1') &&
783
- configs?.facebook_id?.value && (
785
+ configs?.facebook_id?.value &&
786
+ facebookLoginEnabled &&
787
+ (
784
788
  <FacebookLogin
785
789
  notificationState={notificationState}
786
790
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -797,7 +801,7 @@ const SignupFormUI = (props: SignupParams) => {
797
801
  handleSuccessGoogleLogin={handleSuccessFacebook}
798
802
  />
799
803
  )}
800
- {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && (
804
+ {(configs?.apple_login_client_id?.value !== '' && configs?.apple_login_client_id?.value !== null) && appleLoginEnabled && (
801
805
  <AppleLogin
802
806
  notificationState={notificationState}
803
807
  handleErrors={(err: any) => showToast(ToastType.Error, err)}
@@ -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 {