be-components 5.1.6 → 5.1.9

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 (219) hide show
  1. package/lib/commonjs/Components/Icons.js +55 -1
  2. package/lib/commonjs/Components/Icons.js.map +1 -1
  3. package/lib/commonjs/Components/Themed.js +13 -1
  4. package/lib/commonjs/Components/Themed.js.map +1 -1
  5. package/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.js +47 -24
  6. package/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.js.map +1 -1
  7. package/lib/commonjs/SocialComponents/FormattedTextInput/index.js +76 -10
  8. package/lib/commonjs/SocialComponents/FormattedTextInput/index.js.map +1 -1
  9. package/lib/commonjs/SocialComponents/GifSelector/NativeSelector.js +14 -0
  10. package/lib/commonjs/SocialComponents/GifSelector/NativeSelector.js.map +1 -0
  11. package/lib/commonjs/SocialComponents/GifSelector/WebSelector.js +123 -0
  12. package/lib/commonjs/SocialComponents/GifSelector/WebSelector.js.map +1 -0
  13. package/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.js +89 -0
  14. package/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.js.map +1 -0
  15. package/lib/commonjs/SocialComponents/GroupChat/index.js +426 -0
  16. package/lib/commonjs/SocialComponents/GroupChat/index.js.map +1 -0
  17. package/lib/commonjs/SocialComponents/ImageRenderer.js +55 -0
  18. package/lib/commonjs/SocialComponents/ImageRenderer.js.map +1 -0
  19. package/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.js +219 -0
  20. package/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.js.map +1 -0
  21. package/lib/commonjs/SocialComponents/InputBar/index.js +59 -5
  22. package/lib/commonjs/SocialComponents/InputBar/index.js.map +1 -1
  23. package/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.js +2 -0
  24. package/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.js.map +1 -0
  25. package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js +37 -25
  26. package/lib/commonjs/SocialComponents/PostCard/components/ImageList.js.map +1 -1
  27. package/lib/commonjs/SocialComponents/PostCard/index.js +148 -70
  28. package/lib/commonjs/SocialComponents/PostCard/index.js.map +1 -1
  29. package/lib/commonjs/SocialComponents/Poster/index.js +325 -0
  30. package/lib/commonjs/SocialComponents/Poster/index.js.map +1 -0
  31. package/lib/commonjs/SocialComponents/SocialOrderCard.js +8 -3
  32. package/lib/commonjs/SocialComponents/SocialOrderCard.js.map +1 -1
  33. package/lib/commonjs/SocialComponents/SocialOrdersList.js +20 -2
  34. package/lib/commonjs/SocialComponents/SocialOrdersList.js.map +1 -1
  35. package/lib/commonjs/SocialComponents/UrlPreviewCard.js +115 -0
  36. package/lib/commonjs/SocialComponents/UrlPreviewCard.js.map +1 -0
  37. package/lib/commonjs/SocialComponents/api/index.js +383 -0
  38. package/lib/commonjs/SocialComponents/api/index.js.map +1 -1
  39. package/lib/commonjs/SocialComponents/index.js +14 -0
  40. package/lib/commonjs/SocialComponents/index.js.map +1 -1
  41. package/lib/module/Components/Icons.js +55 -1
  42. package/lib/module/Components/Icons.js.map +1 -1
  43. package/lib/module/Components/Themed.js +13 -1
  44. package/lib/module/Components/Themed.js.map +1 -1
  45. package/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.js +48 -25
  46. package/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.js.map +1 -1
  47. package/lib/module/SocialComponents/FormattedTextInput/index.js +77 -11
  48. package/lib/module/SocialComponents/FormattedTextInput/index.js.map +1 -1
  49. package/lib/module/SocialComponents/GifSelector/NativeSelector.js +7 -0
  50. package/lib/module/SocialComponents/GifSelector/NativeSelector.js.map +1 -0
  51. package/lib/module/SocialComponents/GifSelector/WebSelector.js +125 -0
  52. package/lib/module/SocialComponents/GifSelector/WebSelector.js.map +1 -0
  53. package/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.js +82 -0
  54. package/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.js.map +1 -0
  55. package/lib/module/SocialComponents/GroupChat/index.js +418 -0
  56. package/lib/module/SocialComponents/GroupChat/index.js.map +1 -0
  57. package/lib/module/SocialComponents/ImageRenderer.js +48 -0
  58. package/lib/module/SocialComponents/ImageRenderer.js.map +1 -0
  59. package/lib/module/SocialComponents/InputBar/components/ActionSelector.js +210 -0
  60. package/lib/module/SocialComponents/InputBar/components/ActionSelector.js.map +1 -0
  61. package/lib/module/SocialComponents/InputBar/index.js +58 -6
  62. package/lib/module/SocialComponents/InputBar/index.js.map +1 -1
  63. package/lib/module/SocialComponents/PostCard/components/ArticleCard.js +2 -0
  64. package/lib/module/SocialComponents/PostCard/components/ArticleCard.js.map +1 -0
  65. package/lib/module/SocialComponents/PostCard/components/ImageList.js +37 -25
  66. package/lib/module/SocialComponents/PostCard/components/ImageList.js.map +1 -1
  67. package/lib/module/SocialComponents/PostCard/index.js +148 -70
  68. package/lib/module/SocialComponents/PostCard/index.js.map +1 -1
  69. package/lib/module/SocialComponents/Poster/index.js +316 -0
  70. package/lib/module/SocialComponents/Poster/index.js.map +1 -0
  71. package/lib/module/SocialComponents/SocialOrderCard.js +8 -3
  72. package/lib/module/SocialComponents/SocialOrderCard.js.map +1 -1
  73. package/lib/module/SocialComponents/SocialOrdersList.js +21 -3
  74. package/lib/module/SocialComponents/SocialOrdersList.js.map +1 -1
  75. package/lib/module/SocialComponents/UrlPreviewCard.js +106 -0
  76. package/lib/module/SocialComponents/UrlPreviewCard.js.map +1 -0
  77. package/lib/module/SocialComponents/api/index.js +383 -0
  78. package/lib/module/SocialComponents/api/index.js.map +1 -1
  79. package/lib/module/SocialComponents/index.js +3 -1
  80. package/lib/module/SocialComponents/index.js.map +1 -1
  81. package/lib/typescript/lib/commonjs/Components/Icons.d.ts +10 -0
  82. package/lib/typescript/lib/commonjs/Components/Icons.d.ts.map +1 -1
  83. package/lib/typescript/lib/commonjs/Components/Themed.d.ts.map +1 -1
  84. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +2 -1
  85. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
  86. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/index.d.ts +9 -1
  87. package/lib/typescript/lib/commonjs/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
  88. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
  89. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
  90. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/WebSelector.d.ts +4 -0
  91. package/lib/typescript/lib/commonjs/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
  92. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +11 -0
  93. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
  94. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/index.d.ts +14 -0
  95. package/lib/typescript/lib/commonjs/SocialComponents/GroupChat/index.d.ts.map +1 -0
  96. package/lib/typescript/lib/commonjs/SocialComponents/ImageRenderer.d.ts +11 -0
  97. package/lib/typescript/lib/commonjs/SocialComponents/ImageRenderer.d.ts.map +1 -0
  98. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.d.ts +9 -0
  99. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
  100. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/index.d.ts +3 -1
  101. package/lib/typescript/lib/commonjs/SocialComponents/InputBar/index.d.ts.map +1 -1
  102. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
  103. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
  104. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ImageList.d.ts +1 -2
  105. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
  106. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/index.d.ts +4 -1
  107. package/lib/typescript/lib/commonjs/SocialComponents/PostCard/index.d.ts.map +1 -1
  108. package/lib/typescript/lib/commonjs/SocialComponents/Poster/index.d.ts +9 -0
  109. package/lib/typescript/lib/commonjs/SocialComponents/Poster/index.d.ts.map +1 -0
  110. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts +2 -1
  111. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  112. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrdersList.d.ts +2 -1
  113. package/lib/typescript/lib/commonjs/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  114. package/lib/typescript/lib/commonjs/SocialComponents/UrlPreviewCard.d.ts +9 -0
  115. package/lib/typescript/lib/commonjs/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
  116. package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts +89 -0
  117. package/lib/typescript/lib/commonjs/SocialComponents/api/index.d.ts.map +1 -1
  118. package/lib/typescript/lib/commonjs/SocialComponents/index.d.ts +2 -0
  119. package/lib/typescript/lib/module/Components/Icons.d.ts +10 -0
  120. package/lib/typescript/lib/module/Components/Icons.d.ts.map +1 -1
  121. package/lib/typescript/lib/module/Components/Themed.d.ts.map +1 -1
  122. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +3 -2
  123. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
  124. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/index.d.ts +9 -1
  125. package/lib/typescript/lib/module/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
  126. package/lib/typescript/lib/module/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
  127. package/lib/typescript/lib/module/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
  128. package/lib/typescript/lib/module/SocialComponents/GifSelector/WebSelector.d.ts +13 -0
  129. package/lib/typescript/lib/module/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
  130. package/lib/typescript/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +11 -0
  131. package/lib/typescript/lib/module/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
  132. package/lib/typescript/lib/module/SocialComponents/GroupChat/index.d.ts +14 -0
  133. package/lib/typescript/lib/module/SocialComponents/GroupChat/index.d.ts.map +1 -0
  134. package/lib/typescript/lib/module/SocialComponents/ImageRenderer.d.ts +11 -0
  135. package/lib/typescript/lib/module/SocialComponents/ImageRenderer.d.ts.map +1 -0
  136. package/lib/typescript/lib/module/SocialComponents/InputBar/components/ActionSelector.d.ts +10 -0
  137. package/lib/typescript/lib/module/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
  138. package/lib/typescript/lib/module/SocialComponents/InputBar/index.d.ts +3 -1
  139. package/lib/typescript/lib/module/SocialComponents/InputBar/index.d.ts.map +1 -1
  140. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
  141. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
  142. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ImageList.d.ts +1 -2
  143. package/lib/typescript/lib/module/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
  144. package/lib/typescript/lib/module/SocialComponents/PostCard/index.d.ts +4 -1
  145. package/lib/typescript/lib/module/SocialComponents/PostCard/index.d.ts.map +1 -1
  146. package/lib/typescript/lib/module/SocialComponents/Poster/index.d.ts +11 -0
  147. package/lib/typescript/lib/module/SocialComponents/Poster/index.d.ts.map +1 -0
  148. package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts +3 -2
  149. package/lib/typescript/lib/module/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  150. package/lib/typescript/lib/module/SocialComponents/SocialOrdersList.d.ts +2 -1
  151. package/lib/typescript/lib/module/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  152. package/lib/typescript/lib/module/SocialComponents/UrlPreviewCard.d.ts +9 -0
  153. package/lib/typescript/lib/module/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
  154. package/lib/typescript/lib/module/SocialComponents/api/index.d.ts +89 -0
  155. package/lib/typescript/lib/module/SocialComponents/api/index.d.ts.map +1 -1
  156. package/lib/typescript/lib/module/SocialComponents/index.d.ts +3 -1
  157. package/lib/typescript/lib/module/SocialComponents/index.d.ts.map +1 -1
  158. package/lib/typescript/src/Components/Icons.d.ts +2 -0
  159. package/lib/typescript/src/Components/Icons.d.ts.map +1 -1
  160. package/lib/typescript/src/Components/Themed.d.ts +1 -0
  161. package/lib/typescript/src/Components/Themed.d.ts.map +1 -1
  162. package/lib/typescript/src/SocialComponents/FormattedTextInput/components/TagSelector.d.ts +2 -1
  163. package/lib/typescript/src/SocialComponents/FormattedTextInput/components/TagSelector.d.ts.map +1 -1
  164. package/lib/typescript/src/SocialComponents/FormattedTextInput/index.d.ts +9 -1
  165. package/lib/typescript/src/SocialComponents/FormattedTextInput/index.d.ts.map +1 -1
  166. package/lib/typescript/src/SocialComponents/GifSelector/NativeSelector.d.ts +4 -0
  167. package/lib/typescript/src/SocialComponents/GifSelector/NativeSelector.d.ts.map +1 -0
  168. package/lib/typescript/src/SocialComponents/GifSelector/WebSelector.d.ts +11 -0
  169. package/lib/typescript/src/SocialComponents/GifSelector/WebSelector.d.ts.map +1 -0
  170. package/lib/typescript/src/SocialComponents/GroupChat/components/GroupMessageCard.d.ts +18 -0
  171. package/lib/typescript/src/SocialComponents/GroupChat/components/GroupMessageCard.d.ts.map +1 -0
  172. package/lib/typescript/src/SocialComponents/GroupChat/index.d.ts +25 -0
  173. package/lib/typescript/src/SocialComponents/GroupChat/index.d.ts.map +1 -0
  174. package/lib/typescript/src/SocialComponents/ImageRenderer.d.ts +21 -0
  175. package/lib/typescript/src/SocialComponents/ImageRenderer.d.ts.map +1 -0
  176. package/lib/typescript/src/SocialComponents/InputBar/components/ActionSelector.d.ts +16 -0
  177. package/lib/typescript/src/SocialComponents/InputBar/components/ActionSelector.d.ts.map +1 -0
  178. package/lib/typescript/src/SocialComponents/InputBar/index.d.ts +10 -1
  179. package/lib/typescript/src/SocialComponents/InputBar/index.d.ts.map +1 -1
  180. package/lib/typescript/src/SocialComponents/PostCard/components/ArticleCard.d.ts +1 -0
  181. package/lib/typescript/src/SocialComponents/PostCard/components/ArticleCard.d.ts.map +1 -0
  182. package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts +1 -1
  183. package/lib/typescript/src/SocialComponents/PostCard/components/ImageList.d.ts.map +1 -1
  184. package/lib/typescript/src/SocialComponents/PostCard/index.d.ts +4 -2
  185. package/lib/typescript/src/SocialComponents/PostCard/index.d.ts.map +1 -1
  186. package/lib/typescript/src/SocialComponents/Poster/index.d.ts +16 -0
  187. package/lib/typescript/src/SocialComponents/Poster/index.d.ts.map +1 -0
  188. package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts +2 -1
  189. package/lib/typescript/src/SocialComponents/SocialOrderCard.d.ts.map +1 -1
  190. package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts +2 -1
  191. package/lib/typescript/src/SocialComponents/SocialOrdersList.d.ts.map +1 -1
  192. package/lib/typescript/src/SocialComponents/UrlPreviewCard.d.ts +10 -0
  193. package/lib/typescript/src/SocialComponents/UrlPreviewCard.d.ts.map +1 -0
  194. package/lib/typescript/src/SocialComponents/api/index.d.ts +37 -1
  195. package/lib/typescript/src/SocialComponents/api/index.d.ts.map +1 -1
  196. package/lib/typescript/src/SocialComponents/index.d.ts +3 -1
  197. package/lib/typescript/src/SocialComponents/index.d.ts.map +1 -1
  198. package/package.json +5 -1
  199. package/src/Components/Icons.tsx +29 -1
  200. package/src/Components/Themed.tsx +11 -1
  201. package/src/SocialComponents/FormattedTextInput/components/TagSelector.tsx +24 -17
  202. package/src/SocialComponents/FormattedTextInput/index.tsx +56 -12
  203. package/src/SocialComponents/GifSelector/NativeSelector.tsx +13 -0
  204. package/src/SocialComponents/GifSelector/WebSelector.tsx +91 -0
  205. package/src/SocialComponents/GroupChat/components/GroupMessageCard.tsx +84 -0
  206. package/src/SocialComponents/GroupChat/index.tsx +333 -0
  207. package/src/SocialComponents/ImageRenderer.tsx +42 -0
  208. package/src/SocialComponents/InputBar/components/ActionSelector.tsx +164 -0
  209. package/src/SocialComponents/InputBar/index.tsx +40 -6
  210. package/src/SocialComponents/PostCard/components/ArticleCard.tsx +2 -0
  211. package/src/SocialComponents/PostCard/components/ImageList.tsx +28 -21
  212. package/src/SocialComponents/PostCard/index.tsx +122 -56
  213. package/src/SocialComponents/Poster/index.tsx +264 -0
  214. package/src/SocialComponents/SocialOrderCard.tsx +4 -6
  215. package/src/SocialComponents/SocialOrdersList.tsx +14 -8
  216. package/src/SocialComponents/UrlPreviewCard.tsx +75 -0
  217. package/src/SocialComponents/api/index.ts +345 -3
  218. package/src/SocialComponents/index.tsx +4 -0
  219. package/src/types.d.ts +58 -0
@@ -1,22 +1,33 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
- import { Button, TextInput, View } from "../../Components/Themed"
2
+ import { Button, Text, TextInput, View } from "../../Components/Themed"
3
3
  import { Platform, type NativeSyntheticEvent, type TextInputSelectionChangeEventData } from 'react-native';
4
4
  import type { TextTagProps } from '../../types';
5
5
  import { SocialComponentApi, SocialComponentHelpers } from '../api';
6
6
  import TagSelector from './components/TagSelector';
7
+ import { Icons } from '../../Components';
8
+ import { useColors } from '../../constants/useColors';
7
9
 
8
10
  type FormattedTextInputProps = {
9
11
  onChangeText?: (data:{ text:string, formatted_text:any }) => void,
10
12
  submit_title?:string,
13
+ submit_caller?:string,
11
14
  submit_loading?:boolean,
15
+ keep_on_submit?:boolean,
16
+ hide_border?:boolean,
17
+ disable_scroll?:boolean,
18
+ icon_submit?:boolean,
19
+ width:number
12
20
  placeholder?:string,
21
+ tag_selector_location?:'bottom'|'top',
22
+ onSelectInput?:() => void
13
23
  submit_placement?:'inline'|'bottom',
14
24
  onFocusPosition?:(position:{ height:number, width:number, x:number, y:number }) => void
15
25
  init_data?: { formatted_text: string, text:string, tags:TextTagProps[] },
16
26
  onSubmit:(data:{ text:string, formatted_text:any }, tags:TextTagProps[]) => void
17
27
  }
18
28
 
19
- const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_data, onChangeText, onSubmit, onFocusPosition }:FormattedTextInputProps) => {
29
+ const FormattedTextInput = ({ width, disable_scroll, submit_title, hide_border, tag_selector_location, icon_submit, keep_on_submit, submit_caller, submit_placement, placeholder, init_data, onSelectInput, onChangeText, onSubmit, onFocusPosition }:FormattedTextInputProps) => {
30
+ const Colors = useColors();
20
31
  const [ input_state, setInputState ] = useState<{
21
32
  height:number
22
33
  }>({
@@ -42,7 +53,6 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
42
53
  }>({ visible: false, type: 'player' })
43
54
  const [ valid_tags, setValidTags ] = useState<TextTagProps[]>([]);
44
55
 
45
-
46
56
  const { text, formatted_text } = data;
47
57
  const { height } = input_state;
48
58
  const tags = useMemo(() => SocialComponentHelpers.extractTagsFromText(text, location.start), [location.start])
@@ -51,13 +61,18 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
51
61
  const [ action_loading, setActionLoading ] = useState(false);
52
62
  const [ working_tag, setWorkingTag ] = useState<TextTagProps | undefined>();
53
63
 
64
+ useEffect(() => {
65
+ if(!submit_caller){ return }
66
+ handleSubmit();
67
+ },[submit_caller])
68
+
54
69
  useEffect(() => {
55
70
  SocialComponentApi.setEnvironment();
56
71
  if(init_data){
57
72
  setData({ text: init_data.text, formatted_text: init_data.formatted_text });
58
73
  setValidTags(init_data.tags)
59
74
  }
60
- },[init_data])
75
+ },[JSON.stringify(init_data)])
61
76
 
62
77
  useEffect(() => {
63
78
  if(active_tag){ return setWorkingTag(active_tag) }
@@ -70,7 +85,7 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
70
85
  },[active_tag]);
71
86
 
72
87
  const validateTag = async(tag:TextTagProps) => {
73
- let new_tags = valid_tags.filter(t => t.local_id != tag.local_id).concat(tag);
88
+ let new_tags = valid_tags.concat({ ...tag });
74
89
  setValidTags(new_tags);
75
90
  }
76
91
 
@@ -103,7 +118,7 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
103
118
  const handleUpdateTag = async(tag:TextTagProps) => {
104
119
  setActionLoading(true);
105
120
  const new_text = SocialComponentHelpers.replaceText(text, tag.start, tag.end, `@${tag.tag}`);
106
- setValidTags(valid_tags.concat({ ...tag }));
121
+ validateTag(tag)
107
122
  setData({
108
123
  ...data,
109
124
  text: new_text
@@ -115,7 +130,11 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
115
130
  const handleSubmit = () => {
116
131
  if(!text){ return }
117
132
  let new_tags = SocialComponentHelpers.compareTags(valid_tags, tags);
118
- onSubmit({ text, formatted_text }, new_tags)
133
+ onSubmit({ text, formatted_text }, new_tags);
134
+ if(keep_on_submit){ return }
135
+ setData({ text: '', formatted_text: JSON.stringify('') });
136
+ setInputState({ ...input_state, height: 50 })
137
+ setValidTags([]);
119
138
  }
120
139
 
121
140
  const handleChange = (ev:any) => {
@@ -131,18 +150,24 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
131
150
  return (
132
151
  <View transparent>
133
152
  <View transparent>
134
- {tag_selector.visible && tag_selector.working_tag ?
153
+ {tag_selector.visible && tag_selector.working_tag && tag_selector_location != 'bottom' ?
135
154
  <TagSelector
136
155
  working_tag={tag_selector.working_tag}
137
156
  type={tag_selector.type}
157
+ width={width}
138
158
  visible={tag_selector.visible}
139
159
  onCancel={() => setTagSelector({ visible: false, type: 'player' })}
140
160
  onSelectTag={(tag) => handleUpdateTag(tag)}
141
161
  />
142
162
  :<></>}
143
163
  </View>
144
- <View style={{ flexDirection:'row', alignItems:'flex-end' }}>
145
- <View type='input' style={{ flex:1, flexDirection:'row' }}>
164
+ <View transparent style={{ flexDirection:'row', alignItems:'flex-end' }}>
165
+ {onSelectInput ?
166
+ <Button float style={{ padding:10, width:45, marginRight:5, borderRadius:8, justifyContent:'center', alignItems:'center' }} onPress={() => onSelectInput()}>
167
+ <Icons.MoreIcon size={24} color={Colors.text.h1} />
168
+ </Button>
169
+ :<></>}
170
+ <View type={hide_border?undefined:'input'} style={{ flex:1, flexDirection:'row' }}>
146
171
  <TextInput
147
172
  value={text}
148
173
  editable={!action_loading}
@@ -150,6 +175,7 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
150
175
  loading={action_loading}
151
176
  focus_on_unload
152
177
  transparent
178
+ scrollEnabled={!disable_scroll}
153
179
  placeholder={placeholder ?? 'Start typing here...'}
154
180
  onFocusPosition={onFocusPosition}
155
181
  style={{ flex:1, height: Platform.OS == 'web' ? height : undefined }}
@@ -163,14 +189,32 @@ const FormattedTextInput = ({ submit_title, submit_placement, placeholder, init_
163
189
  </View>
164
190
  {submit_placement == 'inline' ?
165
191
  <Button
166
- title={submit_title ?? 'Submit'}
192
+
167
193
  type='success'
168
194
  style={{ opacity:text ? 1: 0.5, marginLeft:5}}
169
195
  disabled={!text}
170
196
  onPress={() => handleSubmit()}
171
- />
197
+ >
198
+ {!icon_submit ?
199
+ <Text theme='h2' color={Colors.text.white}>{submit_title ?? 'Submit'}</Text>
200
+ :
201
+ <Icons.SendIcon size={18} color={Colors.text.white} />
202
+ }
203
+ </Button>
172
204
  :<></>}
173
205
  </View>
206
+ {tag_selector.visible && tag_selector.working_tag && tag_selector_location == 'bottom' ?
207
+ <View transparent style={{ height:100 }}>
208
+ <TagSelector
209
+ working_tag={tag_selector.working_tag}
210
+ type={tag_selector.type}
211
+ width={width}
212
+ visible={tag_selector.visible}
213
+ onCancel={() => setTagSelector({ visible: false, type: 'player' })}
214
+ onSelectTag={(tag) => handleUpdateTag(tag)}
215
+ />
216
+ </View>
217
+ :<></>}
174
218
  {submit_placement == 'bottom' ?
175
219
  <Button
176
220
  title={submit_title ?? 'Submit'}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Text, View } from "../../Components/Themed"
3
+
4
+ const GifyNativeSelector = () => {
5
+ return (
6
+ <View>
7
+ <Text>Hey</Text>
8
+ </View>
9
+ )
10
+ }
11
+
12
+ export default GifyNativeSelector
13
+
@@ -0,0 +1,91 @@
1
+ import React, { useContext, useEffect, useState } from 'react';
2
+
3
+ import { GiphyFetch } from '@giphy/js-fetch-api'
4
+
5
+ import {
6
+ Grid, // our UI Component to display the results
7
+ SearchBar, // the search bar the user will type into
8
+ SearchContext, // the context that wraps and connects our components
9
+ SearchContextManager, // the context manager, includes the Context.Provider
10
+ SuggestionBar, // an optional UI component that displays trending searches and channel / username results
11
+ } from '@giphy/react-components';
12
+
13
+ const gf = new GiphyFetch('MPKLmL5j0G3TesyhtNeDTE0nZ3F8CKCB')
14
+ import { Button, View } from '../../Components/Themed';
15
+ import { Modal, Platform, ScrollView } from 'react-native';
16
+
17
+ // the search experience consists of the manager and its child components that use SearchContext
18
+ type GifySelectModalProps = {
19
+ isVisible:boolean,
20
+ width:number,
21
+ view_mode:'desktop'|'mobile',
22
+ gifSelect:any,
23
+ closeModal:any
24
+ }
25
+
26
+ const WebGifySelector = ({ isVisible, gifSelect, closeModal, view_mode, width }:GifySelectModalProps) => {
27
+ if(!isVisible){ return (<></>) }
28
+ if(Platform.OS != 'web'){ return <></> }
29
+ return (
30
+ <Modal
31
+ transparent
32
+ style={{ flex:1 }}
33
+ animationType={view_mode == 'desktop' ? 'fade' : 'slide'}
34
+ >
35
+ <View type='blur' style={{ flex:1, padding:10 }}>
36
+ <View float style={{flex:1, padding:10}}>
37
+ <ScrollView style={{flex:1, paddingTop:10, borderTopRightRadius:2, borderTopLeftRadius:2}}>
38
+ <SearchContextManager apiKey={'MPKLmL5j0G3TesyhtNeDTE0nZ3F8CKCB'}>
39
+ <Components width={width - 20} gifSelect={gifSelect} />
40
+ </SearchContextManager>
41
+ </ScrollView>
42
+ <View type='footer' style={{ flexDirection:'row', padding:10 }}>
43
+ <Button
44
+ type='close'
45
+ title='CLOSE'
46
+ style={{ flex:1 }}
47
+ onPress={() => closeModal()}
48
+ />
49
+ </View>
50
+ </View>
51
+ </View>
52
+ </Modal>
53
+ )
54
+ }
55
+
56
+ // define the components in a separate function so we can
57
+ // use the context hook. You could also use the render props pattern
58
+ const Components = ({ gifSelect, width }: { gifSelect:any, width:number }) => {
59
+ const { fetchGifs, searchKey } = useContext(SearchContext)
60
+ const [ initGifs, setInitGifs ] = useState<any>()
61
+ useEffect(() => {
62
+ getInitGifs()
63
+ },[])
64
+ const getInitGifs = async() => {
65
+ const fetchedGifs = await gf.trending({ offset: 0, limit: 10 })
66
+ setInitGifs(fetchedGifs.data)
67
+ }
68
+
69
+ if(!initGifs){ return (<></>) }
70
+ return (
71
+ <>
72
+ <SearchBar />
73
+ <View style={{paddingTop:10, paddingLeft:2}}>
74
+ <SuggestionBar />
75
+ <Grid noLink onGifClick={(gif) => gifSelect(gif)} initialGifs={searchKey===''?initGifs:[]} key={searchKey} columns={3} width={width} fetchGifs={fetchGifs} />
76
+ </View>
77
+ </>
78
+ )
79
+ }
80
+
81
+
82
+ const areEqual = (prevProps:GifySelectModalProps, nextProps:GifySelectModalProps) => {
83
+ let allEqual = true
84
+ if(prevProps.isVisible !== nextProps.isVisible){ return false }
85
+ return allEqual
86
+ }
87
+
88
+ export default React.memo(WebGifySelector, areEqual)
89
+
90
+
91
+
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+ import { Text, View } from "../../../Components/Themed";
3
+ import { useColors } from "../../../constants/useColors";
4
+ import type { GroupMessageProps, MyPlayerProps, PublicPlayerProps, TextTagProps } from "../../../types";
5
+ import { FormattedText } from '../../FormattedTextInput/FormattedText';
6
+ import moment from 'moment-mini';
7
+ import { Image } from 'react-native';
8
+ import ImageRenderer from '../../ImageRenderer';
9
+ import UrlPreviewCard from '../../UrlPreviewCard';
10
+
11
+
12
+ type GroupMessageCardProps = {
13
+ group_message:GroupMessageProps,
14
+ me?:MyPlayerProps,
15
+ player?:PublicPlayerProps,
16
+ mine?:boolean,
17
+ width: number,
18
+ onSelectImage:(image:{ url:string, height?:number, width?:number }) => void,
19
+ onSelectTag:(tag:TextTagProps) => void
20
+ }
21
+
22
+ const GroupMessageCard = ({group_message, mine, player, width, onSelectImage, onSelectTag}:GroupMessageCardProps) => {
23
+ const Colors = useColors();
24
+ const image = group_message.message_images ? group_message.message_images[0] : undefined
25
+ const url = group_message.message_urls ? group_message.message_urls[0] : undefined
26
+ return (
27
+ <View>
28
+ <View style={{ flexDirection:'row', alignItems:'flex-end' }}>
29
+ {mine ?
30
+ <View style={{ flex:1 }} transparent />
31
+ :
32
+ <View float style={{ borderRadius:100, padding:2 }}>
33
+ <Image
34
+ source={{ uri:player?.profile_pic }}
35
+ style={{ height:36, width:36, borderRadius:100 }}
36
+ resizeMode='cover'
37
+ />
38
+ </View>
39
+ }
40
+ <View float style={{
41
+ width: width - 90,
42
+ padding:14,
43
+ marginLeft:10,
44
+ borderRadius:22,
45
+ marginBottom:15,
46
+ borderBottomLeftRadius: !mine? 0:22,
47
+ borderBottomRightRadius: mine? 0:22,
48
+ backgroundColor:mine?Colors.absolutes.brand.midnight:Colors.absolutes.highlights.highlight200
49
+ }}>
50
+ {url ?
51
+ <UrlPreviewCard
52
+ url={url}
53
+ width={width - 120}
54
+ color={Colors.text.white}
55
+ />
56
+ :<></>}
57
+ {image ?
58
+ <ImageRenderer
59
+ image={image}
60
+ width={width - 120}
61
+ onSelectImage={onSelectImage}
62
+ />
63
+ :<></>}
64
+ {group_message.formatted_text ?
65
+ <FormattedText
66
+ text={group_message.formatted_text}
67
+ tags={group_message.tags ?? []}
68
+ text_color={Colors.text.white}
69
+ onSelectTag={(tag) => onSelectTag(tag)}
70
+ />
71
+ : group_message.message ?
72
+ <Text size={12} color={Colors.text.white}>{group_message.message}</Text>
73
+ :<></>}
74
+ </View>
75
+ {!mine ?
76
+ <View transparent />
77
+ :<></>}
78
+ </View>
79
+ <Text theme="light" textAlign={mine?'right':'left'}>{!mine && player ?`@${player?.username} - `: ''}Delivered {moment(group_message.create_datetime).format('hh:mm a')}</Text>
80
+ </View>
81
+ )
82
+ }
83
+
84
+ export default GroupMessageCard
@@ -0,0 +1,333 @@
1
+ import React from 'react';
2
+ import moment from "moment-mini";
3
+ import { useEffect, useMemo, useRef, useState } from "react";
4
+ import { ActivityIndicator, FlatList, Image } from "react-native"
5
+ import { useColors } from "../../constants/useColors";
6
+ import type { GroupMessageProps, GroupPlayerProps, GroupProps, MyPlayerProps, PublicPlayerProps, TextTagProps } from "../../types";
7
+ import { SocialComponentApi, SocialComponentHelpers } from "../api";
8
+ import { Text, View } from "../../Components/Themed";
9
+ import GroupMessageCard from './components/GroupMessageCard';
10
+ import InputBar from '../InputBar';
11
+ import FormattedTextInput from '../FormattedTextInput';
12
+ import SocketManager from '../../Socket';
13
+
14
+ type GroupChatProps = {
15
+ group_id?:string,
16
+ my_id?:string,
17
+ player_id?:string,
18
+ access_token?:string,
19
+ width:number,
20
+ distinct_id:string,
21
+ onSelectTag: (tag:TextTagProps) => void,
22
+ onSelectImage:(image: { url:string, height?:number, width?:number }) => void,
23
+ onFocusPosition?:(position:{ height:number, width:number, x:number, y:number }) => void
24
+ }
25
+
26
+ const GroupChat = ({ my_id, player_id, width, group_id, access_token, distinct_id, onFocusPosition, onSelectImage, onSelectTag }:GroupChatProps) => {
27
+ const Colors = useColors();
28
+ const [ chat_size, setChatSize ] = useState({ height:0, width:0 });
29
+ const [ show_input_bar, setShowInputBar ] = useState(false);
30
+ const [ needs_reload, setNeedsReload ] = useState(false);
31
+ const [ message_loading, setMessageLoading ] = useState(false);
32
+ const [ socket_message, setSocketMessage ] = useState<GroupMessageProps|undefined>(undefined);
33
+ const [ my_data, setMyData ] = useState<{
34
+ me?: MyPlayerProps
35
+ }>({});
36
+ const { me } = my_data;
37
+ const [ screen_data, setData ] = useState<{
38
+ loading:boolean,
39
+ players:PublicPlayerProps[],
40
+ group?:GroupProps,
41
+ group_players:GroupPlayerProps[]
42
+ }>({
43
+ loading:false,
44
+ players:[],
45
+ group_players: []
46
+ })
47
+ const { loading, players, group } = screen_data;
48
+
49
+ const [ message_data, setMessageData ] = useState<{
50
+ messages_loading:boolean,
51
+ messages: GroupMessageProps[]
52
+ }>({
53
+ messages_loading: false,
54
+ messages:[]
55
+ });
56
+ const { messages } = message_data
57
+ const chat_ref = useRef(null);
58
+
59
+ const unique_dates = useMemo(() => [ ...new Set(messages.map(m => moment(m.create_datetime).format('MMM DD YYYY')))],[messages.length, socket_message]);
60
+
61
+ useEffect(() => {
62
+ SocialComponentApi.setEnvironment();
63
+ if(group_id){
64
+ getGroupFromServer(group_id);
65
+ return
66
+ }
67
+ if(player_id){
68
+ getChatFromServer(player_id);
69
+ return
70
+ }
71
+ },[group_id, player_id]);
72
+
73
+ useEffect(() => {
74
+ if(!my_id){ return }
75
+ getMyData();
76
+ },[my_id]);
77
+
78
+ const getMyData = async() => {
79
+ const player = await SocialComponentApi.getMyDetails();
80
+ setMyData({ me:player })
81
+ }
82
+
83
+ useEffect(() => {
84
+ if(!socket_message){ return }
85
+ setMessageData({
86
+ ...message_data,
87
+ messages: messages.filter(m => m.group_message_id != socket_message.group_message_id).concat(socket_message)
88
+ })
89
+ },[socket_message]);
90
+
91
+ const chat_player = group?.type == 'direct' ? players.find(p => p.player_id == player_id) : undefined
92
+
93
+ const getChatFromServer = async(id:string) => {
94
+ setData({ ...screen_data, loading:true });
95
+ if(!my_id){ return }
96
+ setMessageData({ ...message_data, messages_loading:true });
97
+ const group_response = await SocialComponentApi.getChat(id);
98
+ if(!group_response){ return setData({ ...screen_data, loading:false }) }
99
+ let player_ids:string[] = []
100
+ if(player_id){ player_ids.push(player_id) }
101
+ if(my_id){ player_ids.push(my_id) }
102
+ const players = await SocialComponentApi.getPlayersByIds(player_ids);
103
+
104
+ let group_messages_with_tags = await SocialComponentHelpers.addTagsToMessages(group_response.group_messages);
105
+
106
+ setData({
107
+ ...screen_data,
108
+ players: players,
109
+ group: group_response.group,
110
+ group_players: group_response.group_players,
111
+ loading: false
112
+ });
113
+ setMessageData({
114
+ ...message_data,
115
+ messages_loading:false,
116
+ messages: group_messages_with_tags
117
+ });
118
+ }
119
+
120
+ const getGroupFromServer = async(id:string) => {
121
+ setData({ ...screen_data, loading:true });
122
+ setMessageData({ ...message_data, messages_loading:true });
123
+ const group_response = await SocialComponentApi.getGroupById(id);
124
+ if(!group_response){ return setData({ ...screen_data, loading:false }) }
125
+ const players = await SocialComponentApi.getPlayersByIds(group_response.group_messages.map(p => p.player_id));
126
+
127
+ let group_messages_with_tags = await SocialComponentHelpers.addTagsToMessages(group_response.group_messages);
128
+
129
+ setData({
130
+ ...screen_data,
131
+ players: players,
132
+ group: group_response.group,
133
+ group_players: group_response.group_players,
134
+ loading: false
135
+ });
136
+ setMessageData({
137
+ ...message_data,
138
+ messages_loading:false,
139
+ messages: group_messages_with_tags
140
+ });
141
+ }
142
+
143
+ //const message_valid = message_text != '' ? true : false
144
+
145
+ const handleSendImage = async(image:any) => {
146
+ if(!group || message_loading){ return }
147
+ setMessageLoading(true);
148
+ const group_message = SocialComponentHelpers.getEmptyMessage();
149
+ const gm = await SocialComponentApi.sendChat({
150
+ ...group_message,
151
+ formatted_text: '',
152
+ tags: [],
153
+ message_images: [image],
154
+ group_id: group.group_id,
155
+ message: ''
156
+ });
157
+ if(!gm){
158
+ setMessageLoading(false);
159
+ return
160
+ }
161
+ setMessageData({
162
+ ...message_data,
163
+ messages: messages.filter(m => m.group_message_id != gm.group_message_id).concat(gm)
164
+ })
165
+ setMessageLoading(false);
166
+
167
+ }
168
+
169
+ const handleSendMessage = async(data: { formatted_text: string, text:string }, tags:TextTagProps[]) => {
170
+ if(!group || message_loading){ return }
171
+ setMessageLoading(true);
172
+
173
+ //Find urls!
174
+ const url = SocialComponentHelpers.getUrlsFromString(data.text);
175
+ let message_urls:string[] = []
176
+ if(url){ message_urls.push(url) }
177
+ const group_message = SocialComponentHelpers.getEmptyMessage();
178
+ const gm = await SocialComponentApi.sendChat({
179
+ ...group_message,
180
+ formatted_text: data.formatted_text,
181
+ tags: tags.map(t => { return { ...t, data:undefined } }), //Drop the data!
182
+ group_id: group.group_id,
183
+ message_urls: message_urls,
184
+ message: data.text
185
+ });
186
+ if(!gm){
187
+ setMessageLoading(false);
188
+ return
189
+ }
190
+ setMessageData({
191
+ ...message_data,
192
+ messages: messages.filter(m => m.group_message_id != gm.group_message_id).concat(gm)
193
+ })
194
+ setMessageLoading(false);
195
+ }
196
+
197
+ const renderMessages = (data:{item:GroupMessageProps, index:number}) => {
198
+ const player = players.find(p => p.player_id == data.item.player_id)
199
+ const mine = player?.player_id == me?.player_id ? true: false
200
+ return (
201
+ <View style={{ margin:5 }}>
202
+ <GroupMessageCard
203
+ player={player}
204
+ me={me}
205
+ width={chat_size.width}
206
+ mine={mine}
207
+ onSelectImage={onSelectImage}
208
+ group_message={data.item}
209
+ onSelectTag={onSelectTag}
210
+ />
211
+ </View>
212
+ )
213
+ }
214
+
215
+ const renderDates = (data:{ item:string, index:number }) => {
216
+ const date_messages = messages.filter(m => moment(m.create_datetime).format('MMM DD YYYY') == data.item);
217
+
218
+ return (
219
+ <View>
220
+ <View style={{ padding:10 }}>
221
+ <Text size={16} theme="light" textAlign="center">{data.item}</Text>
222
+ </View>
223
+ <FlatList
224
+ key={'date_messages'}
225
+ keyExtractor={(item) => item.group_message_id.toString()}
226
+ data={date_messages.sort((a,b) => moment(a.create_datetime).unix() - moment(b.create_datetime).unix())}
227
+ renderItem={renderMessages}
228
+ />
229
+ </View>
230
+ )
231
+ }
232
+
233
+ return (
234
+ <View style={{ flex:1 }} onLayout={(ev) => {
235
+ const { height, width } = ev.nativeEvent.layout;
236
+ setChatSize({ height, width });
237
+ }}>
238
+ {group?.type == 'direct' && chat_player ?
239
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
240
+ <View transparent>
241
+ <Image
242
+ source={{ uri: chat_player.profile_pic }}
243
+ style={{ height:40, width:40, borderRadius:100 }}
244
+ resizeMode="cover"
245
+ />
246
+ </View>
247
+ <View transparent style={{ flex:1, marginLeft:10 }}>
248
+ <Text theme="h1">@{chat_player.username}</Text>
249
+ <Text style={{ marginTop:3 }} theme="description">Joined {moment(chat_player.create_datetime).fromNow()}</Text>
250
+ </View>
251
+ </View>
252
+ :group ?
253
+ <View type='header' style={{ flexDirection:'row', alignItems:'center', padding:10 }}>
254
+ <View transparent>
255
+ <Image
256
+ source={{ uri: group.group_image?.url }}
257
+ style={{ height:40, width:40, borderRadius:100 }}
258
+ resizeMode="cover"
259
+ />
260
+ </View>
261
+ <View transparent style={{ flex:1, marginLeft:10 }}>
262
+ <Text theme="h1">{group.name}</Text>
263
+ <Text style={{ marginTop:3 }} theme="description">{moment(group.last_update_datetime).format('YYYY MM DD')}</Text>
264
+ </View>
265
+ </View>
266
+ :<></>}
267
+ <View style={{ flex:1 }}>
268
+ <FlatList
269
+ ref={chat_ref}
270
+ data={unique_dates}
271
+ inverted
272
+ style={{ flex:1 }}
273
+ renderItem={renderDates}
274
+ key={`chat_${group_id}dates`}
275
+ keyExtractor={(item) => item}
276
+ />
277
+
278
+ </View>
279
+ {show_input_bar ?
280
+ <View type='header' style={{ padding:5 }}>
281
+ <InputBar
282
+ actions={['image']}
283
+ width={200}
284
+ onImageUpload={(image) => handleSendImage(image)}
285
+ />
286
+ </View>
287
+ :<></>}
288
+ <View type='footer' style={{ padding:5 }}>
289
+ <FormattedTextInput
290
+ submit_placement='inline'
291
+ icon_submit
292
+ width={width}
293
+ onSelectInput={() => setShowInputBar(!show_input_bar)}
294
+ onSubmit={(data, tags) => handleSendMessage(data, tags)}
295
+ onFocusPosition={onFocusPosition}
296
+ />
297
+ </View>
298
+ {group ?
299
+ <SocketManager
300
+ distinct_id={distinct_id}
301
+ access_token={access_token}
302
+ group_id={group.group_id}
303
+ subscribed_events={['V1_UPDATE_GROUP_MESSAGE']}
304
+ onConnect={() => {
305
+ if(!needs_reload){ return }
306
+ if(group_id){ return getGroupFromServer(group_id) }
307
+ if(player_id){ return getChatFromServer(player_id) }
308
+ return
309
+ }}
310
+ onDisconnect={() => {
311
+ setNeedsReload(true)
312
+ }}
313
+ onSocketEvent={(ev) => {
314
+ if(!ev.data){ return }
315
+ let gm:GroupMessageProps = ev.data;
316
+ if(gm.group_id != group.group_id){ return }
317
+ setSocketMessage(gm);
318
+ }}
319
+ />
320
+ :<></>}
321
+ {loading ?
322
+ <View type='blur' style={{ position:'absolute', top:0, left:0, right:0, bottom:0, alignItems:'center', padding:20 }}>
323
+ <ActivityIndicator
324
+ size='large'
325
+ color={Colors.text.h1}
326
+ />
327
+ </View>
328
+ :<></>}
329
+ </View>
330
+ )
331
+ }
332
+
333
+ export default GroupChat