@codeleap/mobile 1.9.33 → 2.0.0
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/dist/components/ActionIcon/index.d.ts +13 -0
- package/dist/components/ActionIcon/index.js +54 -0
- package/dist/components/ActionIcon/index.js.map +1 -0
- package/dist/components/ActionIcon/styles.d.ts +64 -0
- package/dist/components/ActionIcon/styles.js +57 -0
- package/dist/components/ActionIcon/styles.js.map +1 -0
- package/dist/components/{ActivityIndicator.d.ts → ActivityIndicator/index.d.ts} +4 -2
- package/dist/components/{ActivityIndicator.js → ActivityIndicator/index.js} +5 -1
- package/dist/components/ActivityIndicator/index.js.map +1 -0
- package/dist/components/ActivityIndicator/styles.d.ts +59 -0
- package/dist/components/ActivityIndicator/styles.js +52 -0
- package/dist/components/ActivityIndicator/styles.js.map +1 -0
- package/dist/components/AutoComplete/index.d.ts +33 -0
- package/dist/components/AutoComplete/index.js +129 -0
- package/dist/components/AutoComplete/index.js.map +1 -0
- package/dist/components/AutoComplete/styles.d.ts +57 -0
- package/dist/components/AutoComplete/styles.js +28 -0
- package/dist/components/AutoComplete/styles.js.map +1 -0
- package/dist/components/Backdrop/index.d.ts +14 -0
- package/dist/components/{Backdrop.js → Backdrop/index.js} +21 -30
- package/dist/components/Backdrop/index.js.map +1 -0
- package/dist/components/{Backdrop.d.ts → Backdrop/styles.d.ts} +7 -20
- package/dist/components/Backdrop/styles.js +28 -0
- package/dist/components/Backdrop/styles.js.map +1 -0
- package/dist/components/Button/index.d.ts +247 -0
- package/dist/components/{Button.js → Button/index.js} +45 -11
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/{NewPager → Button}/styles.d.ts +59 -86
- package/dist/components/Button/styles.js +59 -0
- package/dist/components/Button/styles.js.map +1 -0
- package/dist/components/Calendar/index.d.ts +15 -0
- package/dist/components/Calendar/index.js +80 -0
- package/dist/components/Calendar/index.js.map +1 -0
- package/dist/components/Calendar/style.d.ts +4 -0
- package/dist/components/Calendar/style.js +36 -0
- package/dist/components/Calendar/style.js.map +1 -0
- package/dist/components/Calendar/types.d.ts +95 -0
- package/dist/components/Calendar/types.js +3 -0
- package/dist/components/Calendar/types.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.d.ts +52 -52
- package/dist/components/Checkbox/styles.js +2 -2
- package/dist/components/Checkbox/styles.js.map +1 -1
- package/dist/components/{ContentView.d.ts → ContentView/index.d.ts} +5 -3
- package/dist/components/{ContentView.js → ContentView/index.js} +19 -4
- package/dist/components/ContentView/index.js.map +1 -0
- package/dist/components/ContentView/styles.d.ts +53 -0
- package/dist/components/ContentView/styles.js +26 -0
- package/dist/components/ContentView/styles.js.map +1 -0
- package/dist/components/Drawer/index.d.ts +7 -0
- package/dist/components/{View.js → Drawer/index.js} +18 -15
- package/dist/components/Drawer/index.js.map +1 -0
- package/dist/components/{NewModal → Drawer}/styles.d.ts +55 -56
- package/dist/components/Drawer/styles.js +37 -0
- package/dist/components/Drawer/styles.js.map +1 -0
- package/dist/components/{EmptyPlaceholder.d.ts → EmptyPlaceholder/index.d.ts} +4 -2
- package/dist/components/{EmptyPlaceholder.js → EmptyPlaceholder/index.js} +9 -5
- package/dist/components/EmptyPlaceholder/index.js.map +1 -0
- package/dist/components/EmptyPlaceholder/styles.d.ts +55 -0
- package/dist/components/EmptyPlaceholder/styles.js +32 -0
- package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
- package/dist/components/{FileInput.d.ts → FileInput/index.d.ts} +8 -6
- package/dist/components/{FileInput.js → FileInput/index.js} +13 -30
- package/dist/components/FileInput/index.js.map +1 -0
- package/dist/components/FileInput/styles.d.ts +53 -0
- package/dist/components/FileInput/styles.js +19 -0
- package/dist/components/FileInput/styles.js.map +1 -0
- package/dist/components/Grid/index.d.ts +30 -0
- package/dist/components/Grid/index.js +69 -0
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/Grid/styles.d.ts +5 -0
- package/dist/components/Grid/styles.js +19 -0
- package/dist/components/Grid/styles.js.map +1 -0
- package/dist/components/{Icon.d.ts → Icon/index.d.ts} +3 -1
- package/dist/components/{Icon.js → Icon/index.js} +6 -2
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Icon/styles.d.ts +60 -0
- package/dist/components/Icon/styles.js +45 -0
- package/dist/components/Icon/styles.js.map +1 -0
- package/dist/components/{Image.d.ts → Image/index.d.ts} +6 -4
- package/dist/components/{Image.js → Image/index.js} +35 -7
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Image/styles.d.ts +54 -0
- package/dist/components/Image/styles.js +25 -0
- package/dist/components/Image/styles.js.map +1 -0
- package/dist/components/ImageView/Spotlight.d.ts +25 -0
- package/dist/components/ImageView/Spotlight.js +155 -0
- package/dist/components/ImageView/Spotlight.js.map +1 -0
- package/dist/components/ImageView/component.d.ts +5 -0
- package/dist/components/ImageView/component.js +54 -0
- package/dist/components/ImageView/component.js.map +1 -0
- package/dist/components/ImageView/index.d.ts +2 -0
- package/dist/components/ImageView/index.js +19 -0
- package/dist/components/ImageView/index.js.map +1 -0
- package/dist/components/List/PaginationIndicator.d.ts +67 -0
- package/dist/components/List/PaginationIndicator.js +51 -0
- package/dist/components/List/PaginationIndicator.js.map +1 -0
- package/dist/components/{List.d.ts → List/index.d.ts} +12 -15
- package/dist/components/List/index.js +68 -0
- package/dist/components/List/index.js.map +1 -0
- package/dist/components/List/styles.d.ts +5 -0
- package/dist/components/List/styles.js +24 -0
- package/dist/components/List/styles.js.map +1 -0
- package/dist/components/Modal/index.d.ts +13 -3
- package/dist/components/Modal/index.js +23 -8
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.d.ts +55 -55
- package/dist/components/Modal/styles.js +4 -3
- package/dist/components/Modal/styles.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +6 -0
- package/dist/components/MultiSelect/index.js +106 -0
- package/dist/components/MultiSelect/index.js.map +1 -0
- package/dist/components/MultiSelect/styles.d.ts +58 -0
- package/dist/components/MultiSelect/styles.js +25 -0
- package/dist/components/MultiSelect/styles.js.map +1 -0
- package/dist/components/MultiSelect/types.d.ts +32 -0
- package/dist/components/MultiSelect/types.js +3 -0
- package/dist/components/MultiSelect/types.js.map +1 -0
- package/dist/components/Navigation/Navigation.js +1 -5
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/Pager/index.d.ts +18 -12
- package/dist/components/Pager/index.js +54 -134
- package/dist/components/Pager/index.js.map +1 -1
- package/dist/components/Pager/styles.d.ts +42 -9
- package/dist/components/Pager/styles.js +53 -27
- package/dist/components/Pager/styles.js.map +1 -1
- package/dist/components/RadioInput/index.d.ts +4 -4
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.d.ts +53 -53
- package/dist/components/RadioInput/styles.js +11 -7
- package/dist/components/RadioInput/styles.js.map +1 -1
- package/dist/components/Scroll/index.d.ts +18 -0
- package/dist/components/{Scroll.js → Scroll/index.js} +14 -11
- package/dist/components/Scroll/index.js.map +1 -0
- package/dist/components/Scroll/styles.d.ts +4 -0
- package/dist/components/Scroll/styles.js +27 -0
- package/dist/components/Scroll/styles.js.map +1 -0
- package/dist/components/Sections/index.d.ts +11 -0
- package/dist/components/{Sections.js → Sections/index.js} +4 -5
- package/dist/components/Sections/index.js.map +1 -0
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/styles.d.ts +6 -6
- package/dist/components/Select/index.d.ts +8 -0
- package/dist/components/Select/index.js +38 -80
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.d.ts +57 -7
- package/dist/components/Select/styles.js +14 -41
- package/dist/components/Select/styles.js.map +1 -1
- package/dist/components/Select/types.d.ts +16 -25
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +4 -0
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.d.ts +53 -0
- package/dist/components/Slider/styles.js +61 -0
- package/dist/components/Slider/styles.js.map +1 -0
- package/dist/components/Slider/types.d.ts +3 -2
- package/dist/components/{Switch.d.ts → Switch/index.d.ts} +3 -2
- package/dist/components/{Switch.js → Switch/index.js} +8 -4
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Switch/styles.d.ts +54 -0
- package/dist/components/Switch/styles.js +34 -0
- package/dist/components/Switch/styles.js.map +1 -0
- package/dist/components/{Text.d.ts → Text/index.d.ts} +5 -3
- package/dist/components/{Text.js → Text/index.js} +7 -3
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Text/styles.d.ts +65 -0
- package/dist/components/Text/styles.js +23 -0
- package/dist/components/Text/styles.js.map +1 -0
- package/dist/components/TextInput/Label.d.ts +9 -0
- package/dist/components/TextInput/Label.js +34 -0
- package/dist/components/TextInput/Label.js.map +1 -0
- package/dist/components/{TextInput.d.ts → TextInput/index.d.ts} +34 -41
- package/dist/components/{TextInput.js → TextInput/index.js} +51 -48
- package/dist/components/TextInput/index.js.map +1 -0
- package/dist/components/TextInput/styles.d.ts +62 -0
- package/dist/components/TextInput/styles.js +60 -0
- package/dist/components/TextInput/styles.js.map +1 -0
- package/dist/components/{Touchable.d.ts → Touchable/index.d.ts} +8 -4
- package/dist/components/{Touchable.js → Touchable/index.js} +59 -12
- package/dist/components/Touchable/index.js.map +1 -0
- package/dist/components/Touchable/styles.d.ts +53 -0
- package/dist/components/Touchable/styles.js +19 -0
- package/dist/components/Touchable/styles.js.map +1 -0
- package/dist/components/{View.d.ts → View/index.d.ts} +6 -0
- package/dist/components/View/index.js +99 -0
- package/dist/components/View/index.js.map +1 -0
- package/dist/components/View/styles.d.ts +54 -0
- package/dist/components/View/styles.js +29 -0
- package/dist/components/View/styles.js.map +1 -0
- package/dist/components/components.d.ts +10 -3
- package/dist/components/components.js +23 -3
- package/dist/components/components.js.map +1 -1
- package/dist/components/defaultStyles.d.ts +1364 -0
- package/dist/components/defaultStyles.js +63 -0
- package/dist/components/defaultStyles.js.map +1 -0
- package/dist/components/{_Modal → legacy/Modal}/index.d.ts +3 -3
- package/dist/components/{_Modal → legacy/Modal}/index.js +6 -6
- package/dist/components/legacy/Modal/index.js.map +1 -0
- package/dist/components/{_Modal → legacy/Modal}/styles.d.ts +6 -6
- package/dist/components/{_Modal → legacy/Modal}/styles.js +0 -0
- package/dist/components/legacy/Modal/styles.js.map +1 -0
- package/dist/components/legacy/Pager/index.d.ts +20 -0
- package/dist/components/legacy/Pager/index.js +168 -0
- package/dist/components/legacy/Pager/index.js.map +1 -0
- package/dist/components/legacy/Pager/styles.d.ts +54 -0
- package/dist/components/legacy/Pager/styles.js +44 -0
- package/dist/components/legacy/Pager/styles.js.map +1 -0
- package/dist/components/legacy/index.d.ts +2 -0
- package/dist/components/legacy/index.js +19 -0
- package/dist/components/legacy/index.js.map +1 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/modules/reactNavigation.d.ts +2 -0
- package/dist/modules/reactNavigation.js +16 -1
- package/dist/modules/reactNavigation.js.map +1 -1
- package/dist/modules/textInputMask.d.ts +1 -0
- package/dist/modules/textInputMask.js +15 -0
- package/dist/modules/textInputMask.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/KeyboardAware/index.d.ts +6 -0
- package/dist/utils/KeyboardAware/index.js +31 -0
- package/dist/utils/KeyboardAware/index.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.d.ts +3 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js +9 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.d.ts +65 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js +450 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.d.ts +7 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js +4 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.d.ts +3 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js +10 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.d.ts +3 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js +10 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js.map +1 -0
- package/dist/utils/KeyboardAware/types.d.ts +1 -0
- package/dist/utils/KeyboardAware/types.js +7 -0
- package/dist/utils/KeyboardAware/types.js.map +1 -0
- package/dist/utils/ModalManager/components.d.ts +10 -2
- package/dist/utils/ModalManager/components.js +39 -7
- package/dist/utils/ModalManager/components.js.map +1 -1
- package/dist/utils/ModalManager/context.d.ts +1 -0
- package/dist/utils/ModalManager/context.js +6 -0
- package/dist/utils/ModalManager/context.js.map +1 -1
- package/dist/utils/ModalManager/index.d.ts +3 -2
- package/dist/utils/ModalManager/index.js +1 -0
- package/dist/utils/ModalManager/index.js.map +1 -1
- package/dist/utils/PermissionManager/context.js +0 -7
- package/dist/utils/PermissionManager/context.js.map +1 -1
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +42 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.d.ts +5 -1
- package/dist/utils/misc.js +62 -1
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/notifications.d.ts +34 -0
- package/dist/utils/notifications.js +268 -0
- package/dist/utils/notifications.js.map +1 -0
- package/package.json +13 -4
- package/src/components/ActionIcon/index.tsx +31 -0
- package/src/components/ActionIcon/styles.ts +92 -0
- package/src/components/{ActivityIndicator.tsx → ActivityIndicator/index.tsx} +7 -3
- package/src/components/ActivityIndicator/styles.ts +68 -0
- package/src/components/AutoComplete/index.tsx +158 -0
- package/src/components/AutoComplete/styles.ts +49 -0
- package/src/components/{Backdrop.tsx → Backdrop/index.tsx} +9 -42
- package/src/components/Backdrop/styles.ts +33 -0
- package/src/components/{Button.tsx → Button/index.tsx} +64 -11
- package/src/components/Button/styles.ts +105 -0
- package/src/components/Calendar/index.tsx +65 -0
- package/src/components/Calendar/style.ts +35 -0
- package/src/components/Calendar/types.ts +102 -0
- package/src/components/Checkbox/index.tsx +6 -4
- package/src/components/Checkbox/styles.ts +3 -3
- package/src/components/{ContentView.tsx → ContentView/index.tsx} +11 -6
- package/src/components/ContentView/styles.ts +25 -0
- package/src/components/Drawer/index.tsx +24 -0
- package/src/components/Drawer/styles.ts +38 -0
- package/src/components/{EmptyPlaceholder.tsx → EmptyPlaceholder/index.tsx} +14 -7
- package/src/components/EmptyPlaceholder/styles.ts +58 -0
- package/src/components/{FileInput.tsx → FileInput/index.tsx} +19 -28
- package/src/components/FileInput/styles.ts +15 -0
- package/src/components/Grid/index.tsx +107 -0
- package/src/components/Grid/styles.ts +11 -0
- package/src/components/{Icon.tsx → Icon/index.tsx} +8 -3
- package/src/components/Icon/styles.ts +52 -0
- package/src/components/Image/index.tsx +88 -0
- package/src/components/Image/styles.ts +20 -0
- package/src/components/ImageView/Spotlight.tsx +158 -0
- package/src/components/ImageView/component.tsx +38 -0
- package/src/components/ImageView/index.ts +2 -0
- package/src/components/List/PaginationIndicator.tsx +71 -0
- package/src/components/List/index.tsx +108 -0
- package/src/components/List/styles.ts +15 -0
- package/src/components/Modal/index.tsx +75 -39
- package/src/components/Modal/styles.ts +7 -5
- package/src/components/MultiSelect/index.tsx +120 -0
- package/src/components/MultiSelect/styles.ts +25 -0
- package/src/components/MultiSelect/types.ts +39 -0
- package/src/components/Navigation/Navigation.tsx +1 -5
- package/src/components/Pager/index.tsx +81 -202
- package/src/components/Pager/styles.ts +58 -33
- package/src/components/RadioInput/index.tsx +5 -6
- package/src/components/RadioInput/styles.ts +8 -10
- package/src/components/{Scroll.tsx → Scroll/index.tsx} +22 -24
- package/src/components/Scroll/styles.ts +18 -0
- package/src/components/{Sections.tsx → Sections/index.tsx} +5 -15
- package/src/components/SegmentedControl/index.tsx +1 -1
- package/src/components/Select/index.tsx +74 -139
- package/src/components/Select/styles.ts +42 -74
- package/src/components/Select/types.ts +16 -23
- package/src/components/Slider/index.tsx +2 -0
- package/src/components/Slider/styles.ts +75 -0
- package/src/components/Slider/types.ts +7 -2
- package/src/components/{Switch.tsx → Switch/index.tsx} +9 -4
- package/src/components/Switch/styles.ts +37 -0
- package/src/components/{Text.tsx → Text/index.tsx} +7 -3
- package/src/components/Text/styles.ts +34 -0
- package/src/components/TextInput/Label.tsx +26 -0
- package/src/components/{TextInput.tsx → TextInput/index.tsx} +84 -70
- package/src/components/TextInput/styles.ts +120 -0
- package/src/components/Touchable/index.tsx +133 -0
- package/src/components/Touchable/styles.ts +16 -0
- package/src/components/View/index.tsx +89 -0
- package/src/components/View/styles.ts +24 -0
- package/src/components/components.ts +14 -4
- package/src/components/defaultStyles.ts +60 -0
- package/src/components/{_Modal → legacy/Modal}/index.tsx +7 -7
- package/src/components/{_Modal → legacy/Modal}/styles.ts +0 -0
- package/src/components/legacy/Pager/index.tsx +242 -0
- package/src/components/legacy/Pager/styles.ts +51 -0
- package/src/components/legacy/index.ts +2 -0
- package/src/index.ts +4 -9
- package/src/modules/reactNavigation.ts +11 -0
- package/src/modules/textInputMask.ts +2 -0
- package/src/types/index.ts +1 -0
- package/src/utils/KeyboardAware/index.ts +15 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareFlatList.ts +4 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +608 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +13 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareScrollView.ts +6 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareSectionList.ts +6 -0
- package/src/utils/KeyboardAware/types.ts +159 -0
- package/src/utils/ModalManager/components.tsx +57 -14
- package/src/utils/ModalManager/context.tsx +10 -0
- package/src/utils/ModalManager/index.ts +4 -1
- package/src/utils/PermissionManager/context.tsx +1 -7
- package/src/utils/index.ts +9 -0
- package/src/utils/misc.ts +61 -2
- package/src/utils/notifications.ts +206 -0
- package/dist/components/ActivityIndicator.js.map +0 -1
- package/dist/components/Backdrop.js.map +0 -1
- package/dist/components/Button.d.ts +0 -132
- package/dist/components/Button.js.map +0 -1
- package/dist/components/ContentView.js.map +0 -1
- package/dist/components/EmptyPlaceholder.js.map +0 -1
- package/dist/components/FileInput.js.map +0 -1
- package/dist/components/Gap.d.ts +0 -8
- package/dist/components/Gap.js +0 -60
- package/dist/components/Gap.js.map +0 -1
- package/dist/components/Icon.js.map +0 -1
- package/dist/components/Image.js.map +0 -1
- package/dist/components/List.js +0 -101
- package/dist/components/List.js.map +0 -1
- package/dist/components/NewModal/index.d.ts +0 -27
- package/dist/components/NewModal/index.js +0 -99
- package/dist/components/NewModal/index.js.map +0 -1
- package/dist/components/NewModal/styles.js +0 -58
- package/dist/components/NewModal/styles.js.map +0 -1
- package/dist/components/NewPager/index.d.ts +0 -26
- package/dist/components/NewPager/index.js +0 -88
- package/dist/components/NewPager/index.js.map +0 -1
- package/dist/components/NewPager/styles.js +0 -70
- package/dist/components/NewPager/styles.js.map +0 -1
- package/dist/components/Overlay.d.ts +0 -16
- package/dist/components/Overlay.js +0 -74
- package/dist/components/Overlay.js.map +0 -1
- package/dist/components/Scroll.d.ts +0 -15
- package/dist/components/Scroll.js.map +0 -1
- package/dist/components/Sections.d.ts +0 -11
- package/dist/components/Sections.js.map +0 -1
- package/dist/components/SegmentedControl.d.ts +0 -5
- package/dist/components/SegmentedControl.js +0 -32
- package/dist/components/SegmentedControl.js.map +0 -1
- package/dist/components/Switch.js.map +0 -1
- package/dist/components/Text.js.map +0 -1
- package/dist/components/TextInput.js.map +0 -1
- package/dist/components/Touchable.js.map +0 -1
- package/dist/components/View.js.map +0 -1
- package/dist/components/_Modal/index.js.map +0 -1
- package/dist/components/_Modal/styles.js.map +0 -1
- package/dist/utils/PermissionManager/components.d.ts +0 -18
- package/dist/utils/PermissionManager/components.js +0 -52
- package/dist/utils/PermissionManager/components.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -1
- package/dist/utils/styles.js +0 -13
- package/dist/utils/styles.js.map +0 -1
- package/src/components/Gap.tsx +0 -40
- package/src/components/Image.tsx +0 -62
- package/src/components/List.tsx +0 -155
- package/src/components/NewPager/index.tsx +0 -121
- package/src/components/NewPager/styles.ts +0 -76
- package/src/components/Overlay.tsx +0 -86
- package/src/components/Touchable.tsx +0 -89
- package/src/components/View.tsx +0 -48
- package/src/utils/styles.ts +0 -14
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Type definitions for react-native-keyboard-aware-scroll-view
|
|
2
|
+
// Project: https://github.com/APSL/react-native-keyboard-aware-scroll-view
|
|
3
|
+
// Definitions by: Kyle Roach <https://github.com/iRoachie>
|
|
4
|
+
// TypeScript Version: 2.3.2
|
|
5
|
+
|
|
6
|
+
import * as React from 'react'
|
|
7
|
+
import {
|
|
8
|
+
ScrollViewProps,
|
|
9
|
+
FlatListProps,
|
|
10
|
+
SectionListProps,
|
|
11
|
+
} from 'react-native'
|
|
12
|
+
|
|
13
|
+
interface KeyboardAwareProps {
|
|
14
|
+
/**
|
|
15
|
+
* Catches the reference of the component.
|
|
16
|
+
*
|
|
17
|
+
*
|
|
18
|
+
* @type {function}
|
|
19
|
+
* @memberof KeyboardAwareProps
|
|
20
|
+
*/
|
|
21
|
+
innerRef?: (ref: JSX.Element) => void
|
|
22
|
+
/**
|
|
23
|
+
* Adds an extra offset that represents the TabBarIOS height.
|
|
24
|
+
*
|
|
25
|
+
* Default is false
|
|
26
|
+
* @type {boolean}
|
|
27
|
+
* @memberof KeyboardAwareProps
|
|
28
|
+
*/
|
|
29
|
+
viewIsInsideTabBar?: boolean
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Coordinates that will be used to reset the scroll when the keyboard hides.
|
|
33
|
+
*
|
|
34
|
+
* @type {{
|
|
35
|
+
* x: number,
|
|
36
|
+
* y: number
|
|
37
|
+
* }}
|
|
38
|
+
* @memberof KeyboardAwareProps
|
|
39
|
+
*/
|
|
40
|
+
resetScrollToCoords?: {
|
|
41
|
+
x: number
|
|
42
|
+
y: number
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Lets the user enable or disable automatic resetScrollToCoords
|
|
47
|
+
*
|
|
48
|
+
* @type {boolean}
|
|
49
|
+
* @memberof KeyboardAwareProps
|
|
50
|
+
*/
|
|
51
|
+
enableResetScrollToCoords?: boolean
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* When focus in TextInput will scroll the position
|
|
55
|
+
*
|
|
56
|
+
* Default is true
|
|
57
|
+
*
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
* @memberof KeyboardAwareProps
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
enableAutomaticScroll?: boolean
|
|
63
|
+
/**
|
|
64
|
+
* Enables keyboard aware settings for Android
|
|
65
|
+
*
|
|
66
|
+
* Default is false
|
|
67
|
+
*
|
|
68
|
+
* @type {boolean}
|
|
69
|
+
* @memberof KeyboardAwareProps
|
|
70
|
+
*/
|
|
71
|
+
enableOnAndroid?: boolean
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Adds an extra offset when focusing the TextInputs.
|
|
75
|
+
*
|
|
76
|
+
* Default is 75
|
|
77
|
+
* @type {number}
|
|
78
|
+
* @memberof KeyboardAwareProps
|
|
79
|
+
*/
|
|
80
|
+
extraHeight?: number
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Adds an extra offset to the keyboard.
|
|
84
|
+
* Useful if you want to stick elements above the keyboard.
|
|
85
|
+
*
|
|
86
|
+
* Default is 0
|
|
87
|
+
*
|
|
88
|
+
* @type {number}
|
|
89
|
+
* @memberof KeyboardAwareProps
|
|
90
|
+
*/
|
|
91
|
+
extraScrollHeight?: number
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Sets the delay time before scrolling to new position
|
|
95
|
+
*
|
|
96
|
+
* Default is 250
|
|
97
|
+
*
|
|
98
|
+
* @type {number}
|
|
99
|
+
* @memberof KeyboardAwareProps
|
|
100
|
+
*/
|
|
101
|
+
keyboardOpeningTime?: number
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Callback when the keyboard will show.
|
|
105
|
+
*
|
|
106
|
+
* @param frames Information about the keyboard frame and animation.
|
|
107
|
+
*/
|
|
108
|
+
onKeyboardWillShow?: (frames: Object) => void
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Callback when the keyboard did show.
|
|
112
|
+
*
|
|
113
|
+
* @param frames Information about the keyboard frame and animation.
|
|
114
|
+
*/
|
|
115
|
+
onKeyboardDidShow?: (frames: Object) => void
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Callback when the keyboard will hide.
|
|
119
|
+
*
|
|
120
|
+
* @param frames Information about the keyboard frame and animation.
|
|
121
|
+
*/
|
|
122
|
+
onKeyboardWillHide?: (frames: Object) => void
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Callback when the keyboard did hide.
|
|
126
|
+
*
|
|
127
|
+
* @param frames Information about the keyboard frame and animation.
|
|
128
|
+
*/
|
|
129
|
+
onKeyboardDidHide?: (frames: Object) => void
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Callback when the keyboard frame will change.
|
|
133
|
+
*
|
|
134
|
+
* @param frames Information about the keyboard frame and animation.
|
|
135
|
+
*/
|
|
136
|
+
onKeyboardWillChangeFrame?: (frames: Object) => void
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Callback when the keyboard frame did change.
|
|
140
|
+
*
|
|
141
|
+
* @param frames Information about the keyboard frame and animation.
|
|
142
|
+
*/
|
|
143
|
+
onKeyboardDidChangeFrame?: (frames: Object) => void
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface KeyboardAwareScrollViewProps
|
|
147
|
+
extends KeyboardAwareProps,
|
|
148
|
+
ScrollViewProps {}
|
|
149
|
+
interface KeyboardAwareFlatListProps<ItemT>
|
|
150
|
+
extends KeyboardAwareProps,
|
|
151
|
+
FlatListProps<ItemT> {}
|
|
152
|
+
interface KeyboardAwareSectionListProps<ItemT>
|
|
153
|
+
extends KeyboardAwareProps,
|
|
154
|
+
SectionListProps<ItemT> {}
|
|
155
|
+
|
|
156
|
+
interface KeyboardAwareState {
|
|
157
|
+
keyboardSpace: number
|
|
158
|
+
}
|
|
159
|
+
|
|
@@ -3,25 +3,22 @@ import { usePrevious, onMount, onUpdate, PropsOf } from '@codeleap/common'
|
|
|
3
3
|
import { useModalContext } from './context'
|
|
4
4
|
import { Portal } from '@gorhom/portal'
|
|
5
5
|
import { Modal as _Modal } from '../../components/Modal'
|
|
6
|
+
import { Drawer as _Drawer } from '../../components/Drawer'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type UseManagedModalArgs = {
|
|
8
9
|
id?: string
|
|
9
10
|
initialVisible ?: boolean
|
|
10
11
|
parent?: string
|
|
11
|
-
absolute?: boolean
|
|
12
12
|
visible?: boolean
|
|
13
13
|
toggle?: PropsOf<typeof _Modal>['toggle']
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...props
|
|
23
|
-
}) => {
|
|
24
|
-
|
|
16
|
+
function useManagedModal(props:UseManagedModalArgs) {
|
|
17
|
+
const {
|
|
18
|
+
initialVisible = false,
|
|
19
|
+
parent,
|
|
20
|
+
id,
|
|
21
|
+
} = props
|
|
25
22
|
const modalId = id
|
|
26
23
|
const modals = useModalContext()
|
|
27
24
|
|
|
@@ -46,14 +43,33 @@ export const Modal:React.FC<ManagedModalProps> = ({
|
|
|
46
43
|
const visible = modalId ? modals.isVisible(modalId) : props.visible
|
|
47
44
|
|
|
48
45
|
const ctxProps = modals?.state?.[modalId]?.props
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
|
|
47
|
+
const componentProps = {
|
|
48
|
+
...props, ...ctxProps, visible: visible, toggle: () => {
|
|
51
49
|
if (modalId) {
|
|
52
50
|
modals.toggleModal(modalId)
|
|
53
51
|
} else {
|
|
54
52
|
props?.toggle?.()
|
|
55
53
|
}
|
|
56
|
-
}
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return componentProps
|
|
58
|
+
}
|
|
59
|
+
export type ManagedModalProps<T = PropsOf<typeof _Modal>> = Omit<T, 'visible' | 'toggle'> & UseManagedModalArgs & {
|
|
60
|
+
|
|
61
|
+
absolute?: boolean
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
export const Modal:React.FC<ManagedModalProps> = ({
|
|
65
|
+
children,
|
|
66
|
+
absolute = true,
|
|
67
|
+
...props
|
|
68
|
+
}) => {
|
|
69
|
+
const componentProps = useManagedModal(props)
|
|
70
|
+
|
|
71
|
+
const content = (
|
|
72
|
+
<_Modal {...componentProps}>
|
|
57
73
|
{children}
|
|
58
74
|
</_Modal>
|
|
59
75
|
)
|
|
@@ -67,3 +83,30 @@ export const Modal:React.FC<ManagedModalProps> = ({
|
|
|
67
83
|
return content
|
|
68
84
|
}
|
|
69
85
|
|
|
86
|
+
export type ManagedDrawerProps<T = PropsOf<typeof _Drawer>> = Omit<T, 'visible' | 'toggle'> & UseManagedModalArgs & {
|
|
87
|
+
|
|
88
|
+
absolute?: boolean
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const Drawer:React.FC<ManagedDrawerProps> = ({
|
|
93
|
+
children,
|
|
94
|
+
absolute = true,
|
|
95
|
+
...props
|
|
96
|
+
}) => {
|
|
97
|
+
const componentProps = useManagedModal(props)
|
|
98
|
+
|
|
99
|
+
const content = (
|
|
100
|
+
<_Drawer {...componentProps}>
|
|
101
|
+
{children}
|
|
102
|
+
</_Drawer>
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if (absolute) {
|
|
106
|
+
return <Portal>
|
|
107
|
+
{content}
|
|
108
|
+
</Portal>
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return content
|
|
112
|
+
}
|
|
@@ -23,6 +23,7 @@ type TModalContext = {
|
|
|
23
23
|
isVisible: (name: string) => boolean
|
|
24
24
|
transition: (from: string, to: string, options?: ModalTransitionOptions) => Promise<void>
|
|
25
25
|
attach: (modal: string, to: string) => void
|
|
26
|
+
remove(name: string): void
|
|
26
27
|
transitionDuration: number
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -127,6 +128,14 @@ export function Provider({ children }) {
|
|
|
127
128
|
})
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
function remove(id: string) {
|
|
132
|
+
const newModals = { ...modals }
|
|
133
|
+
|
|
134
|
+
delete newModals[id]
|
|
135
|
+
|
|
136
|
+
setModals(newModals)
|
|
137
|
+
}
|
|
138
|
+
|
|
130
139
|
return <ModalContext.Provider value={{
|
|
131
140
|
state: modals,
|
|
132
141
|
toggleModal,
|
|
@@ -134,6 +143,7 @@ export function Provider({ children }) {
|
|
|
134
143
|
currentModal,
|
|
135
144
|
attach,
|
|
136
145
|
isVisible,
|
|
146
|
+
remove,
|
|
137
147
|
transition,
|
|
138
148
|
transitionDuration: defaultDuration,
|
|
139
149
|
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useModalContext, useModalSequence, Provider } from './context'
|
|
2
|
-
import { Modal, ManagedModalProps } from './components'
|
|
2
|
+
import { Modal, ManagedModalProps, Drawer, ManagedDrawerProps } from './components'
|
|
3
3
|
|
|
4
4
|
export const ModalManager = {
|
|
5
5
|
useModalContext,
|
|
6
6
|
Modal,
|
|
7
|
+
Drawer,
|
|
7
8
|
Provider,
|
|
8
9
|
useModalSequence,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export type {
|
|
12
13
|
ManagedModalProps,
|
|
14
|
+
ManagedDrawerProps,
|
|
15
|
+
|
|
13
16
|
}
|
|
@@ -127,11 +127,7 @@ export const usePermissions:UsePermissions<any> = () => {
|
|
|
127
127
|
|
|
128
128
|
onOpen = () => new Promise((resolve) => {
|
|
129
129
|
setTimeout(() => {
|
|
130
|
-
console.log('transition', {
|
|
131
|
-
prevModal,
|
|
132
|
-
permissionModalName,
|
|
133
130
|
|
|
134
|
-
})
|
|
135
131
|
modalCtx.transition(prevModal, permissionModalName, {
|
|
136
132
|
props: {
|
|
137
133
|
onPermissionResolve: (status) => {
|
|
@@ -163,9 +159,7 @@ export const usePermissions:UsePermissions<any> = () => {
|
|
|
163
159
|
}
|
|
164
160
|
}
|
|
165
161
|
if (prevModal) {
|
|
166
|
-
|
|
167
|
-
prevModal,
|
|
168
|
-
})
|
|
162
|
+
|
|
169
163
|
setTimeout(() => {
|
|
170
164
|
modalCtx.toggleModal(prevModal, false, {})
|
|
171
165
|
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as OSAlert } from './OSAlert'
|
|
2
|
+
export * from './hooks'
|
|
3
|
+
export * from './misc'
|
|
4
|
+
export * from './notifications'
|
|
5
|
+
export * from './ModalManager'
|
|
6
|
+
import * as Permissions from './PermissionManager'
|
|
7
|
+
|
|
8
|
+
export { Permissions }
|
|
9
|
+
export * from './KeyboardAware'
|
package/src/utils/misc.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MobileInputFile, parseFilePathData } from '@codeleap/common'
|
|
1
|
+
import { MobileFile, MobileInputFile, parseFilePathData, FileWithPreview } from '@codeleap/common'
|
|
2
2
|
|
|
3
3
|
export const stringToFile = (str: string): MobileInputFile => {
|
|
4
4
|
if (!str) {
|
|
@@ -9,7 +9,7 @@ export const stringToFile = (str: string): MobileInputFile => {
|
|
|
9
9
|
}
|
|
10
10
|
const fileData = parseFilePathData(str)
|
|
11
11
|
|
|
12
|
-
const data:
|
|
12
|
+
const data: MobileFile = {
|
|
13
13
|
name: fileData.name,
|
|
14
14
|
type: 'image/' + fileData.extension,
|
|
15
15
|
size: 1000,
|
|
@@ -22,3 +22,62 @@ export const stringToFile = (str: string): MobileInputFile => {
|
|
|
22
22
|
preview: data.uri,
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
export function toMultipartFile(file: MobileInputFile) {
|
|
27
|
+
// const inputFile = file as MobileInputFile
|
|
28
|
+
const withPreview = file as FileWithPreview
|
|
29
|
+
if (!!withPreview?.file) {
|
|
30
|
+
return withPreview.file
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return file as MobileFile
|
|
34
|
+
// const fileData:MobileFile = ? inputFile.file : (file as RNFile)
|
|
35
|
+
// // const extension = parseFilePathData(fileData.uri).extension
|
|
36
|
+
// // const isImage =DocumentPicker..includes(extension)
|
|
37
|
+
// return fileData as unknown as Blob
|
|
38
|
+
// // if (isImage) {
|
|
39
|
+
// // return {
|
|
40
|
+
// // uri: fileData.uri,
|
|
41
|
+
// // name: `image_${fileData.uri}`,
|
|
42
|
+
// // type: `image/${extension}`,
|
|
43
|
+
// // } as unknown as Blob
|
|
44
|
+
// // } else {
|
|
45
|
+
// // return fileData as unknown as Blob
|
|
46
|
+
// // }
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function isFile(param:any): param is MobileInputFile {
|
|
50
|
+
|
|
51
|
+
let file = param
|
|
52
|
+
try {
|
|
53
|
+
if (typeof param?.preview !== 'undefined' && typeof param?.file !== 'undefined') {
|
|
54
|
+
file = param.file
|
|
55
|
+
}
|
|
56
|
+
const keys = Object.keys(file)
|
|
57
|
+
|
|
58
|
+
return ['uri', 'name', 'type'].every(key => keys.includes(key))
|
|
59
|
+
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function toMultipart(body) {
|
|
66
|
+
const form = new FormData()
|
|
67
|
+
|
|
68
|
+
for (const [key, value] of Object.entries(body)) {
|
|
69
|
+
let formValue = null
|
|
70
|
+
if (Array.isArray(value) && value.every(isFile)) {
|
|
71
|
+
formValue = value.map((file) => form.append(key, toMultipartFile(file)))
|
|
72
|
+
} else if (isFile(value)) {
|
|
73
|
+
formValue = toMultipartFile(value)
|
|
74
|
+
} else if (typeof value === 'object') {
|
|
75
|
+
formValue = JSON.stringify(value)
|
|
76
|
+
} else {
|
|
77
|
+
formValue = String(value) as string
|
|
78
|
+
}
|
|
79
|
+
form.append(key, formValue)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return form
|
|
83
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { FunctionType, silentLogger } from '@codeleap/common'
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import { firebase, FirebaseMessagingTypes } from '@react-native-firebase/messaging'
|
|
4
|
+
|
|
5
|
+
const messaging = firebase.messaging
|
|
6
|
+
|
|
7
|
+
const MODULE = 'Notifications'
|
|
8
|
+
|
|
9
|
+
export type Message = FirebaseMessagingTypes.RemoteMessage
|
|
10
|
+
export type MessageType = 'foreground' | 'background' | 'press' | 'initial'
|
|
11
|
+
|
|
12
|
+
export type NotificationHandler = FunctionType<[message: Message, type: MessageType], any>
|
|
13
|
+
|
|
14
|
+
export type HandleNotificationParam = {
|
|
15
|
+
data: Message
|
|
16
|
+
type: MessageType
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type NotificationStateChangeListener = FunctionType<[isInitialized: boolean, token?: string], any>
|
|
20
|
+
export class NotificationManager {
|
|
21
|
+
|
|
22
|
+
stateChangeListeners:NotificationStateChangeListener[] = []
|
|
23
|
+
|
|
24
|
+
messageListeners:NotificationHandler[] = []
|
|
25
|
+
|
|
26
|
+
_initialized = false
|
|
27
|
+
|
|
28
|
+
unsubscribeFromMessage = null
|
|
29
|
+
|
|
30
|
+
unsubscribeFromBackgroundMessage = null
|
|
31
|
+
|
|
32
|
+
unsubscribeFromPress = null
|
|
33
|
+
|
|
34
|
+
_currentToken = null
|
|
35
|
+
|
|
36
|
+
_initialNoficationHandled = false
|
|
37
|
+
|
|
38
|
+
constructor(private logger = silentLogger, public autoHandleInitialNotification = true) {
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async init() {
|
|
42
|
+
// return
|
|
43
|
+
if (this.initialized) return
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
|
|
47
|
+
await messaging().registerDeviceForRemoteMessages()
|
|
48
|
+
// logger.log('firebase registeted', '', MODULE)
|
|
49
|
+
|
|
50
|
+
const token = await messaging().getToken()
|
|
51
|
+
// logger.log('init token', { token }, MODULE)
|
|
52
|
+
|
|
53
|
+
if (token) {
|
|
54
|
+
this.currentToken = token
|
|
55
|
+
|
|
56
|
+
this.initialized = true
|
|
57
|
+
} else {
|
|
58
|
+
this.currentToken = null
|
|
59
|
+
this.initialized = false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
messaging().onTokenRefresh(newToken => {
|
|
63
|
+
// logger.log('onTokenRefresh', { newToken }, MODULE)
|
|
64
|
+
if (token) {
|
|
65
|
+
this.currentToken = newToken
|
|
66
|
+
|
|
67
|
+
this.initialized = true
|
|
68
|
+
} else {
|
|
69
|
+
this.currentToken = null
|
|
70
|
+
this.initialized = false
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
})
|
|
74
|
+
// logger.log('init success', {}, MODULE)
|
|
75
|
+
} catch (e) {
|
|
76
|
+
this.logger.error('Failed to initialize notification services', e, MODULE)
|
|
77
|
+
// OSAlert.error({ title: 'Failed to initialize notification services' })
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async deinit() {
|
|
82
|
+
[
|
|
83
|
+
this.unsubscribeFromMessage,
|
|
84
|
+
this.unsubscribeFromBackgroundMessage,
|
|
85
|
+
this.unsubscribeFromPress,
|
|
86
|
+
].forEach(unsubscribe => {
|
|
87
|
+
if (unsubscribe) {
|
|
88
|
+
unsubscribe()
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
this.initialized = false
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private async handleNotification(args:HandleNotificationParam) {
|
|
96
|
+
for (const listener of this.messageListeners) {
|
|
97
|
+
await listener(args.data, args.type)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
get currentToken() {
|
|
102
|
+
return this._currentToken
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
set currentToken(token: string) {
|
|
106
|
+
this._currentToken = token
|
|
107
|
+
this.triggerStateChange()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
get initialized() {
|
|
111
|
+
return this._initialized
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
set initialized(to:boolean) {
|
|
115
|
+
|
|
116
|
+
if (to) {
|
|
117
|
+
this.logger.log('Initialized', '', MODULE)
|
|
118
|
+
this.unsubscribeFromMessage = messaging().onMessage((msg) => {
|
|
119
|
+
this.handleNotification({
|
|
120
|
+
data: msg,
|
|
121
|
+
type: 'foreground',
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
this.unsubscribeFromBackgroundMessage = messaging().setBackgroundMessageHandler(async (msg) => {
|
|
126
|
+
this.handleNotification({
|
|
127
|
+
data: msg,
|
|
128
|
+
type: 'background',
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
this.unsubscribeFromPress = messaging().onNotificationOpenedApp(msg => {
|
|
133
|
+
this.logger.log('Notification press', msg, MODULE)
|
|
134
|
+
this.handleNotification({
|
|
135
|
+
data: msg,
|
|
136
|
+
type: 'press',
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
if (!this._initialNoficationHandled && this.autoHandleInitialNotification) {
|
|
141
|
+
this.getInitialNotification().then(msg => {
|
|
142
|
+
if (!msg.data) return
|
|
143
|
+
this.logger.log('Notification initial', msg, MODULE)
|
|
144
|
+
this.handleNotification(msg).then(() => {
|
|
145
|
+
this._initialNoficationHandled = true
|
|
146
|
+
}).catch(e => {
|
|
147
|
+
this._initialNoficationHandled = true
|
|
148
|
+
this.logger.error('Error handling initial notification', e, MODULE)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
}
|
|
152
|
+
} else {
|
|
153
|
+
this.unsubscribeFromMessage = null
|
|
154
|
+
|
|
155
|
+
this.unsubscribeFromBackgroundMessage = null
|
|
156
|
+
|
|
157
|
+
this.unsubscribeFromPress = null
|
|
158
|
+
|
|
159
|
+
this.logger.log('Deinitialized', '', MODULE)
|
|
160
|
+
}
|
|
161
|
+
this._initialized = to
|
|
162
|
+
|
|
163
|
+
this.triggerStateChange()
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
onNotification(handler:NotificationHandler) {
|
|
167
|
+
const newLen = this.messageListeners.push(handler)
|
|
168
|
+
|
|
169
|
+
return () => {
|
|
170
|
+
this.messageListeners.splice(newLen - 1)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
private triggerStateChange() {
|
|
175
|
+
this.stateChangeListeners.forEach(l => {
|
|
176
|
+
l(this._initialized, this.currentToken)
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
onStateChange(handler:NotificationStateChangeListener) {
|
|
181
|
+
const newLen = this.stateChangeListeners.push(handler)
|
|
182
|
+
|
|
183
|
+
return () => {
|
|
184
|
+
this.stateChangeListeners.splice(newLen - 1)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async getInitialNotification():Promise<HandleNotificationParam> {
|
|
190
|
+
try {
|
|
191
|
+
|
|
192
|
+
const msg = await messaging().getInitialNotification()
|
|
193
|
+
return {
|
|
194
|
+
data: msg as Message,
|
|
195
|
+
type: 'initial',
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
} catch (e) {
|
|
199
|
+
return {
|
|
200
|
+
data: null,
|
|
201
|
+
type: 'initial',
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActivityIndicator.js","sourceRoot":"","sources":["../../src/components/ActivityIndicator.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA8B;AAC9B,+BAA4D;AAC5D,6CAAyE;AACzE,2CAMyB;AAUZ,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EACzC,UAAC,sBAAsB,EAAE,GAAG;IAClB,IAAA,KAAuD,sBAAsB,SAAhE,EAAb,QAAQ,mBAAG,EAAE,KAAA,EAAE,KAAK,GAAmC,sBAAsB,MAAzD,EAAU,UAAU,GAAe,sBAAsB,OAArC,EAAK,KAAK,UAAK,sBAAsB,EAA/E,+BAAsD,CAAF,CAA2B;IAErF,IAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,mBAAmB,EAAE;QAClE,QAAQ,UAAA;QACR,SAAS,EAAE,yBAAU,CAAC,OAAO;QAC7B,MAAM,EAAE,UAAU;KACnB,CAAC,CAAA;IAEM,IAAA,KAAK,GAAK,IAAA,2BAAkB,GAAE,MAAzB,CAAyB;IAEtC,IAAM,MAAM,GAAG,yBAAU,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IACjE,IAAM,KAAK,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,KAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAA;IAChD,IAAM,IAAI,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,MAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAA,IAAI,OAAO,CAAA;IAEvD,OAAO,CACL,CAAC,gCAAS,CACR,IAAI,CAAC,CAAC,IAAI,CAAC,CACX,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,KAAK,CAAC,CAAC,MAAM,CAAC,CACd,IAAI,KAAK,CAAC,EACV,CACH,CAAA;AACH,CAAC,CACF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Backdrop.js","sourceRoot":"","sources":["../../src/components/Backdrop.tsx"],"names":[],"mappings":"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"}
|