ordering-ui-react-native 0.11.40 → 0.11.41

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.11.40",
3
+ "version": "0.11.41",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -36,6 +36,9 @@ const MessagesUI = (props: MessagesParams) => {
36
36
  const [formattedMessages, setFormattedMessages] = useState<Array<any>>([])
37
37
  const [isKeyboardShow, setIsKeyboardShow] = useState(false)
38
38
 
39
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
40
+ const chatDisabled = previousStatus.includes(order?.status)
41
+
39
42
  const onChangeMessage = (val: string) => {
40
43
  setMessage && setMessage(val)
41
44
  }
@@ -231,33 +234,49 @@ const MessagesUI = (props: MessagesParams) => {
231
234
  )
232
235
 
233
236
  const renderComposer = (props: any) => (
234
- <View style={{ flexDirection: 'row', width: '80%' }}>
235
- <Composer
236
- {...props}
237
- textInputStyle={{
238
- backgroundColor: theme.colors.white,
239
- borderRadius: 25,
240
- paddingHorizontal: 10,
241
- borderColor: '#DBDCDB',
242
- borderWidth: 1,
243
- color: '#010300',
244
- textAlign: I18nManager.isRTL ? 'right' : 'left'
245
- }}
246
- textInputProps={{
247
- value: message,
248
- onSubmitEditing: onSubmit,
249
- returnKeyType: message ? 'send' : 'done',
250
- blurOnSubmit: true,
251
- multiline: false,
252
- numberOfLines: 1,
253
- autoCorrect: false,
254
- autoCompleteType: 'off',
255
- enablesReturnKeyAutomatically: false
237
+ chatDisabled ? (
238
+ <View
239
+ style={{
240
+ width: '100%',
241
+ flexDirection: 'column',
242
+ alignItems: 'center'
256
243
  }}
257
- placeholder={t('WRITE_MESSAGE', 'Write message...')}
258
- />
259
- <RenderActions {...props} />
260
- </View>
244
+ >
245
+ <MaterialCommunityIcon
246
+ name='close-octagon-outline'
247
+ size={24}
248
+ />
249
+ <OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
250
+ </View>
251
+ ) : (
252
+ <View style={{ flexDirection: 'row', width: '80%' }}>
253
+ <Composer
254
+ {...props}
255
+ textInputStyle={{
256
+ backgroundColor: theme.colors.white,
257
+ borderRadius: 25,
258
+ paddingHorizontal: 10,
259
+ borderColor: '#DBDCDB',
260
+ borderWidth: 1,
261
+ color: '#010300',
262
+ textAlign: I18nManager.isRTL ? 'right' : 'left'
263
+ }}
264
+ textInputProps={{
265
+ value: message,
266
+ onSubmitEditing: onSubmit,
267
+ returnKeyType: message ? 'send' : 'done',
268
+ blurOnSubmit: true,
269
+ multiline: false,
270
+ numberOfLines: 1,
271
+ autoCorrect: false,
272
+ autoCompleteType: 'off',
273
+ enablesReturnKeyAutomatically: false
274
+ }}
275
+ placeholder={t('WRITE_MESSAGE', 'Write message...')}
276
+ />
277
+ <RenderActions {...props} />
278
+ </View>
279
+ )
261
280
  )
262
281
 
263
282
  const renderSend = (props: any) => (
@@ -36,6 +36,8 @@ const MessagesUI = (props: MessagesParams) => {
36
36
 
37
37
  const [formattedMessages, setFormattedMessages] = useState<Array<any>>([])
38
38
  const [isKeyboardShow, setIsKeyboardShow] = useState(false)
39
+ const previousStatus = [1, 2, 5, 6, 10, 11, 12, 16, 17]
40
+ const chatDisabled = previousStatus.includes(order?.status)
39
41
  const { height } = useWindowDimensions();
40
42
  const { top, bottom } = useSafeAreaInsets();
41
43
 
@@ -236,36 +238,52 @@ const MessagesUI = (props: MessagesParams) => {
236
238
  )
237
239
 
238
240
  const renderComposer = (props: typeof ComposerProps) => (
239
- <View style={{
240
- flexDirection: 'row', width: '80%', alignItems: 'center', backgroundColor: theme.colors.backgroundGray100,
241
- borderRadius: 7.6,
242
- }}>
243
- <Composer
244
- {...props}
245
- textInputStyle={{
246
- height: 32,
247
- minHeight: 32,
248
- alignItems: 'center',
249
- justifyContent: 'center',
250
- paddingHorizontal: 12,
251
- borderColor: '#DBDCDB',
252
- color: '#010300',
253
- }}
254
- textInputProps={{
255
- value: message,
256
- onSubmitEditing: onSubmit,
257
- returnKeyType: message ? 'send' : 'done',
258
- blurOnSubmit: true,
259
- multiline: false,
260
- numberOfLines: 1,
261
- autoCorrect: false,
262
- autoCompleteType: 'off',
263
- enablesReturnKeyAutomatically: false
264
- }}
265
- placeholder={t('WRITE_MESSAGE', 'Write message...')}
266
- />
267
- <RenderActions {...props} />
268
- </View>
241
+ chatDisabled ? (
242
+ <View
243
+ style={{
244
+ width: '100%',
245
+ flexDirection: 'column',
246
+ alignItems: 'center'
247
+ }}
248
+ >
249
+ <MaterialCommunityIcon
250
+ name='close-octagon-outline'
251
+ size={24}
252
+ />
253
+ <OText size={14}>{t('NOT_SEND_MESSAGES', 'You can\'t send messages because the order has ended')}</OText>
254
+ </View>
255
+ ) : (
256
+ <View style={{
257
+ flexDirection: 'row', width: '80%', alignItems: 'center', backgroundColor: theme.colors.backgroundGray100,
258
+ borderRadius: 7.6,
259
+ }}>
260
+ <Composer
261
+ {...props}
262
+ textInputStyle={{
263
+ height: 32,
264
+ minHeight: 32,
265
+ alignItems: 'center',
266
+ justifyContent: 'center',
267
+ paddingHorizontal: 12,
268
+ borderColor: '#DBDCDB',
269
+ color: '#010300',
270
+ }}
271
+ textInputProps={{
272
+ value: message,
273
+ onSubmitEditing: onSubmit,
274
+ returnKeyType: message ? 'send' : 'done',
275
+ blurOnSubmit: true,
276
+ multiline: false,
277
+ numberOfLines: 1,
278
+ autoCorrect: false,
279
+ autoCompleteType: 'off',
280
+ enablesReturnKeyAutomatically: false
281
+ }}
282
+ placeholder={t('WRITE_MESSAGE', 'Write message...')}
283
+ />
284
+ <RenderActions {...props} />
285
+ </View>
286
+ )
269
287
  )
270
288
 
271
289
  const renderSend = (props: any) => (