@amityco/react-native-social-uikit 4.3.1-53502fc9.0 → 4.3.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 (192) hide show
  1. package/README.md +89 -0
  2. package/lib/commonjs/chat/hooks/index.js +11 -0
  3. package/lib/commonjs/chat/hooks/index.js.map +1 -1
  4. package/lib/commonjs/chat/hooks/usePageParams.js +21 -0
  5. package/lib/commonjs/chat/hooks/usePageParams.js.map +1 -0
  6. package/lib/commonjs/chat/pages/AmityAddGroupMemberPage/index.js +4 -4
  7. package/lib/commonjs/chat/pages/AmityAddGroupMemberPage/index.js.map +1 -1
  8. package/lib/commonjs/chat/pages/AmityArchivedChatPage/index.js +1 -0
  9. package/lib/commonjs/chat/pages/AmityArchivedChatPage/index.js.map +1 -1
  10. package/lib/commonjs/chat/pages/AmityBannedGroupMemberListPage/index.js +4 -4
  11. package/lib/commonjs/chat/pages/AmityBannedGroupMemberListPage/index.js.map +1 -1
  12. package/lib/commonjs/chat/pages/AmityChannelCreateConversationPage/index.js +1 -0
  13. package/lib/commonjs/chat/pages/AmityChannelCreateConversationPage/index.js.map +1 -1
  14. package/lib/commonjs/chat/pages/AmityChatHomePage/index.js +1 -0
  15. package/lib/commonjs/chat/pages/AmityChatHomePage/index.js.map +1 -1
  16. package/lib/commonjs/chat/pages/AmityChatPage/index.js +5 -4
  17. package/lib/commonjs/chat/pages/AmityChatPage/index.js.map +1 -1
  18. package/lib/commonjs/chat/pages/AmityCreateGroupChatPage/index.js +4 -5
  19. package/lib/commonjs/chat/pages/AmityCreateGroupChatPage/index.js.map +1 -1
  20. package/lib/commonjs/chat/pages/AmityEditGroupMemberPermissionsPage/index.js +4 -5
  21. package/lib/commonjs/chat/pages/AmityEditGroupMemberPermissionsPage/index.js.map +1 -1
  22. package/lib/commonjs/chat/pages/AmityEditGroupNotificationPage/index.js +4 -9
  23. package/lib/commonjs/chat/pages/AmityEditGroupNotificationPage/index.js.map +1 -1
  24. package/lib/commonjs/chat/pages/AmityEditGroupProfilePage/index.js +4 -5
  25. package/lib/commonjs/chat/pages/AmityEditGroupProfilePage/index.js.map +1 -1
  26. package/lib/commonjs/chat/pages/AmityGroupChatPage/index.js +4 -4
  27. package/lib/commonjs/chat/pages/AmityGroupChatPage/index.js.map +1 -1
  28. package/lib/commonjs/chat/pages/AmityGroupMemberListPage/index.js +4 -4
  29. package/lib/commonjs/chat/pages/AmityGroupMemberListPage/index.js.map +1 -1
  30. package/lib/commonjs/chat/pages/AmityGroupNotificationPreferencePage/index.js +4 -9
  31. package/lib/commonjs/chat/pages/AmityGroupNotificationPreferencePage/index.js.map +1 -1
  32. package/lib/commonjs/chat/pages/AmityGroupSettingPage/index.js +4 -5
  33. package/lib/commonjs/chat/pages/AmityGroupSettingPage/index.js.map +1 -1
  34. package/lib/commonjs/chat/pages/AmitySearchChannelPage/index.js +1 -0
  35. package/lib/commonjs/chat/pages/AmitySearchChannelPage/index.js.map +1 -1
  36. package/lib/commonjs/chat/pages/AmitySelectGroupMemberPage/index.js +4 -5
  37. package/lib/commonjs/chat/pages/AmitySelectGroupMemberPage/index.js.map +1 -1
  38. package/lib/commonjs/chat/pages/index.js +119 -0
  39. package/lib/commonjs/chat/pages/index.js.map +1 -0
  40. package/lib/commonjs/core/hooks/useUpload.js +3 -4
  41. package/lib/commonjs/core/hooks/useUpload.js.map +1 -1
  42. package/lib/commonjs/core/localization/LocaleProvider.js +17 -3
  43. package/lib/commonjs/core/localization/LocaleProvider.js.map +1 -1
  44. package/lib/commonjs/core/localization/defaultLocaleMap.js +2 -11
  45. package/lib/commonjs/core/localization/defaultLocaleMap.js.map +1 -1
  46. package/lib/commonjs/core/localization/index.js +0 -7
  47. package/lib/commonjs/core/localization/index.js.map +1 -1
  48. package/lib/commonjs/core/providers/AmityUIKitProvider.js +7 -2
  49. package/lib/commonjs/core/providers/AmityUIKitProvider.js.map +1 -1
  50. package/lib/commonjs/core/routes/AmityPageRenderer.js +36 -1
  51. package/lib/commonjs/core/routes/AmityPageRenderer.js.map +1 -1
  52. package/lib/commonjs/index.js +116 -0
  53. package/lib/commonjs/index.js.map +1 -1
  54. package/lib/module/chat/hooks/index.js +1 -0
  55. package/lib/module/chat/hooks/index.js.map +1 -1
  56. package/lib/module/chat/hooks/usePageParams.js +15 -0
  57. package/lib/module/chat/hooks/usePageParams.js.map +1 -0
  58. package/lib/module/chat/pages/AmityAddGroupMemberPage/index.js +5 -5
  59. package/lib/module/chat/pages/AmityAddGroupMemberPage/index.js.map +1 -1
  60. package/lib/module/chat/pages/AmityArchivedChatPage/index.js +1 -0
  61. package/lib/module/chat/pages/AmityArchivedChatPage/index.js.map +1 -1
  62. package/lib/module/chat/pages/AmityBannedGroupMemberListPage/index.js +5 -5
  63. package/lib/module/chat/pages/AmityBannedGroupMemberListPage/index.js.map +1 -1
  64. package/lib/module/chat/pages/AmityChannelCreateConversationPage/index.js +1 -0
  65. package/lib/module/chat/pages/AmityChannelCreateConversationPage/index.js.map +1 -1
  66. package/lib/module/chat/pages/AmityChatHomePage/index.js +1 -0
  67. package/lib/module/chat/pages/AmityChatHomePage/index.js.map +1 -1
  68. package/lib/module/chat/pages/AmityChatPage/index.js +6 -5
  69. package/lib/module/chat/pages/AmityChatPage/index.js.map +1 -1
  70. package/lib/module/chat/pages/AmityCreateGroupChatPage/index.js +4 -5
  71. package/lib/module/chat/pages/AmityCreateGroupChatPage/index.js.map +1 -1
  72. package/lib/module/chat/pages/AmityEditGroupMemberPermissionsPage/index.js +4 -5
  73. package/lib/module/chat/pages/AmityEditGroupMemberPermissionsPage/index.js.map +1 -1
  74. package/lib/module/chat/pages/AmityEditGroupNotificationPage/index.js +4 -9
  75. package/lib/module/chat/pages/AmityEditGroupNotificationPage/index.js.map +1 -1
  76. package/lib/module/chat/pages/AmityEditGroupProfilePage/index.js +4 -5
  77. package/lib/module/chat/pages/AmityEditGroupProfilePage/index.js.map +1 -1
  78. package/lib/module/chat/pages/AmityGroupChatPage/index.js +5 -5
  79. package/lib/module/chat/pages/AmityGroupChatPage/index.js.map +1 -1
  80. package/lib/module/chat/pages/AmityGroupMemberListPage/index.js +5 -5
  81. package/lib/module/chat/pages/AmityGroupMemberListPage/index.js.map +1 -1
  82. package/lib/module/chat/pages/AmityGroupNotificationPreferencePage/index.js +4 -9
  83. package/lib/module/chat/pages/AmityGroupNotificationPreferencePage/index.js.map +1 -1
  84. package/lib/module/chat/pages/AmityGroupSettingPage/index.js +4 -5
  85. package/lib/module/chat/pages/AmityGroupSettingPage/index.js.map +1 -1
  86. package/lib/module/chat/pages/AmitySearchChannelPage/index.js +1 -0
  87. package/lib/module/chat/pages/AmitySearchChannelPage/index.js.map +1 -1
  88. package/lib/module/chat/pages/AmitySelectGroupMemberPage/index.js +4 -5
  89. package/lib/module/chat/pages/AmitySelectGroupMemberPage/index.js.map +1 -1
  90. package/lib/module/chat/pages/index.js +17 -0
  91. package/lib/module/chat/pages/index.js.map +1 -0
  92. package/lib/module/core/hooks/useUpload.js +3 -4
  93. package/lib/module/core/hooks/useUpload.js.map +1 -1
  94. package/lib/module/core/localization/LocaleProvider.js +17 -3
  95. package/lib/module/core/localization/LocaleProvider.js.map +1 -1
  96. package/lib/module/core/localization/defaultLocaleMap.js +2 -10
  97. package/lib/module/core/localization/defaultLocaleMap.js.map +1 -1
  98. package/lib/module/core/localization/index.js +2 -3
  99. package/lib/module/core/localization/index.js.map +1 -1
  100. package/lib/module/core/providers/AmityUIKitProvider.js +7 -2
  101. package/lib/module/core/providers/AmityUIKitProvider.js.map +1 -1
  102. package/lib/module/core/routes/AmityPageRenderer.js +37 -1
  103. package/lib/module/core/routes/AmityPageRenderer.js.map +1 -1
  104. package/lib/module/index.js +3 -1
  105. package/lib/module/index.js.map +1 -1
  106. package/lib/typescript/chat/hooks/index.d.ts +1 -0
  107. package/lib/typescript/chat/hooks/index.d.ts.map +1 -1
  108. package/lib/typescript/chat/hooks/usePageParams.d.ts +10 -0
  109. package/lib/typescript/chat/hooks/usePageParams.d.ts.map +1 -0
  110. package/lib/typescript/chat/pages/AmityAddGroupMemberPage/index.d.ts +7 -1
  111. package/lib/typescript/chat/pages/AmityAddGroupMemberPage/index.d.ts.map +1 -1
  112. package/lib/typescript/chat/pages/AmityArchivedChatPage/index.d.ts +5 -1
  113. package/lib/typescript/chat/pages/AmityArchivedChatPage/index.d.ts.map +1 -1
  114. package/lib/typescript/chat/pages/AmityBannedGroupMemberListPage/index.d.ts +7 -1
  115. package/lib/typescript/chat/pages/AmityBannedGroupMemberListPage/index.d.ts.map +1 -1
  116. package/lib/typescript/chat/pages/AmityChannelCreateConversationPage/index.d.ts +5 -1
  117. package/lib/typescript/chat/pages/AmityChannelCreateConversationPage/index.d.ts.map +1 -1
  118. package/lib/typescript/chat/pages/AmityChatHomePage/index.d.ts +5 -1
  119. package/lib/typescript/chat/pages/AmityChatHomePage/index.d.ts.map +1 -1
  120. package/lib/typescript/chat/pages/AmityChatPage/index.d.ts +7 -1
  121. package/lib/typescript/chat/pages/AmityChatPage/index.d.ts.map +1 -1
  122. package/lib/typescript/chat/pages/AmityCreateGroupChatPage/index.d.ts +7 -1
  123. package/lib/typescript/chat/pages/AmityCreateGroupChatPage/index.d.ts.map +1 -1
  124. package/lib/typescript/chat/pages/AmityEditGroupMemberPermissionsPage/index.d.ts +7 -1
  125. package/lib/typescript/chat/pages/AmityEditGroupMemberPermissionsPage/index.d.ts.map +1 -1
  126. package/lib/typescript/chat/pages/AmityEditGroupNotificationPage/index.d.ts +7 -1
  127. package/lib/typescript/chat/pages/AmityEditGroupNotificationPage/index.d.ts.map +1 -1
  128. package/lib/typescript/chat/pages/AmityEditGroupProfilePage/index.d.ts +7 -1
  129. package/lib/typescript/chat/pages/AmityEditGroupProfilePage/index.d.ts.map +1 -1
  130. package/lib/typescript/chat/pages/AmityGroupChatPage/index.d.ts +7 -1
  131. package/lib/typescript/chat/pages/AmityGroupChatPage/index.d.ts.map +1 -1
  132. package/lib/typescript/chat/pages/AmityGroupMemberListPage/index.d.ts +7 -1
  133. package/lib/typescript/chat/pages/AmityGroupMemberListPage/index.d.ts.map +1 -1
  134. package/lib/typescript/chat/pages/AmityGroupNotificationPreferencePage/index.d.ts +7 -1
  135. package/lib/typescript/chat/pages/AmityGroupNotificationPreferencePage/index.d.ts.map +1 -1
  136. package/lib/typescript/chat/pages/AmityGroupSettingPage/index.d.ts +7 -1
  137. package/lib/typescript/chat/pages/AmityGroupSettingPage/index.d.ts.map +1 -1
  138. package/lib/typescript/chat/pages/AmitySearchChannelPage/index.d.ts +5 -1
  139. package/lib/typescript/chat/pages/AmitySearchChannelPage/index.d.ts.map +1 -1
  140. package/lib/typescript/chat/pages/AmitySelectGroupMemberPage/index.d.ts +7 -1
  141. package/lib/typescript/chat/pages/AmitySelectGroupMemberPage/index.d.ts.map +1 -1
  142. package/lib/typescript/chat/pages/index.d.ts +29 -0
  143. package/lib/typescript/chat/pages/index.d.ts.map +1 -0
  144. package/lib/typescript/core/hooks/useUpload.d.ts.map +1 -1
  145. package/lib/typescript/core/localization/LocaleProvider.d.ts +1 -1
  146. package/lib/typescript/core/localization/LocaleProvider.d.ts.map +1 -1
  147. package/lib/typescript/core/localization/defaultLocaleMap.d.ts +1 -6
  148. package/lib/typescript/core/localization/defaultLocaleMap.d.ts.map +1 -1
  149. package/lib/typescript/core/localization/index.d.ts +1 -2
  150. package/lib/typescript/core/localization/index.d.ts.map +1 -1
  151. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts +22 -1
  152. package/lib/typescript/core/providers/AmityUIKitProvider.d.ts.map +1 -1
  153. package/lib/typescript/core/routes/AmityPageRenderer.d.ts.map +1 -1
  154. package/lib/typescript/index.d.ts +5 -1
  155. package/lib/typescript/index.d.ts.map +1 -1
  156. package/package.json +1 -1
  157. package/src/chat/hooks/index.ts +1 -0
  158. package/src/chat/hooks/usePageParams.ts +17 -0
  159. package/src/chat/pages/AmityAddGroupMemberPage/index.tsx +11 -8
  160. package/src/chat/pages/AmityArchivedChatPage/index.tsx +2 -0
  161. package/src/chat/pages/AmityBannedGroupMemberListPage/index.tsx +11 -8
  162. package/src/chat/pages/AmityChannelCreateConversationPage/index.tsx +3 -0
  163. package/src/chat/pages/AmityChatHomePage/index.tsx +2 -0
  164. package/src/chat/pages/AmityChatPage/index.tsx +8 -7
  165. package/src/chat/pages/AmityCreateGroupChatPage/index.tsx +10 -4
  166. package/src/chat/pages/AmityEditGroupMemberPermissionsPage/index.tsx +11 -6
  167. package/src/chat/pages/AmityEditGroupNotificationPage/index.tsx +10 -11
  168. package/src/chat/pages/AmityEditGroupProfilePage/index.tsx +10 -4
  169. package/src/chat/pages/AmityGroupChatPage/index.tsx +10 -8
  170. package/src/chat/pages/AmityGroupMemberListPage/index.tsx +11 -8
  171. package/src/chat/pages/AmityGroupNotificationPreferencePage/index.tsx +11 -11
  172. package/src/chat/pages/AmityGroupSettingPage/index.tsx +10 -4
  173. package/src/chat/pages/AmitySearchChannelPage/index.tsx +2 -0
  174. package/src/chat/pages/AmitySelectGroupMemberPage/index.tsx +11 -4
  175. package/src/chat/pages/index.ts +28 -0
  176. package/src/core/hooks/useUpload.ts +3 -4
  177. package/src/core/localization/LocaleProvider.tsx +18 -4
  178. package/src/core/localization/defaultLocaleMap.ts +2 -10
  179. package/src/core/localization/index.ts +2 -3
  180. package/src/core/providers/AmityUIKitProvider.tsx +27 -2
  181. package/src/core/routes/AmityPageRenderer.tsx +60 -4
  182. package/src/index.tsx +55 -0
  183. package/lib/commonjs/core/localization/defaults/th.js +0 -29
  184. package/lib/commonjs/core/localization/defaults/th.js.map +0 -1
  185. package/lib/commonjs/core/localization/defaults/th.json +0 -1179
  186. package/lib/module/core/localization/defaults/th.js +0 -22
  187. package/lib/module/core/localization/defaults/th.js.map +0 -1
  188. package/lib/module/core/localization/defaults/th.json +0 -1179
  189. package/lib/typescript/core/localization/defaults/th.d.ts +0 -18
  190. package/lib/typescript/core/localization/defaults/th.d.ts.map +0 -1
  191. package/src/core/localization/defaults/th.json +0 -1179
  192. package/src/core/localization/defaults/th.ts +0 -22
@@ -1,14 +1,18 @@
1
1
  // AmityCreateGroupChatPage — name/avatar/privacy for a new group (step 2 of create).
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import { useRoute, type RouteProp } from '@react-navigation/native';
4
3
 
5
4
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
6
5
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
6
+ import { usePageParams } from '../../hooks/usePageParams';
7
7
  import { CreateGroupChat } from '../../features/group/create';
8
8
 
9
- export default function AmityCreateGroupChatPage() {
10
- const { params } =
11
- useRoute<RouteProp<RootStackParamList, 'AmityCreateGroupChatPage'>>();
9
+ export type AmityCreateGroupChatPageProps =
10
+ RootStackParamList['AmityCreateGroupChatPage'];
11
+
12
+ export default function AmityCreateGroupChatPage(
13
+ props: Partial<AmityCreateGroupChatPageProps>
14
+ ) {
15
+ const params = usePageParams<'AmityCreateGroupChatPage'>(props);
12
16
 
13
17
  return (
14
18
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -18,3 +22,5 @@ export default function AmityCreateGroupChatPage() {
18
22
  </SafeAreaView>
19
23
  );
20
24
  }
25
+
26
+ AmityCreateGroupChatPage.displayName = 'AmityCreateGroupChatPage';
@@ -1,16 +1,18 @@
1
1
  // AmityEditGroupMemberPermissionsPage — who can send messages (everyone / moderators).
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import { useRoute, type RouteProp } from '@react-navigation/native';
4
3
 
5
4
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
6
5
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
6
+ import { usePageParams } from '../../hooks/usePageParams';
7
7
  import { EditGroupMemberPermissions } from '../../features/group/edit-permission';
8
8
 
9
- export default function AmityEditGroupMemberPermissionsPage() {
10
- const { params } =
11
- useRoute<
12
- RouteProp<RootStackParamList, 'AmityEditGroupMemberPermissionsPage'>
13
- >();
9
+ export type AmityEditGroupMemberPermissionsPageProps =
10
+ RootStackParamList['AmityEditGroupMemberPermissionsPage'];
11
+
12
+ export default function AmityEditGroupMemberPermissionsPage(
13
+ props: Partial<AmityEditGroupMemberPermissionsPageProps>
14
+ ) {
15
+ const params = usePageParams<'AmityEditGroupMemberPermissionsPage'>(props);
14
16
 
15
17
  return (
16
18
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -20,3 +22,6 @@ export default function AmityEditGroupMemberPermissionsPage() {
20
22
  </SafeAreaView>
21
23
  );
22
24
  }
25
+
26
+ AmityEditGroupMemberPermissionsPage.displayName =
27
+ 'AmityEditGroupMemberPermissionsPage';
@@ -1,23 +1,20 @@
1
1
  // AmityEditGroupNotificationPage — the notification-mode radio screen
2
2
  // (default / silent / subscribe). Ported from AmityUiKitWeb
3
3
  // v4/chat/pages/EditGroupNotificationPage.
4
- //
5
- // RN adaptation: the route is not yet registered in RouteParamList (the
6
- // orchestrator wires it), so the channelId param is typed locally to keep this
7
- // file compiling independently.
8
4
  import { SafeAreaView } from 'react-native-safe-area-context';
9
- import { useRoute, type RouteProp } from '@react-navigation/native';
10
5
 
6
+ import type { RootStackParamList } from '../../../core/routes/RouteParamList';
7
+ import { usePageParams } from '../../hooks/usePageParams';
11
8
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
12
9
  import { EditGroupNotification } from '../../features/group/edit-notification';
13
10
 
14
- type ParamList = {
15
- AmityEditGroupNotificationPage: { channelId: string };
16
- };
11
+ export type AmityEditGroupNotificationPageProps =
12
+ RootStackParamList['AmityEditGroupNotificationPage'];
17
13
 
18
- export default function AmityEditGroupNotificationPage() {
19
- const { params } =
20
- useRoute<RouteProp<ParamList, 'AmityEditGroupNotificationPage'>>();
14
+ export default function AmityEditGroupNotificationPage(
15
+ props: Partial<AmityEditGroupNotificationPageProps>
16
+ ) {
17
+ const params = usePageParams<'AmityEditGroupNotificationPage'>(props);
21
18
 
22
19
  return (
23
20
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -27,3 +24,5 @@ export default function AmityEditGroupNotificationPage() {
27
24
  </SafeAreaView>
28
25
  );
29
26
  }
27
+
28
+ AmityEditGroupNotificationPage.displayName = 'AmityEditGroupNotificationPage';
@@ -1,14 +1,18 @@
1
1
  // AmityEditGroupProfilePage — edit group name + avatar.
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import { useRoute, type RouteProp } from '@react-navigation/native';
4
3
 
5
4
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
6
5
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
6
+ import { usePageParams } from '../../hooks/usePageParams';
7
7
  import { EditGroupProfile } from '../../features/group/edit-profile';
8
8
 
9
- export default function AmityEditGroupProfilePage() {
10
- const { params } =
11
- useRoute<RouteProp<RootStackParamList, 'AmityEditGroupProfilePage'>>();
9
+ export type AmityEditGroupProfilePageProps =
10
+ RootStackParamList['AmityEditGroupProfilePage'];
11
+
12
+ export default function AmityEditGroupProfilePage(
13
+ props: Partial<AmityEditGroupProfilePageProps>
14
+ ) {
15
+ const params = usePageParams<'AmityEditGroupProfilePage'>(props);
12
16
 
13
17
  return (
14
18
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -18,3 +22,5 @@ export default function AmityEditGroupProfilePage() {
18
22
  </SafeAreaView>
19
23
  );
20
24
  }
25
+
26
+ AmityEditGroupProfilePage.displayName = 'AmityEditGroupProfilePage';
@@ -1,22 +1,22 @@
1
1
  // AmityGroupChatPage — navigation destination for a group (community) conversation.
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import {
4
- useNavigation,
5
- useRoute,
6
- type RouteProp,
7
- } from '@react-navigation/native';
3
+ import { useNavigation } from '@react-navigation/native';
8
4
  import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
9
5
 
10
6
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
11
7
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
8
+ import { usePageParams } from '../../hooks/usePageParams';
12
9
  import { GroupChat } from '../../features/group/chat';
13
10
  import { ChatSurface } from '../../hooks/useChatSurfaceHeight';
14
11
 
15
- export default function AmityGroupChatPage() {
12
+ export type AmityGroupChatPageProps = RootStackParamList['AmityGroupChatPage'];
13
+
14
+ export default function AmityGroupChatPage(
15
+ props: Partial<AmityGroupChatPageProps>
16
+ ) {
16
17
  const navigation =
17
18
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
18
- const { params } =
19
- useRoute<RouteProp<RootStackParamList, 'AmityGroupChatPage'>>();
19
+ const params = usePageParams<'AmityGroupChatPage'>(props);
20
20
 
21
21
  return (
22
22
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -36,3 +36,5 @@ export default function AmityGroupChatPage() {
36
36
  </SafeAreaView>
37
37
  );
38
38
  }
39
+
40
+ AmityGroupChatPage.displayName = 'AmityGroupChatPage';
@@ -1,21 +1,22 @@
1
1
  // AmityGroupMemberListPage — group members list (member/moderator tabs).
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import {
4
- useNavigation,
5
- useRoute,
6
- type RouteProp,
7
- } from '@react-navigation/native';
3
+ import { useNavigation } from '@react-navigation/native';
8
4
  import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
9
5
 
10
6
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
11
7
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
8
+ import { usePageParams } from '../../hooks/usePageParams';
12
9
  import { GroupMembers } from '../../features/group/members';
13
10
 
14
- export default function AmityGroupMemberListPage() {
11
+ export type AmityGroupMemberListPageProps =
12
+ RootStackParamList['AmityGroupMemberListPage'];
13
+
14
+ export default function AmityGroupMemberListPage(
15
+ props: Partial<AmityGroupMemberListPageProps>
16
+ ) {
15
17
  const navigation =
16
18
  useNavigation<NativeStackNavigationProp<RootStackParamList>>();
17
- const { params } =
18
- useRoute<RouteProp<RootStackParamList, 'AmityGroupMemberListPage'>>();
19
+ const params = usePageParams<'AmityGroupMemberListPage'>(props);
19
20
 
20
21
  return (
21
22
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -33,3 +34,5 @@ export default function AmityGroupMemberListPage() {
33
34
  </SafeAreaView>
34
35
  );
35
36
  }
37
+
38
+ AmityGroupMemberListPage.displayName = 'AmityGroupMemberListPage';
@@ -1,22 +1,19 @@
1
1
  // AmityGroupNotificationPreferencePage — the "allow notifications" toggle screen.
2
2
  // Ported from AmityUiKitWeb v4/chat/pages/GroupNotificationPreferencePage.
3
- //
4
- // RN adaptation: the route is not yet registered in RouteParamList (the
5
- // orchestrator wires it), so the channelId param is typed locally to keep this
6
- // file compiling independently.
7
3
  import { SafeAreaView } from 'react-native-safe-area-context';
8
- import { useRoute, type RouteProp } from '@react-navigation/native';
9
4
 
5
+ import type { RootStackParamList } from '../../../core/routes/RouteParamList';
6
+ import { usePageParams } from '../../hooks/usePageParams';
10
7
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
11
8
  import { NotificationPreference } from '../../features/group/notification-preference';
12
9
 
13
- type ParamList = {
14
- AmityGroupNotificationPreferencePage: { channelId: string };
15
- };
10
+ export type AmityGroupNotificationPreferencePageProps =
11
+ RootStackParamList['AmityGroupNotificationPreferencePage'];
16
12
 
17
- export default function AmityGroupNotificationPreferencePage() {
18
- const { params } =
19
- useRoute<RouteProp<ParamList, 'AmityGroupNotificationPreferencePage'>>();
13
+ export default function AmityGroupNotificationPreferencePage(
14
+ props: Partial<AmityGroupNotificationPreferencePageProps>
15
+ ) {
16
+ const params = usePageParams<'AmityGroupNotificationPreferencePage'>(props);
20
17
 
21
18
  return (
22
19
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -26,3 +23,6 @@ export default function AmityGroupNotificationPreferencePage() {
26
23
  </SafeAreaView>
27
24
  );
28
25
  }
26
+
27
+ AmityGroupNotificationPreferencePage.displayName =
28
+ 'AmityGroupNotificationPreferencePage';
@@ -1,14 +1,18 @@
1
1
  // AmityGroupSettingPage — group settings (members, edit profile, permissions, leave).
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import { useRoute, type RouteProp } from '@react-navigation/native';
4
3
 
5
4
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
6
5
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
6
+ import { usePageParams } from '../../hooks/usePageParams';
7
7
  import { GroupSetting } from '../../features/group/setting';
8
8
 
9
- export default function AmityGroupSettingPage() {
10
- const { params } =
11
- useRoute<RouteProp<RootStackParamList, 'AmityGroupSettingPage'>>();
9
+ export type AmityGroupSettingPageProps =
10
+ RootStackParamList['AmityGroupSettingPage'];
11
+
12
+ export default function AmityGroupSettingPage(
13
+ props: Partial<AmityGroupSettingPageProps>
14
+ ) {
15
+ const params = usePageParams<'AmityGroupSettingPage'>(props);
12
16
 
13
17
  return (
14
18
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -18,3 +22,5 @@ export default function AmityGroupSettingPage() {
18
22
  </SafeAreaView>
19
23
  );
20
24
  }
25
+
26
+ AmityGroupSettingPage.displayName = 'AmityGroupSettingPage';
@@ -20,3 +20,5 @@ export default function AmitySearchChannelPage() {
20
20
  </SafeAreaView>
21
21
  );
22
22
  }
23
+
24
+ AmitySearchChannelPage.displayName = 'AmitySearchChannelPage';
@@ -1,20 +1,25 @@
1
1
  // AmitySelectGroupMemberPage — pick members for a new group (step 1 of create).
2
2
  import { SafeAreaView } from 'react-native-safe-area-context';
3
- import { useRoute, type RouteProp } from '@react-navigation/native';
4
3
 
5
4
  import { ChatKeyboardAvoidingView } from '../../elements/ChatKeyboardAvoidingView';
6
5
  import type { RootStackParamList } from '../../../core/routes/RouteParamList';
6
+ import { usePageParams } from '../../hooks/usePageParams';
7
7
  import { SelectGroupMember } from '../../features/group/select-member';
8
8
 
9
- export default function AmitySelectGroupMemberPage() {
9
+ export type AmitySelectGroupMemberPageProps = NonNullable<
10
+ RootStackParamList['AmitySelectGroupMemberPage']
11
+ >;
12
+
13
+ export default function AmitySelectGroupMemberPage(
14
+ props: Partial<AmitySelectGroupMemberPageProps>
15
+ ) {
10
16
  // Web reads the same value off `currentPage.context?.selectedGroupMember` in
11
17
  // Application.tsx and hands it to SelectGroupMember. RN's route params are the
12
18
  // equivalent carrier: `useCreateGroupChat.handleAddMember` already navigates
13
19
  // here with the members chosen so far, and dropping them meant the picker
14
20
  // reopened empty and its submit then REPLACED the create screen's list with
15
21
  // only the newly ticked users.
16
- const { params } =
17
- useRoute<RouteProp<RootStackParamList, 'AmitySelectGroupMemberPage'>>();
22
+ const params = usePageParams<'AmitySelectGroupMemberPage'>(props);
18
23
 
19
24
  return (
20
25
  <SafeAreaView edges={['top', 'left', 'right']} style={{ flex: 1 }}>
@@ -24,3 +29,5 @@ export default function AmitySelectGroupMemberPage() {
24
29
  </SafeAreaView>
25
30
  );
26
31
  }
32
+
33
+ AmitySelectGroupMemberPage.displayName = 'AmitySelectGroupMemberPage';
@@ -0,0 +1,28 @@
1
+ export { default as AmityChatHomePage } from './AmityChatHomePage';
2
+ export { default as AmityChannelCreateConversationPage } from './AmityChannelCreateConversationPage';
3
+ export { default as AmitySelectGroupMemberPage } from './AmitySelectGroupMemberPage';
4
+ export type { AmitySelectGroupMemberPageProps } from './AmitySelectGroupMemberPage';
5
+ export { default as AmityCreateGroupChatPage } from './AmityCreateGroupChatPage';
6
+ export type { AmityCreateGroupChatPageProps } from './AmityCreateGroupChatPage';
7
+ export { default as AmityChatPage } from './AmityChatPage';
8
+ export type { AmityChatPageProps } from './AmityChatPage';
9
+ export { default as AmityGroupChatPage } from './AmityGroupChatPage';
10
+ export type { AmityGroupChatPageProps } from './AmityGroupChatPage';
11
+ export { default as AmityGroupSettingPage } from './AmityGroupSettingPage';
12
+ export type { AmityGroupSettingPageProps } from './AmityGroupSettingPage';
13
+ export { default as AmityEditGroupProfilePage } from './AmityEditGroupProfilePage';
14
+ export type { AmityEditGroupProfilePageProps } from './AmityEditGroupProfilePage';
15
+ export { default as AmityEditGroupNotificationPage } from './AmityEditGroupNotificationPage';
16
+ export type { AmityEditGroupNotificationPageProps } from './AmityEditGroupNotificationPage';
17
+ export { default as AmityEditGroupMemberPermissionsPage } from './AmityEditGroupMemberPermissionsPage';
18
+ export type { AmityEditGroupMemberPermissionsPageProps } from './AmityEditGroupMemberPermissionsPage';
19
+ export { default as AmityGroupNotificationPreferencePage } from './AmityGroupNotificationPreferencePage';
20
+ export type { AmityGroupNotificationPreferencePageProps } from './AmityGroupNotificationPreferencePage';
21
+ export { default as AmityGroupMemberListPage } from './AmityGroupMemberListPage';
22
+ export type { AmityGroupMemberListPageProps } from './AmityGroupMemberListPage';
23
+ export { default as AmityAddGroupMemberPage } from './AmityAddGroupMemberPage';
24
+ export type { AmityAddGroupMemberPageProps } from './AmityAddGroupMemberPage';
25
+ export { default as AmityBannedGroupMemberListPage } from './AmityBannedGroupMemberListPage';
26
+ export type { AmityBannedGroupMemberListPageProps } from './AmityBannedGroupMemberListPage';
27
+ export { default as AmityArchivedChatPage } from './AmityArchivedChatPage';
28
+ export { default as AmitySearchChannelPage } from './AmitySearchChannelPage';
@@ -56,10 +56,9 @@ export function useUpload() {
56
56
  {
57
57
  onError: (error) => {
58
58
  // Localized, and worded from the same four keys web resolves in
59
- // v4/social/hooks/useImageUpload. These were hardcoded
60
- // English, so th.json never applied even though every key was already
61
- // translated — and the generic body read "Please try again." where web
62
- // says "Upload Not Complete".
59
+ // v4/social/hooks/useImageUpload. These were hardcoded English, so a
60
+ // locale bundle never applied — and the generic body read "Please try
61
+ // again." where web says "Upload Not Complete".
63
62
  if (
64
63
  error.message.includes(ERROR_CODE.INVALID_IMAGE) ||
65
64
  error.message.includes(ERROR_CODE.VIOLENCE)
@@ -83,7 +83,7 @@ export interface LocaleProviderProps {
83
83
  * Falls back to English library defaults when no match is found.
84
84
  *
85
85
  * @example
86
- * localeMap={{ ja: jaLocale, th: thLocale }}
86
+ * localeMap={{ ja: jaLocale, ko: koLocale }}
87
87
  */
88
88
  localeMap?: Record<string, LocaleBundle>;
89
89
  }
@@ -92,6 +92,21 @@ export interface LocaleProviderProps {
92
92
  // Device-locale helper
93
93
  // ---------------------------------------------------------------------------
94
94
 
95
+ /**
96
+ * The device language as a BCP 47 tag (e.g. "th-TH"). React Native has no
97
+ * `navigator.language`, so fall back to the Intl locale, which Hermes and JSC
98
+ * take from the device settings.
99
+ */
100
+ function getDeviceLanguage(): string | undefined {
101
+ const nav = (globalThis as { navigator?: { language?: string } }).navigator;
102
+ if (nav && typeof nav.language === 'string' && nav.language) return nav.language;
103
+ try {
104
+ return Intl.DateTimeFormat().resolvedOptions().locale || undefined;
105
+ } catch {
106
+ return undefined;
107
+ }
108
+ }
109
+
95
110
  /**
96
111
  * Try to match the browser/device language against a caller-supplied locale map.
97
112
  * Returns the matched bundle, or undefined if no match (falls through to EN defaults).
@@ -99,9 +114,8 @@ export interface LocaleProviderProps {
99
114
  export function resolveDeviceLocale(
100
115
  localeMap: Record<string, LocaleBundle>,
101
116
  ): LocaleBundle | undefined {
102
- const nav = (globalThis as { navigator?: { language?: string } }).navigator;
103
- if (!nav || typeof nav.language !== 'string') return undefined;
104
- const lang = nav.language ?? '';
117
+ const lang = getDeviceLanguage();
118
+ if (!lang) return undefined;
105
119
  // 1. Exact match (e.g. "ja-JP" → localeMap["ja-JP"])
106
120
  if (localeMap[lang]) return localeMap[lang];
107
121
  // 2. Language-prefix match (e.g. "ja-JP" → localeMap["ja"])
@@ -7,17 +7,9 @@
7
7
  * import { defaultLocaleMap } from '~/v4/core/localization';
8
8
  * <AmityUIKitProvider localization={{ localeMap: defaultLocaleMap }} ... />
9
9
  *
10
- * Resolution order:
11
- * 1. Exact match: navigator.language === "th" → Thai bundle
12
- * 2. Prefix match: navigator.language === "th-TH" → Thai bundle
13
- * 3. No match: falls through to English library defaults
14
- *
15
- * Add more bundles here as additional locale files are created.
10
+ * Add locale bundles here to enable automatic device-language detection.
16
11
  */
17
12
 
18
- import thLocaleBundle from './defaults/th';
19
13
  import type { LocaleBundle } from './resolveString';
20
14
 
21
- export const defaultLocaleMap: Record<string, LocaleBundle> = {
22
- th: thLocaleBundle,
23
- };
15
+ export const defaultLocaleMap: Record<string, LocaleBundle> = {};
@@ -15,7 +15,7 @@
15
15
  * import type { LocaleBundle, FormatArg } from '~/v4/core/localization';
16
16
  *
17
17
  * Default bundles / locale map (device-language detection):
18
- * import { defaultLocaleBundle, thLocaleBundle, defaultLocaleMap } from '~/v4/core/localization';
18
+ * import { defaultLocaleBundle, defaultLocaleMap } from '~/v4/core/localization';
19
19
  */
20
20
 
21
21
  export {
@@ -37,7 +37,6 @@ export type { LocaleContextValue, LocaleProviderProps } from './LocaleProvider';
37
37
  export { useString } from './useString';
38
38
 
39
39
  // Default imports, then re-export under the public names — keeps the public API
40
- // identical while surviving either resolution of './defaults/en' | './defaults/th'.
40
+ // identical while surviving either resolution of './defaults/en'.
41
41
  export { default as defaultLocaleBundle } from './defaults/en';
42
- export { default as thLocaleBundle } from './defaults/th';
43
42
  export { defaultLocaleMap } from './defaultLocaleMap';
@@ -20,7 +20,7 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
20
20
  import { GestureHandlerRootView } from 'react-native-gesture-handler';
21
21
  import { ErrorBoundary } from '../components/ErrorBoundary';
22
22
  import { AmityThemeProvider } from '../design/theme';
23
- import { LocaleProvider } from '../localization';
23
+ import { LocaleProvider, type LocaleBundle } from '../localization';
24
24
 
25
25
  export type CusTomTheme = typeof DefaultTheme;
26
26
  export interface IAmityUIkitProvider {
@@ -39,6 +39,26 @@ export interface IAmityUIkitProvider {
39
39
  socialCommunityCreationButtonVisible?: boolean;
40
40
  /** When true, hides the Explore tab on the Social Home page. Default: false */
41
41
  hideExplore?: boolean;
42
+ /**
43
+ * Localization configuration for the UIKit (same shape as the web UIKit).
44
+ * - `localeBundle`: locale bundle to use (key → translated string)
45
+ * - `overrides`: individual keys that take precedence over the locale bundle
46
+ * - `localeMap`: map of locale code → bundle for automatic device-language
47
+ * detection. When `localeBundle` is not set, the device language is matched
48
+ * against this map (exact match, then language prefix). Falls back to
49
+ * English when nothing matches. Unset by default, so the UIKit renders in
50
+ * English unless the host passes its own bundles.
51
+ *
52
+ * @example
53
+ * localization={{ localeBundle: jaLocale }}
54
+ * @example
55
+ * localization={{ localeMap: { ja: jaLocale, ko: koLocale } }}
56
+ */
57
+ localization?: {
58
+ localeBundle?: LocaleBundle;
59
+ overrides?: LocaleBundle;
60
+ localeMap?: Record<string, LocaleBundle>;
61
+ };
42
62
  }
43
63
 
44
64
  export interface CustomColors {
@@ -85,6 +105,7 @@ export default function AmityUiKitProvider({
85
105
  fcmToken,
86
106
  socialCommunityCreationButtonVisible = true,
87
107
  hideExplore = false,
108
+ localization,
88
109
  }: IAmityUIkitProvider) {
89
110
  const colorScheme = useColorScheme();
90
111
  const SHADE_PERCENTAGES = [0.25, 0.4, 0.45, 0.6];
@@ -200,7 +221,11 @@ export default function AmityUiKitProvider({
200
221
  <AmityThemeProvider
201
222
  mode={isDarkTheme ? 'dark' : 'light'}
202
223
  >
203
- <LocaleProvider>
224
+ <LocaleProvider
225
+ initialLocaleBundle={localization?.localeBundle}
226
+ initialOverrides={localization?.overrides}
227
+ localeMap={localization?.localeMap}
228
+ >
204
229
  {children}
205
230
  <BottomSheetComponent />
206
231
  <Toast />
@@ -50,6 +50,45 @@ import LivestreamPostTargetSelection from '../../social/screens/LivestreamPostTa
50
50
  import CommunityMembership from '../../social/screens/CommunityMembership';
51
51
  import CreateLivestream from '../../social/screens/CreateLivestream';
52
52
  import LivestreamPlayer from '../../social/screens/LivestreamPlayer';
53
+ import {
54
+ AmityChatHomePage,
55
+ AmityChannelCreateConversationPage,
56
+ AmitySelectGroupMemberPage,
57
+ AmityCreateGroupChatPage,
58
+ AmityChatPage,
59
+ AmityGroupChatPage,
60
+ AmityGroupSettingPage,
61
+ AmityEditGroupProfilePage,
62
+ AmityEditGroupNotificationPage,
63
+ AmityEditGroupMemberPermissionsPage,
64
+ AmityGroupNotificationPreferencePage,
65
+ AmityGroupMemberListPage,
66
+ AmityAddGroupMemberPage,
67
+ AmityBannedGroupMemberListPage,
68
+ AmityArchivedChatPage,
69
+ AmitySearchChannelPage,
70
+ } from '../../chat/pages';
71
+
72
+ // Every chat page, so any of them can be rendered standalone and still reach
73
+ // the others: a chat page navigates to its neighbours by route name.
74
+ const CHAT_PAGES = {
75
+ AmityChatHomePage,
76
+ AmityChannelCreateConversationPage,
77
+ AmitySelectGroupMemberPage,
78
+ AmityCreateGroupChatPage,
79
+ AmityChatPage,
80
+ AmityGroupChatPage,
81
+ AmityGroupSettingPage,
82
+ AmityEditGroupProfilePage,
83
+ AmityEditGroupNotificationPage,
84
+ AmityEditGroupMemberPermissionsPage,
85
+ AmityGroupNotificationPreferencePage,
86
+ AmityGroupMemberListPage,
87
+ AmityAddGroupMemberPage,
88
+ AmityBannedGroupMemberListPage,
89
+ AmityArchivedChatPage,
90
+ AmitySearchChannelPage,
91
+ } satisfies Partial<Record<keyof RootStackParamList, React.ComponentType<any>>>;
53
92
 
54
93
  interface PageRendererProps {
55
94
  children: React.JSX.Element;
@@ -58,6 +97,8 @@ export default function PageRenderer({ children }: PageRendererProps) {
58
97
  const Stack = createNativeStackNavigator<RootStackParamList>();
59
98
  const { isConnected } = useAuth();
60
99
  const theme = useTheme() as MyMD3Theme;
100
+ const initialRouteName: keyof RootStackParamList =
101
+ children.type?.displayName || children.type?.name;
61
102
 
62
103
  return (
63
104
  <NavigationIndependentTree>
@@ -78,10 +119,7 @@ export default function PageRenderer({ children }: PageRendererProps) {
78
119
  color: theme.colors.base,
79
120
  },
80
121
  }}
81
- initialRouteName={
82
- children.type?.displayName ||
83
- (children.type?.name as keyof RootStackParamList)
84
- }
122
+ initialRouteName={initialRouteName}
85
123
  >
86
124
  <Stack.Screen
87
125
  name="AmityStoryTabComponent"
@@ -92,6 +130,24 @@ export default function PageRenderer({ children }: PageRendererProps) {
92
130
  children={() => children}
93
131
  />
94
132
 
133
+ {/* --- Chat --- */}
134
+ {(Object.keys(CHAT_PAGES) as (keyof typeof CHAT_PAGES)[]).map(
135
+ (name) => {
136
+ const Page: React.ComponentType<any> = CHAT_PAGES[name];
137
+ // The page the host rendered takes the host's props. The others
138
+ // are reached by navigation and read their route params.
139
+ return name === initialRouteName ? (
140
+ <Stack.Screen
141
+ key={name}
142
+ name={name}
143
+ children={() => <Page {...children.props} />}
144
+ />
145
+ ) : (
146
+ <Stack.Screen key={name} name={name} component={Page} />
147
+ );
148
+ }
149
+ )}
150
+
95
151
  {/* --- Social Home --- */}
96
152
  <Stack.Screen
97
153
  name="AmitySocialHomePage"