ordering-ui-react-native 0.20.4-release → 0.20.5-release

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.20.4-release",
3
+ "version": "0.20.5-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -138,7 +138,10 @@ export const Home = (props: any) => {
138
138
  placeholder={t('PROJECT_NAME', 'Project Name')}
139
139
  icon={theme.images.general.project}
140
140
  iconColor={theme.colors.arrowColor}
141
- onChange={(e: any) => onChange(e?.target?.value)}
141
+ onChange={(e: any) => {
142
+ const project = e?.target?.value?.replace(/\s/g, '')
143
+ onChange(project)
144
+ }}
142
145
  selectionColor={theme.colors.primary}
143
146
  color={theme.colors.white}
144
147
  value={value}
@@ -148,6 +151,7 @@ export const Home = (props: any) => {
148
151
  autoCapitalize='none'
149
152
  blurOnSubmit={false}
150
153
  onSubmitEditing={() => handleSubmit(onSubmit)()}
154
+ isValueSync
151
155
  />
152
156
  )}
153
157
  />
@@ -4,7 +4,10 @@ import {
4
4
  View,
5
5
  StyleSheet,
6
6
  Dimensions,
7
- TouchableOpacity
7
+ TouchableOpacity,
8
+ NativeModules,
9
+ PermissionsAndroid,
10
+ Platform
8
11
  } from 'react-native';
9
12
  import { useTheme } from 'styled-components/native'
10
13
  import moment from 'moment'
@@ -32,7 +35,7 @@ const SoundPlayerComponent = (props: any) => {
32
35
 
33
36
  const theme = useTheme()
34
37
  const [count, setCount] = useState(0);
35
-
38
+ const [isEnabledReadStorage, setIsEnabledReadStorage] = useState(true)
36
39
  const URL_SOUND = 'https://d33aymufw4jvwf.cloudfront.net/notification.mp3' ?? theme.sounds.notification
37
40
 
38
41
  useEffect(() => {
@@ -43,15 +46,28 @@ const SoundPlayerComponent = (props: any) => {
43
46
  await new Promise(resolve => setTimeout(resolve, DELAY_SOUND))
44
47
  SoundPlayer.stop()
45
48
  }
46
-
47
- playSound()
49
+ if (NativeModules?.RNSoundPlayer?.playUrl && typeof URL_SOUND === 'string' && isEnabledReadStorage) {
50
+ playSound()
51
+ }
48
52
 
49
53
  return () => {
50
54
  SoundPlayer.stop()
51
55
  clearInterval(id);
52
56
  }
53
- }, [count])
57
+ }, [count, isEnabledReadStorage])
58
+
59
+ useEffect(() => {
60
+ const checkSoundMedia = async () => {
61
+ if (Platform.OS === 'android') {
62
+ const enabled = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE)
63
+ setIsEnabledReadStorage(enabled)
64
+ } else {
65
+ setIsEnabledReadStorage(true)
66
+ }
67
+ }
68
+ checkSoundMedia()
54
69
 
70
+ }, [])
55
71
  return (
56
72
  <Modal
57
73
  animationType='slide'
@@ -64,6 +64,7 @@ interface Props extends TextInputProps {
64
64
  onSubmitEditing?: any;
65
65
  blurOnSubmit?: any;
66
66
  color?: any;
67
+ isValueSync?: boolean
67
68
  }
68
69
 
69
70
  const OInput = (props: Props): React.ReactElement => {
@@ -118,6 +119,7 @@ const OInput = (props: Props): React.ReactElement => {
118
119
  selectionColor={props.selectionColor}
119
120
  color={props.color}
120
121
  maxLength={props.maxLength || 1000}
122
+ value={props.isValueSync && props.value}
121
123
  />
122
124
 
123
125
  {props.iconRight && (