@sendbird/uikit-react-native-foundation 2.5.0 → 3.0.0-rc.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 (123) hide show
  1. package/README.md +4 -0
  2. package/lib/commonjs/components/Image/FastImageInternal.js +13 -0
  3. package/lib/commonjs/components/Image/FastImageInternal.js.map +1 -0
  4. package/lib/commonjs/components/Image/Image.fastimage.js +2 -5
  5. package/lib/commonjs/components/Image/Image.fastimage.js.map +1 -1
  6. package/lib/commonjs/components/ImageWithPlaceholder/index.js +7 -1
  7. package/lib/commonjs/components/ImageWithPlaceholder/index.js.map +1 -1
  8. package/lib/commonjs/components/RegexText/index.js.map +1 -1
  9. package/lib/commonjs/index.js +8 -8
  10. package/lib/commonjs/index.js.map +1 -1
  11. package/lib/commonjs/types.js.map +1 -1
  12. package/lib/commonjs/ui/Avatar/AvatarGroup.js +1 -1
  13. package/lib/commonjs/ui/Avatar/AvatarGroup.js.map +1 -1
  14. package/lib/commonjs/ui/GroupChannelMessage/Message.admin.js +37 -0
  15. package/lib/commonjs/ui/GroupChannelMessage/Message.admin.js.map +1 -0
  16. package/lib/commonjs/ui/GroupChannelMessage/Message.file.image.js +54 -0
  17. package/lib/commonjs/ui/GroupChannelMessage/Message.file.image.js.map +1 -0
  18. package/lib/commonjs/ui/GroupChannelMessage/Message.file.js +80 -0
  19. package/lib/commonjs/ui/GroupChannelMessage/Message.file.js.map +1 -0
  20. package/lib/commonjs/ui/GroupChannelMessage/Message.file.video.js +120 -0
  21. package/lib/commonjs/ui/GroupChannelMessage/Message.file.video.js.map +1 -0
  22. package/lib/commonjs/ui/GroupChannelMessage/Message.unknown.js +54 -0
  23. package/lib/commonjs/ui/GroupChannelMessage/Message.unknown.js.map +1 -0
  24. package/lib/commonjs/ui/GroupChannelMessage/Message.user.js +44 -0
  25. package/lib/commonjs/ui/GroupChannelMessage/Message.user.js.map +1 -0
  26. package/lib/commonjs/ui/GroupChannelMessage/Message.user.og.js +59 -0
  27. package/lib/commonjs/ui/GroupChannelMessage/Message.user.og.js.map +1 -0
  28. package/lib/commonjs/ui/GroupChannelMessage/MessageBubbleWithText.js +74 -0
  29. package/lib/commonjs/ui/GroupChannelMessage/MessageBubbleWithText.js.map +1 -0
  30. package/lib/commonjs/ui/GroupChannelMessage/MessageContainer.js +110 -0
  31. package/lib/commonjs/ui/GroupChannelMessage/MessageContainer.js.map +1 -0
  32. package/lib/commonjs/ui/GroupChannelMessage/MessageOpenGraph.js +91 -0
  33. package/lib/commonjs/ui/GroupChannelMessage/MessageOpenGraph.js.map +1 -0
  34. package/lib/commonjs/ui/GroupChannelMessage/index.js +26 -0
  35. package/lib/commonjs/ui/GroupChannelMessage/index.js.map +1 -0
  36. package/lib/commonjs/ui/OpenChannelMessage/Message.user.js +1 -1
  37. package/lib/commonjs/ui/OpenChannelMessage/Message.user.js.map +1 -1
  38. package/lib/commonjs/ui/OpenChannelMessage/Message.user.og.js +5 -2
  39. package/lib/commonjs/ui/OpenChannelMessage/Message.user.og.js.map +1 -1
  40. package/lib/commonjs/ui/OpenChannelMessage/index.js.map +1 -1
  41. package/lib/module/components/Image/FastImageInternal.js +6 -0
  42. package/lib/module/components/Image/FastImageInternal.js.map +1 -0
  43. package/lib/module/components/Image/Image.fastimage.js +2 -5
  44. package/lib/module/components/Image/Image.fastimage.js.map +1 -1
  45. package/lib/module/components/ImageWithPlaceholder/index.js +7 -1
  46. package/lib/module/components/ImageWithPlaceholder/index.js.map +1 -1
  47. package/lib/module/components/RegexText/index.js.map +1 -1
  48. package/lib/module/index.js +2 -2
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/types.js.map +1 -1
  51. package/lib/module/ui/Avatar/AvatarGroup.js +1 -1
  52. package/lib/module/ui/Avatar/AvatarGroup.js.map +1 -1
  53. package/lib/module/ui/GroupChannelMessage/Message.admin.js +29 -0
  54. package/lib/module/ui/GroupChannelMessage/Message.admin.js.map +1 -0
  55. package/lib/module/ui/GroupChannelMessage/Message.file.image.js +46 -0
  56. package/lib/module/ui/GroupChannelMessage/Message.file.image.js.map +1 -0
  57. package/lib/module/ui/GroupChannelMessage/Message.file.js +72 -0
  58. package/lib/module/ui/GroupChannelMessage/Message.file.js.map +1 -0
  59. package/lib/module/ui/GroupChannelMessage/Message.file.video.js +110 -0
  60. package/lib/module/ui/GroupChannelMessage/Message.file.video.js.map +1 -0
  61. package/lib/module/ui/GroupChannelMessage/Message.unknown.js +46 -0
  62. package/lib/module/ui/GroupChannelMessage/Message.unknown.js.map +1 -0
  63. package/lib/module/ui/GroupChannelMessage/Message.user.js +36 -0
  64. package/lib/module/ui/GroupChannelMessage/Message.user.js.map +1 -0
  65. package/lib/module/ui/GroupChannelMessage/Message.user.og.js +51 -0
  66. package/lib/module/ui/GroupChannelMessage/Message.user.og.js.map +1 -0
  67. package/lib/module/ui/GroupChannelMessage/MessageBubbleWithText.js +66 -0
  68. package/lib/module/ui/GroupChannelMessage/MessageBubbleWithText.js.map +1 -0
  69. package/lib/module/ui/GroupChannelMessage/MessageContainer.js +102 -0
  70. package/lib/module/ui/GroupChannelMessage/MessageContainer.js.map +1 -0
  71. package/lib/module/ui/GroupChannelMessage/MessageOpenGraph.js +83 -0
  72. package/lib/module/ui/GroupChannelMessage/MessageOpenGraph.js.map +1 -0
  73. package/lib/module/ui/GroupChannelMessage/index.js +18 -0
  74. package/lib/module/ui/GroupChannelMessage/index.js.map +1 -0
  75. package/lib/module/ui/OpenChannelMessage/Message.user.js +1 -1
  76. package/lib/module/ui/OpenChannelMessage/Message.user.js.map +1 -1
  77. package/lib/module/ui/OpenChannelMessage/Message.user.og.js +5 -2
  78. package/lib/module/ui/OpenChannelMessage/Message.user.og.js.map +1 -1
  79. package/lib/module/ui/OpenChannelMessage/index.js.map +1 -1
  80. package/lib/typescript/src/components/Image/FastImageInternal.d.ts +3 -0
  81. package/lib/typescript/src/components/RegexText/index.d.ts +2 -2
  82. package/lib/typescript/src/index.d.ts +4 -2
  83. package/lib/typescript/src/types.d.ts +1 -9
  84. package/lib/typescript/src/ui/GroupChannelMessage/Message.admin.d.ts +4 -0
  85. package/lib/typescript/src/ui/GroupChannelMessage/Message.file.d.ts +5 -0
  86. package/lib/typescript/src/ui/GroupChannelMessage/Message.file.image.d.ts +4 -0
  87. package/lib/typescript/src/ui/GroupChannelMessage/Message.file.video.d.ts +9 -0
  88. package/lib/typescript/src/ui/GroupChannelMessage/Message.unknown.d.ts +4 -0
  89. package/lib/typescript/src/ui/GroupChannelMessage/Message.user.d.ts +9 -0
  90. package/lib/typescript/src/ui/GroupChannelMessage/Message.user.og.d.ts +9 -0
  91. package/lib/typescript/src/ui/GroupChannelMessage/MessageBubbleWithText.d.ts +10 -0
  92. package/lib/typescript/src/ui/GroupChannelMessage/MessageContainer.d.ts +9 -0
  93. package/lib/typescript/src/ui/GroupChannelMessage/MessageOpenGraph.d.ts +8 -0
  94. package/lib/typescript/src/ui/GroupChannelMessage/index.d.ts +191 -0
  95. package/lib/typescript/src/ui/OpenChannelMessage/index.d.ts +7 -7
  96. package/package.json +6 -6
  97. package/src/components/Image/FastImageInternal.tsx +9 -0
  98. package/src/components/Image/Image.fastimage.tsx +2 -7
  99. package/src/components/ImageWithPlaceholder/index.tsx +3 -2
  100. package/src/components/RegexText/index.tsx +2 -2
  101. package/src/index.ts +5 -2
  102. package/src/types.ts +1 -11
  103. package/src/ui/Avatar/AvatarGroup.tsx +1 -1
  104. package/src/ui/GroupChannelMessage/Message.admin.tsx +34 -0
  105. package/src/ui/GroupChannelMessage/Message.file.image.tsx +45 -0
  106. package/src/ui/GroupChannelMessage/Message.file.tsx +70 -0
  107. package/src/ui/GroupChannelMessage/Message.file.video.tsx +106 -0
  108. package/src/ui/GroupChannelMessage/Message.unknown.tsx +47 -0
  109. package/src/ui/GroupChannelMessage/Message.user.og.tsx +62 -0
  110. package/src/ui/GroupChannelMessage/Message.user.tsx +49 -0
  111. package/src/ui/GroupChannelMessage/MessageBubbleWithText.tsx +80 -0
  112. package/src/ui/GroupChannelMessage/MessageContainer.tsx +106 -0
  113. package/src/ui/GroupChannelMessage/MessageOpenGraph.tsx +84 -0
  114. package/src/ui/GroupChannelMessage/index.ts +48 -0
  115. package/src/ui/OpenChannelMessage/Message.user.og.tsx +6 -2
  116. package/src/ui/OpenChannelMessage/Message.user.tsx +1 -1
  117. package/src/ui/OpenChannelMessage/index.ts +1 -1
  118. package/lib/commonjs/components/URLParsedText/index.js +0 -46
  119. package/lib/commonjs/components/URLParsedText/index.js.map +0 -1
  120. package/lib/module/components/URLParsedText/index.js +0 -38
  121. package/lib/module/components/URLParsedText/index.js.map +0 -1
  122. package/lib/typescript/src/components/URLParsedText/index.d.ts +0 -8
  123. package/src/components/URLParsedText/index.tsx +0 -50
@@ -0,0 +1,191 @@
1
+ import type React from 'react';
2
+ import type { SendbirdGroupChannel, SendbirdMessage, SendbirdUser } from '@sendbird/uikit-utils';
3
+ export type GroupChannelMessageProps<T extends SendbirdMessage, AdditionalProps = unknown> = {
4
+ channel: SendbirdGroupChannel;
5
+ message: T;
6
+ variant?: 'outgoing' | 'incoming';
7
+ strings?: {
8
+ senderName?: string;
9
+ sentDate?: string;
10
+ edited?: string;
11
+ fileName?: string;
12
+ unknownTitle?: string;
13
+ unknownDescription?: string;
14
+ };
15
+ children?: React.ReactNode;
16
+ sendingStatus?: React.ReactNode;
17
+ groupedWithPrev: boolean;
18
+ groupedWithNext: boolean;
19
+ onPress?: () => void;
20
+ onLongPress?: () => void;
21
+ onPressAvatar?: () => void;
22
+ onPressURL?: (url: string) => void;
23
+ onPressMentionedUser?: (mentionedUser?: SendbirdUser) => void;
24
+ } & AdditionalProps;
25
+ declare const GroupChannelMessage: {
26
+ User: (props: {
27
+ channel: SendbirdGroupChannel;
28
+ message: import("@sendbird/chat/message").UserMessage;
29
+ variant?: "incoming" | "outgoing" | undefined;
30
+ strings?: {
31
+ senderName?: string | undefined;
32
+ sentDate?: string | undefined;
33
+ edited?: string | undefined;
34
+ fileName?: string | undefined;
35
+ unknownTitle?: string | undefined;
36
+ unknownDescription?: string | undefined;
37
+ } | undefined;
38
+ children?: React.ReactNode;
39
+ sendingStatus?: React.ReactNode;
40
+ groupedWithPrev: boolean;
41
+ groupedWithNext: boolean;
42
+ onPress?: (() => void) | undefined;
43
+ onLongPress?: (() => void) | undefined;
44
+ onPressAvatar?: (() => void) | undefined;
45
+ onPressURL?: ((url: string) => void) | undefined;
46
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
47
+ } & {
48
+ regexTextPatterns?: import("../..").RegexTextPattern[] | undefined;
49
+ renderRegexTextChildren?: ((message: import("@sendbird/chat/message").UserMessage) => string) | undefined;
50
+ }) => JSX.Element;
51
+ OpenGraphUser: (props: {
52
+ channel: SendbirdGroupChannel;
53
+ message: import("@sendbird/chat/message").UserMessage;
54
+ variant?: "incoming" | "outgoing" | undefined;
55
+ strings?: {
56
+ senderName?: string | undefined;
57
+ sentDate?: string | undefined;
58
+ edited?: string | undefined;
59
+ fileName?: string | undefined;
60
+ unknownTitle?: string | undefined;
61
+ unknownDescription?: string | undefined;
62
+ } | undefined;
63
+ children?: React.ReactNode;
64
+ sendingStatus?: React.ReactNode;
65
+ groupedWithPrev: boolean;
66
+ groupedWithNext: boolean;
67
+ onPress?: (() => void) | undefined;
68
+ onLongPress?: (() => void) | undefined;
69
+ onPressAvatar?: (() => void) | undefined;
70
+ onPressURL?: ((url: string) => void) | undefined;
71
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
72
+ } & {
73
+ regexTextPatterns?: import("../..").RegexTextPattern[] | undefined;
74
+ renderRegexTextChildren?: ((message: import("@sendbird/chat/message").UserMessage) => string) | undefined;
75
+ }) => JSX.Element;
76
+ File: (props: {
77
+ channel: SendbirdGroupChannel;
78
+ message: import("@sendbird/chat/message").FileMessage;
79
+ variant?: "incoming" | "outgoing" | undefined;
80
+ strings?: {
81
+ senderName?: string | undefined;
82
+ sentDate?: string | undefined;
83
+ edited?: string | undefined;
84
+ fileName?: string | undefined;
85
+ unknownTitle?: string | undefined;
86
+ unknownDescription?: string | undefined;
87
+ } | undefined;
88
+ children?: React.ReactNode;
89
+ sendingStatus?: React.ReactNode;
90
+ groupedWithPrev: boolean;
91
+ groupedWithNext: boolean;
92
+ onPress?: (() => void) | undefined;
93
+ onLongPress?: (() => void) | undefined;
94
+ onPressAvatar?: (() => void) | undefined;
95
+ onPressURL?: ((url: string) => void) | undefined;
96
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
97
+ }) => JSX.Element;
98
+ ImageFile: (props: {
99
+ channel: SendbirdGroupChannel;
100
+ message: import("@sendbird/chat/message").FileMessage;
101
+ variant?: "incoming" | "outgoing" | undefined;
102
+ strings?: {
103
+ senderName?: string | undefined;
104
+ sentDate?: string | undefined;
105
+ edited?: string | undefined;
106
+ fileName?: string | undefined;
107
+ unknownTitle?: string | undefined;
108
+ unknownDescription?: string | undefined;
109
+ } | undefined;
110
+ children?: React.ReactNode;
111
+ sendingStatus?: React.ReactNode;
112
+ groupedWithPrev: boolean;
113
+ groupedWithNext: boolean;
114
+ onPress?: (() => void) | undefined;
115
+ onLongPress?: (() => void) | undefined;
116
+ onPressAvatar?: (() => void) | undefined;
117
+ onPressURL?: ((url: string) => void) | undefined;
118
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
119
+ }) => JSX.Element;
120
+ VideoFile: (props: {
121
+ channel: SendbirdGroupChannel;
122
+ message: import("@sendbird/chat/message").FileMessage;
123
+ variant?: "incoming" | "outgoing" | undefined;
124
+ strings?: {
125
+ senderName?: string | undefined;
126
+ sentDate?: string | undefined;
127
+ edited?: string | undefined;
128
+ fileName?: string | undefined;
129
+ unknownTitle?: string | undefined;
130
+ unknownDescription?: string | undefined;
131
+ } | undefined;
132
+ children?: React.ReactNode;
133
+ sendingStatus?: React.ReactNode;
134
+ groupedWithPrev: boolean;
135
+ groupedWithNext: boolean;
136
+ onPress?: (() => void) | undefined;
137
+ onLongPress?: (() => void) | undefined;
138
+ onPressAvatar?: (() => void) | undefined;
139
+ onPressURL?: ((url: string) => void) | undefined;
140
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
141
+ } & {
142
+ fetchThumbnailFromVideoSource: (uri: string) => Promise<{
143
+ path: string;
144
+ } | null>;
145
+ }) => JSX.Element;
146
+ Admin: (props: {
147
+ channel: SendbirdGroupChannel;
148
+ message: import("@sendbird/chat/message").AdminMessage;
149
+ variant?: "incoming" | "outgoing" | undefined;
150
+ strings?: {
151
+ senderName?: string | undefined;
152
+ sentDate?: string | undefined;
153
+ edited?: string | undefined;
154
+ fileName?: string | undefined;
155
+ unknownTitle?: string | undefined;
156
+ unknownDescription?: string | undefined;
157
+ } | undefined;
158
+ children?: React.ReactNode;
159
+ sendingStatus?: React.ReactNode;
160
+ groupedWithPrev: boolean;
161
+ groupedWithNext: boolean;
162
+ onPress?: (() => void) | undefined;
163
+ onLongPress?: (() => void) | undefined;
164
+ onPressAvatar?: (() => void) | undefined;
165
+ onPressURL?: ((url: string) => void) | undefined;
166
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
167
+ }) => JSX.Element;
168
+ Unknown: (props: {
169
+ channel: SendbirdGroupChannel;
170
+ message: SendbirdMessage;
171
+ variant?: "incoming" | "outgoing" | undefined;
172
+ strings?: {
173
+ senderName?: string | undefined;
174
+ sentDate?: string | undefined;
175
+ edited?: string | undefined;
176
+ fileName?: string | undefined;
177
+ unknownTitle?: string | undefined;
178
+ unknownDescription?: string | undefined;
179
+ } | undefined;
180
+ children?: React.ReactNode;
181
+ sendingStatus?: React.ReactNode;
182
+ groupedWithPrev: boolean;
183
+ groupedWithNext: boolean;
184
+ onPress?: (() => void) | undefined;
185
+ onLongPress?: (() => void) | undefined;
186
+ onPressAvatar?: (() => void) | undefined;
187
+ onPressURL?: ((url: string) => void) | undefined;
188
+ onPressMentionedUser?: ((mentionedUser?: SendbirdUser) => void) | undefined;
189
+ }) => JSX.Element;
190
+ };
191
+ export default GroupChannelMessage;
@@ -16,7 +16,7 @@ export type OpenChannelMessageProps<T extends SendbirdMessage, AdditionalProps =
16
16
  onPress?: () => void;
17
17
  onLongPress?: () => void;
18
18
  onPressAvatar?: () => void;
19
- onPressURL?: () => void;
19
+ onPressURL?: (url: string) => void;
20
20
  } & AdditionalProps;
21
21
  declare const OpenChannelMessage: {
22
22
  User: (props: {
@@ -35,7 +35,7 @@ declare const OpenChannelMessage: {
35
35
  onPress?: (() => void) | undefined;
36
36
  onLongPress?: (() => void) | undefined;
37
37
  onPressAvatar?: (() => void) | undefined;
38
- onPressURL?: (() => void) | undefined;
38
+ onPressURL?: ((url: string) => void) | undefined;
39
39
  }) => JSX.Element;
40
40
  OpenGraphUser: (props: {
41
41
  channel: SendbirdOpenChannel;
@@ -53,7 +53,7 @@ declare const OpenChannelMessage: {
53
53
  onPress?: (() => void) | undefined;
54
54
  onLongPress?: (() => void) | undefined;
55
55
  onPressAvatar?: (() => void) | undefined;
56
- onPressURL?: (() => void) | undefined;
56
+ onPressURL?: ((url: string) => void) | undefined;
57
57
  }) => JSX.Element;
58
58
  File: (props: {
59
59
  channel: SendbirdOpenChannel;
@@ -71,7 +71,7 @@ declare const OpenChannelMessage: {
71
71
  onPress?: (() => void) | undefined;
72
72
  onLongPress?: (() => void) | undefined;
73
73
  onPressAvatar?: (() => void) | undefined;
74
- onPressURL?: (() => void) | undefined;
74
+ onPressURL?: ((url: string) => void) | undefined;
75
75
  }) => JSX.Element;
76
76
  ImageFile: (props: {
77
77
  channel: SendbirdOpenChannel;
@@ -89,7 +89,7 @@ declare const OpenChannelMessage: {
89
89
  onPress?: (() => void) | undefined;
90
90
  onLongPress?: (() => void) | undefined;
91
91
  onPressAvatar?: (() => void) | undefined;
92
- onPressURL?: (() => void) | undefined;
92
+ onPressURL?: ((url: string) => void) | undefined;
93
93
  }) => JSX.Element;
94
94
  VideoFile: (props: OpenChannelMessageProps<import("@sendbird/chat/message").FileMessage, {
95
95
  fetchThumbnailFromVideoSource: (uri: string) => Promise<{
@@ -112,7 +112,7 @@ declare const OpenChannelMessage: {
112
112
  onPress?: (() => void) | undefined;
113
113
  onLongPress?: (() => void) | undefined;
114
114
  onPressAvatar?: (() => void) | undefined;
115
- onPressURL?: (() => void) | undefined;
115
+ onPressURL?: ((url: string) => void) | undefined;
116
116
  }) => JSX.Element;
117
117
  Unknown: (props: {
118
118
  channel: SendbirdOpenChannel;
@@ -130,7 +130,7 @@ declare const OpenChannelMessage: {
130
130
  onPress?: (() => void) | undefined;
131
131
  onLongPress?: (() => void) | undefined;
132
132
  onPressAvatar?: (() => void) | undefined;
133
- onPressURL?: (() => void) | undefined;
133
+ onPressURL?: ((url: string) => void) | undefined;
134
134
  }) => JSX.Element;
135
135
  };
136
136
  export default OpenChannelMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-react-native-foundation",
3
- "version": "2.5.0",
3
+ "version": "3.0.0-rc.1",
4
4
  "description": "A foundational UI kit for building chat-enabled React Native apps.",
5
5
  "keywords": [
6
6
  "sendbird",
@@ -28,6 +28,7 @@
28
28
  "test": "jest",
29
29
  "build": "bob build",
30
30
  "clean": "del lib",
31
+ "publish:next": "npm publish --tag next",
31
32
  "generate-icons": "node src/assets/bundle-icons.js"
32
33
  },
33
34
  "repository": {
@@ -46,7 +47,7 @@
46
47
  "access": "public"
47
48
  },
48
49
  "dependencies": {
49
- "@sendbird/uikit-utils": "2.5.0"
50
+ "@sendbird/uikit-utils": "3.0.0-rc.1"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@types/react": "*",
@@ -59,8 +60,8 @@
59
60
  "typescript": "4.9.4"
60
61
  },
61
62
  "peerDependencies": {
62
- "react": ">=16.13.1",
63
- "react-native": ">=0.63.3",
63
+ "react": ">=17.0.2",
64
+ "react-native": ">=0.65.0",
64
65
  "react-native-fast-image": ">=8.5.11",
65
66
  "react-native-safe-area-context": ">=3.3.2"
66
67
  },
@@ -87,6 +88,5 @@
87
88
  "entryPoint": "./src/index.ts",
88
89
  "readmeFile": "./README.md",
89
90
  "displayName": "@sendbird/uikit-react-native-foundation"
90
- },
91
- "gitHead": "4e2d6a30075a8fb6cf2615c5c20d50a0d0ddfcda"
91
+ }
92
92
  }
@@ -0,0 +1,9 @@
1
+ import type { FastImageProps } from 'react-native-fast-image';
2
+
3
+ let FastImageInternal: (props: FastImageProps) => JSX.Element | null = () => null;
4
+
5
+ try {
6
+ FastImageInternal = require('react-native-fast-image') as (props: FastImageProps) => JSX.Element;
7
+ } catch {}
8
+
9
+ export default FastImageInternal;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { FastImageProps, ResizeMode, Source } from 'react-native-fast-image';
3
3
 
4
+ import FastImageInternal from './FastImageInternal';
4
5
  import type { SendbirdImageComponent, SendbirdImageProps } from './index';
5
6
 
6
7
  function convertCache(
@@ -53,12 +54,6 @@ function convertResizeMode(mode?: SendbirdImageProps['resizeMode']): ResizeMode
53
54
  }
54
55
  }
55
56
 
56
- let FastImage: (props: FastImageProps) => JSX.Element | null = () => null;
57
-
58
- try {
59
- FastImage = require('react-native-fast-image') as (props: FastImageProps) => JSX.Element;
60
- } catch {}
61
-
62
57
  const Image_FastImage: SendbirdImageComponent = ({
63
58
  source,
64
59
  defaultSource,
@@ -69,7 +64,7 @@ const Image_FastImage: SendbirdImageComponent = ({
69
64
  ...props
70
65
  }) => {
71
66
  return (
72
- <FastImage
67
+ <FastImageInternal
73
68
  {...props}
74
69
  onLoad={onLoad && ((e) => onLoad(e.nativeEvent))}
75
70
  onError={onError && (() => onError({}))}
@@ -10,6 +10,7 @@ import Icon from '../Icon';
10
10
  import Image from '../Image';
11
11
 
12
12
  const useRetry = (hasError: boolean, retryCount = 5) => {
13
+ // NOTE: Glide(fast-image) will retry automatically on Android
13
14
  if (Platform.OS === 'android') return '';
14
15
 
15
16
  const forceUpdate = useForceUpdate();
@@ -44,14 +45,14 @@ type Props = {
44
45
  style?: StyleProp<ViewStyle>;
45
46
  };
46
47
  const ImageWithPlaceholder = (props: Props) => {
47
- const { colors } = useUIKitTheme();
48
+ const { palette, select, colors } = useUIKitTheme();
48
49
  const [imageNotFound, setImageNotFound] = useState(false);
49
50
 
50
51
  const key = useRetry(imageNotFound);
51
52
  return (
52
53
  <Box
53
54
  style={[{ overflow: 'hidden', width: props.width, height: props.height }, props.style]}
54
- backgroundColor={colors.onBackground04}
55
+ backgroundColor={select({ dark: palette.background400, light: palette.background100 })}
55
56
  >
56
57
  <Image
57
58
  key={key}
@@ -4,7 +4,7 @@ import { replaceWithRegex } from '@sendbird/uikit-utils';
4
4
 
5
5
  import Text, { TextProps } from '../Text';
6
6
 
7
- interface Pattern {
7
+ export interface RegexTextPattern {
8
8
  regex: RegExp;
9
9
  replacer(params: {
10
10
  match: string;
@@ -15,7 +15,7 @@ interface Pattern {
15
15
  }): string | JSX.Element;
16
16
  }
17
17
 
18
- type Props = { patterns: Pattern[] } & TextProps;
18
+ type Props = { patterns: RegexTextPattern[] } & TextProps;
19
19
 
20
20
  const RegexText = ({ children, patterns, ...props }: Props) => {
21
21
  if (patterns.length === 0 || typeof children !== 'string') return <>{children}</>;
package/src/index.ts CHANGED
@@ -10,10 +10,10 @@ export { default as ImageWithPlaceholder } from './components/ImageWithPlacehold
10
10
  export { default as Modal } from './components/Modal';
11
11
  export { default as PressBox } from './components/PressBox';
12
12
  export { default as RegexText } from './components/RegexText';
13
+ export type { RegexTextPattern } from './components/RegexText';
13
14
  export { default as Switch } from './components/Switch';
14
15
  export { default as Text } from './components/Text';
15
16
  export { default as TextInput } from './components/TextInput';
16
- export { default as URLParsedText } from './components/URLParsedText';
17
17
 
18
18
  /** UI **/
19
19
  export { default as ActionMenu } from './ui/ActionMenu';
@@ -24,11 +24,14 @@ export { default as BottomSheet } from './ui/BottomSheet';
24
24
  export { default as Button } from './ui/Button';
25
25
  export { default as ChannelFrozenBanner } from './ui/ChannelFrozenBanner';
26
26
  export { DialogProvider, useActionMenu, useAlert, usePrompt, useBottomSheet } from './ui/Dialog';
27
- export { default as GroupChannelPreview } from './ui/GroupChannelPreview';
28
27
  export { default as Header } from './ui/Header';
29
28
  export { default as LoadingSpinner } from './ui/LoadingSpinner';
30
29
  export { default as MenuBar } from './ui/MenuBar';
31
30
  export type { MenuBarProps } from './ui/MenuBar';
31
+ export { default as GroupChannelMessage } from './ui/GroupChannelMessage';
32
+ export type { GroupChannelMessageProps } from './ui/GroupChannelMessage';
33
+ export { default as GroupChannelPreview } from './ui/GroupChannelPreview';
34
+
32
35
  export { default as OpenChannelMessage } from './ui/OpenChannelMessage';
33
36
  export type { OpenChannelMessageProps } from './ui/OpenChannelMessage';
34
37
  export { default as OpenChannelPreview } from './ui/OpenChannelPreview';
package/src/types.ts CHANGED
@@ -43,8 +43,7 @@ export type Component =
43
43
  | 'ProfileCard'
44
44
  | 'Reaction'
45
45
  | 'OpenChannelMessage'
46
- | 'OpenChannelPreview'
47
- | 'Message';
46
+ | 'OpenChannelPreview';
48
47
 
49
48
  export type GetColorTree<
50
49
  Tree extends {
@@ -75,8 +74,6 @@ export type ComponentColorTree = GetColorTree<{
75
74
  Reaction: 'default' | 'rounded';
76
75
  OpenChannelMessage: 'default';
77
76
  OpenChannelPreview: 'default';
78
- /** @deprecated **/
79
- Message: 'incoming' | 'outgoing';
80
77
  };
81
78
  State: {
82
79
  Header: 'none';
@@ -92,8 +89,6 @@ export type ComponentColorTree = GetColorTree<{
92
89
  Reaction: 'enabled' | 'selected';
93
90
  OpenChannelMessage: 'enabled' | 'pressed';
94
91
  OpenChannelPreview: 'none';
95
- /** @deprecated **/
96
- Message: 'enabled' | 'pressed';
97
92
  };
98
93
  ColorPart: {
99
94
  Header: 'background' | 'borderBottom';
@@ -133,9 +128,6 @@ export type ComponentColorTree = GetColorTree<{
133
128
  | 'background'
134
129
  | 'coverBackground'
135
130
  | 'separator';
136
-
137
- /** @deprecated **/
138
- Message: 'textMsg' | 'textEdited' | 'textSenderName' | 'textTime' | 'background';
139
131
  };
140
132
  }>;
141
133
  export type ComponentColors<T extends Component> = {
@@ -183,8 +175,6 @@ export interface UIKitColors {
183
175
  reaction: ComponentColors<'Reaction'>;
184
176
  openChannelMessage: ComponentColors<'OpenChannelMessage'>;
185
177
  openChannelPreview: ComponentColors<'OpenChannelPreview'>;
186
- /** @deprecated Please use `colors.ui.groupChannelMessage` **/
187
- message: ComponentColors<'Message'>;
188
178
  };
189
179
  }
190
180
 
@@ -71,7 +71,7 @@ const getWidthPoint = (idx: number, total: number) => {
71
71
  return 0.5;
72
72
  };
73
73
  const getTopPoint = (idx: number, total: number) => {
74
- if (total === 2) return -0.025;
74
+ if (total === 2) return 0;
75
75
  if (total === 3 && idx === 0) return -0.025;
76
76
  if (total === 3 && idx !== 0) return 0.525;
77
77
  if (idx === 0 || idx === 1) return -0.025;
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+
3
+ import type { SendbirdAdminMessage } from '@sendbird/uikit-utils';
4
+
5
+ import Box from '../../components/Box';
6
+ import Text from '../../components/Text';
7
+ import createStyleSheet from '../../styles/createStyleSheet';
8
+ import useUIKitTheme from '../../theme/useUIKitTheme';
9
+ import type { GroupChannelMessageProps } from './index';
10
+
11
+ const AdminMessage = (props: GroupChannelMessageProps<SendbirdAdminMessage>) => {
12
+ const { colors } = useUIKitTheme();
13
+
14
+ return (
15
+ <Box style={styles.container}>
16
+ <Text caption2 color={colors.onBackground02} style={styles.text}>
17
+ {props.message.message}
18
+ </Text>
19
+ </Box>
20
+ );
21
+ };
22
+
23
+ const styles = createStyleSheet({
24
+ container: {
25
+ width: 300,
26
+ alignSelf: 'center',
27
+ alignItems: 'center',
28
+ },
29
+ text: {
30
+ textAlign: 'center',
31
+ },
32
+ });
33
+
34
+ export default AdminMessage;
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+
3
+ import type { SendbirdFileMessage } from '@sendbird/uikit-utils';
4
+ import { getAvailableUriFromFileMessage } from '@sendbird/uikit-utils';
5
+
6
+ import Box from '../../components/Box';
7
+ import ImageWithPlaceholder from '../../components/ImageWithPlaceholder';
8
+ import PressBox from '../../components/PressBox';
9
+ import createStyleSheet from '../../styles/createStyleSheet';
10
+ import useUIKitTheme from '../../theme/useUIKitTheme';
11
+ import MessageContainer from './MessageContainer';
12
+ import type { GroupChannelMessageProps } from './index';
13
+
14
+ const ImageFileMessage = (props: GroupChannelMessageProps<SendbirdFileMessage>) => {
15
+ const { onPress, onLongPress, variant = 'incoming' } = props;
16
+
17
+ const { colors } = useUIKitTheme();
18
+
19
+ return (
20
+ <MessageContainer {...props}>
21
+ <Box style={styles.container} backgroundColor={colors.ui.groupChannelMessage[variant].enabled.background}>
22
+ <PressBox activeOpacity={0.8} onPress={onPress} onLongPress={onLongPress}>
23
+ <ImageWithPlaceholder source={{ uri: getAvailableUriFromFileMessage(props.message) }} style={styles.image} />
24
+ </PressBox>
25
+ {props.children}
26
+ </Box>
27
+ </MessageContainer>
28
+ );
29
+ };
30
+
31
+ const styles = createStyleSheet({
32
+ container: {
33
+ borderRadius: 16,
34
+ overflow: 'hidden',
35
+ },
36
+ image: {
37
+ maxWidth: 240,
38
+ width: 240,
39
+ height: 160,
40
+ borderRadius: 16,
41
+ overflow: 'hidden',
42
+ },
43
+ });
44
+
45
+ export default ImageFileMessage;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+
3
+ import { SendbirdFileMessage, getFileExtension, getFileType } from '@sendbird/uikit-utils';
4
+
5
+ import Box from '../../components/Box';
6
+ import Icon from '../../components/Icon';
7
+ import PressBox from '../../components/PressBox';
8
+ import Text from '../../components/Text';
9
+ import createStyleSheet from '../../styles/createStyleSheet';
10
+ import useUIKitTheme from '../../theme/useUIKitTheme';
11
+ import MessageContainer from './MessageContainer';
12
+ import type { GroupChannelMessageProps } from './index';
13
+
14
+ const iconMapper = { audio: 'file-audio', image: 'photo', video: 'play', file: 'file-document' } as const;
15
+
16
+ type Props = GroupChannelMessageProps<SendbirdFileMessage>;
17
+
18
+ const FileMessage = (props: Props) => {
19
+ const { variant = 'incoming' } = props;
20
+ const { colors } = useUIKitTheme();
21
+
22
+ const fileType = getFileType(props.message.type || getFileExtension(props.message.name));
23
+ const color = colors.ui.groupChannelMessage[variant];
24
+
25
+ return (
26
+ <MessageContainer {...props}>
27
+ <PressBox onPress={props.onPress} onLongPress={props.onLongPress}>
28
+ {({ pressed }) => (
29
+ <Box backgroundColor={pressed ? color.pressed.background : color.enabled.background} style={styles.container}>
30
+ <Box style={styles.bubble}>
31
+ <Icon
32
+ icon={iconMapper[fileType]}
33
+ size={24}
34
+ containerStyle={{ backgroundColor: colors.background, padding: 2, borderRadius: 8, marginRight: 8 }}
35
+ />
36
+ <Text
37
+ body3
38
+ ellipsizeMode={'middle'}
39
+ numberOfLines={1}
40
+ color={pressed ? color.pressed.textMsg : color.enabled.textMsg}
41
+ style={styles.name}
42
+ >
43
+ {props.strings?.fileName || props.message.name}
44
+ </Text>
45
+ </Box>
46
+ {props.children}
47
+ </Box>
48
+ )}
49
+ </PressBox>
50
+ </MessageContainer>
51
+ );
52
+ };
53
+
54
+ const styles = createStyleSheet({
55
+ container: {
56
+ overflow: 'hidden',
57
+ borderRadius: 16,
58
+ },
59
+ bubble: {
60
+ flexDirection: 'row',
61
+ alignItems: 'center',
62
+ paddingHorizontal: 12,
63
+ paddingVertical: 6,
64
+ },
65
+ name: {
66
+ flexShrink: 1,
67
+ },
68
+ });
69
+
70
+ export default FileMessage;