@developer_tribe/react-native-comnyx 0.9.0 → 0.10.1

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.
Files changed (29) hide show
  1. package/android/build.gradle +6 -12
  2. package/android/src/main/java/com/comnyx/ComnyxPackage.kt +8 -26
  3. package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +5 -1
  4. package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +2 -2
  5. package/lib/commonjs/components/ChatList.js +106 -100
  6. package/lib/commonjs/components/ChatList.js.map +1 -1
  7. package/lib/commonjs/components/CustomerForm.js +179 -173
  8. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  9. package/lib/commonjs/components/EmptyList.js +7 -5
  10. package/lib/commonjs/components/EmptyList.js.map +1 -1
  11. package/lib/commonjs/notifications/initializeNotifications.js +16 -16
  12. package/lib/commonjs/notifications/initializeNotifications.js.map +1 -1
  13. package/lib/module/components/ChatList.js +107 -101
  14. package/lib/module/components/ChatList.js.map +1 -1
  15. package/lib/module/components/CustomerForm.js +180 -174
  16. package/lib/module/components/CustomerForm.js.map +1 -1
  17. package/lib/module/components/EmptyList.js +8 -6
  18. package/lib/module/components/EmptyList.js.map +1 -1
  19. package/lib/module/notifications/initializeNotifications.js +16 -16
  20. package/lib/module/notifications/initializeNotifications.js.map +1 -1
  21. package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
  22. package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
  23. package/lib/typescript/src/components/EmptyList.d.ts.map +1 -1
  24. package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -1
  25. package/package.json +2 -2
  26. package/src/components/ChatList.tsx +123 -110
  27. package/src/components/CustomerForm.tsx +212 -194
  28. package/src/components/EmptyList.tsx +10 -3
  29. package/src/notifications/initializeNotifications.ts +21 -19
@@ -8,6 +8,8 @@ import {
8
8
  TouchableOpacity,
9
9
  Keyboard,
10
10
  StatusBar,
11
+ KeyboardAvoidingView,
12
+ Platform,
11
13
  } from 'react-native';
12
14
  import { getCustomerConversation, sendCustomerMessage } from '../api';
13
15
  import type { AppConversationMessage } from '../types/Conversation';
@@ -555,132 +557,143 @@ export function ChatList({
555
557
  animated={false}
556
558
  translucent
557
559
  />
558
- <View
559
- style={[styles.container, { backgroundColor: themeColors.background }]}
560
+ <KeyboardAvoidingView
561
+ behavior={Platform.OS === 'ios' ? 'padding' : undefined}
562
+ style={{ flex: 1 }}
560
563
  >
561
- <TouchableOpacity
562
- style={[styles.iconContainer]}
563
- onPress={onBack}
564
- activeOpacity={activeOpacity}
565
- >
566
- <Image
567
- source={closeIcon}
568
- style={[styles.closeIcon, { tintColor: themeColors.text }]}
569
- />
570
- </TouchableOpacity>
571
564
  <View
572
565
  style={[
573
- styles.headerContainer,
574
- {
575
- backgroundColor: themeColors.background,
576
- borderBottomColor: themeColors.lavender,
577
- },
566
+ styles.container,
567
+ { backgroundColor: themeColors.background },
578
568
  ]}
579
569
  >
580
- <AppText
581
- localization="chat.support-team"
582
- weight={'600'}
583
- style={[styles.header, { color: themeColors.text }]}
584
- />
570
+ <TouchableOpacity
571
+ style={[styles.iconContainer]}
572
+ onPress={onBack}
573
+ activeOpacity={activeOpacity}
574
+ >
575
+ <Image
576
+ source={closeIcon}
577
+ style={[styles.closeIcon, { tintColor: themeColors.text }]}
578
+ />
579
+ </TouchableOpacity>
585
580
  <View
586
581
  style={[
587
- styles.headerText,
588
- { backgroundColor: themeColors.background },
582
+ styles.headerContainer,
583
+ {
584
+ backgroundColor: themeColors.background,
585
+ borderBottomColor: themeColors.lavender,
586
+ },
589
587
  ]}
590
588
  >
591
- <Image
592
- source={headphonesIcon}
593
- style={[styles.headphonesIcon, { tintColor: themeColors.text }]}
594
- />
595
589
  <AppText
596
- localization="chat.live"
597
- style={[styles.liveChat, { color: themeColors.text }]}
590
+ localization="chat.support-team"
591
+ weight={'600'}
592
+ style={[styles.header, { color: themeColors.text }]}
598
593
  />
599
594
  <View
600
- style={[styles.dot, { backgroundColor: themeColors.green }]}
601
- />
595
+ style={[
596
+ styles.headerText,
597
+ { backgroundColor: themeColors.background },
598
+ ]}
599
+ >
600
+ <Image
601
+ source={headphonesIcon}
602
+ style={[styles.headphonesIcon, { tintColor: themeColors.text }]}
603
+ />
604
+ <AppText
605
+ localization="chat.live"
606
+ style={[styles.liveChat, { color: themeColors.text }]}
607
+ />
608
+ <View
609
+ style={[styles.dot, { backgroundColor: themeColors.green }]}
610
+ />
611
+ </View>
602
612
  </View>
603
- </View>
604
613
 
605
- <View style={styles.listContainer}>
606
- <AppText
607
- style={[
608
- styles.dateText,
609
- { color: themeColors.slate, backgroundColor: themeColors.ghost },
610
- ]}
611
- >
612
- {currentSection}
613
- </AppText>
614
-
615
- <SectionList
616
- ref={ref}
617
- sections={sections}
618
- inverted
619
- renderItem={renderItem}
620
- contentContainerStyle={[
621
- styles.contentContainer,
622
- { backgroundColor: themeColors.background },
623
- ]}
624
- style={styles.list}
625
- ListEmptyComponent={
626
- !loading && (!sections || sections.length === 0) ? (
627
- <EmptyList />
628
- ) : null
629
- }
630
- ListFooterComponent={loading ? <LoadingItem /> : null}
631
- keyExtractor={(item: AppConversationMessage) =>
632
- item.id + '-' + item.created_at
633
- }
634
- removeClippedSubviews={false}
635
- maxToRenderPerBatch={20}
636
- windowSize={21}
637
- initialNumToRender={MESSAGES_PER_PAGE}
638
- getItemLayout={(_: any, index: number) => ({
639
- length: MESSAGE_MIN_HEIGHT + 10,
640
- offset: (MESSAGE_MIN_HEIGHT + 10) * index,
641
- index,
642
- })}
643
- onScroll={handleScroll}
644
- scrollEventThrottle={1}
645
- stickySectionHeadersEnabled={false}
646
- showsVerticalScrollIndicator={false}
614
+ <View style={styles.listContainer}>
615
+ <AppText
616
+ style={[
617
+ styles.dateText,
618
+ {
619
+ color: themeColors.slate,
620
+ backgroundColor: themeColors.ghost,
621
+ },
622
+ ]}
623
+ >
624
+ {currentSection}
625
+ </AppText>
626
+
627
+ <SectionList
628
+ ref={ref}
629
+ sections={sections}
630
+ inverted
631
+ renderItem={renderItem}
632
+ contentContainerStyle={[
633
+ styles.contentContainer,
634
+ { backgroundColor: themeColors.background },
635
+ ]}
636
+ style={styles.list}
637
+ ListEmptyComponent={
638
+ !loading && (!sections || sections.length === 0) ? (
639
+ <EmptyList />
640
+ ) : null
641
+ }
642
+ ListFooterComponent={loading ? <LoadingItem /> : null}
643
+ keyExtractor={(item: AppConversationMessage) =>
644
+ item.id + '-' + item.created_at
645
+ }
646
+ removeClippedSubviews={false}
647
+ maxToRenderPerBatch={20}
648
+ windowSize={21}
649
+ initialNumToRender={MESSAGES_PER_PAGE}
650
+ getItemLayout={(_: any, index: number) => ({
651
+ length: MESSAGE_MIN_HEIGHT + 10,
652
+ offset: (MESSAGE_MIN_HEIGHT + 10) * index,
653
+ index,
654
+ })}
655
+ onScroll={handleScroll}
656
+ scrollEventThrottle={1}
657
+ stickySectionHeadersEnabled={false}
658
+ showsVerticalScrollIndicator={false}
659
+ />
660
+ </View>
661
+ {isScrollingUp && (
662
+ <TouchableOpacity
663
+ activeOpacity={activeOpacity}
664
+ style={[
665
+ styles.scrollDownButton,
666
+ { backgroundColor: themeColors.ghost },
667
+ isKeyboardVisible && styles.scrollDownButtonWithKeyboard,
668
+ ]}
669
+ onPress={() => scrollToBottom(true)}
670
+ >
671
+ <Image
672
+ source={require('../assets/down.png')}
673
+ style={[styles.scrollUpIcon, { tintColor: themeColors.text }]}
674
+ />
675
+ </TouchableOpacity>
676
+ )}
677
+ <MessageInput
678
+ scrollToBottom={scrollToBottom}
679
+ selectedMessage={selectedMessage}
680
+ />
681
+ <CustomPopup
682
+ isVisible={popupVisible}
683
+ onClose={() => setPopupVisible(false)}
684
+ title={'chat.list-failed-message.title'}
685
+ description={'chat.list-failed-message.description'}
686
+ onCancelButton={() => {
687
+ setPopupVisible(false);
688
+ }}
689
+ onResendButton={() => {
690
+ resendMessage();
691
+ setPopupVisible(false);
692
+ }}
693
+ buttonText={'chat.list-cancel' as keyof LocalizationKeys}
647
694
  />
648
695
  </View>
649
- {isScrollingUp && (
650
- <TouchableOpacity
651
- activeOpacity={activeOpacity}
652
- style={[
653
- styles.scrollDownButton,
654
- { backgroundColor: themeColors.ghost },
655
- isKeyboardVisible && styles.scrollDownButtonWithKeyboard,
656
- ]}
657
- onPress={() => scrollToBottom(true)}
658
- >
659
- <Image
660
- source={require('../assets/down.png')}
661
- style={[styles.scrollUpIcon, { tintColor: themeColors.text }]}
662
- />
663
- </TouchableOpacity>
664
- )}
665
- <MessageInput
666
- scrollToBottom={scrollToBottom}
667
- selectedMessage={selectedMessage}
668
- />
669
- <CustomPopup
670
- isVisible={popupVisible}
671
- onClose={() => setPopupVisible(false)}
672
- title={'chat.list-failed-message.title'}
673
- description={'chat.list-failed-message.description'}
674
- onCancelButton={() => {
675
- setPopupVisible(false);
676
- }}
677
- onResendButton={() => {
678
- resendMessage();
679
- setPopupVisible(false);
680
- }}
681
- buttonText={'chat.list-cancel' as keyof LocalizationKeys}
682
- />
683
- </View>
696
+ </KeyboardAvoidingView>
684
697
  </>
685
698
  );
686
699
  }