@sendbird/uikit-react-native 3.10.0 → 3.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/ChannelInput/index.js +13 -2
- package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/components/ChannelInput/index.js +13 -2
- package/lib/module/components/ChannelInput/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/components/ChannelInput/index.tsx +17 -6
- package/src/version.ts +1 -1
|
@@ -24,8 +24,10 @@ const AUTO_FOCUS = _reactNative.Platform.select({
|
|
|
24
24
|
android: true,
|
|
25
25
|
default: false
|
|
26
26
|
});
|
|
27
|
+
const isAndroidApi35 = _reactNative.Platform.OS === 'android' && _reactNative.Platform.Version >= 35;
|
|
27
28
|
const KEYBOARD_AVOID_VIEW_BEHAVIOR = _reactNative.Platform.select({
|
|
28
29
|
ios: 'padding',
|
|
30
|
+
android: isAndroidApi35 ? 'padding' : undefined,
|
|
29
31
|
default: undefined
|
|
30
32
|
});
|
|
31
33
|
|
|
@@ -45,6 +47,15 @@ const ChannelInput = props => {
|
|
|
45
47
|
setMessageToEdit
|
|
46
48
|
} = props;
|
|
47
49
|
const safeArea = (0, _uikitUtils.useSafeAreaPadding)(['top', 'left', 'right', 'bottom']);
|
|
50
|
+
|
|
51
|
+
// Android API 35+ keyboard avoidance handling
|
|
52
|
+
/**
|
|
53
|
+
* Android API 35+ introduced edge-to-edge layouts, which changed how keyboard avoidance should be handled.
|
|
54
|
+
* For API 35+, the system manages insets automatically, so we use the provided keyboardAvoidOffset directly.
|
|
55
|
+
* For older Android versions, we manually subtract the safe area bottom padding to avoid overlapping with system UI.
|
|
56
|
+
* See: https://developer.android.com/develop/ui/views/layout/edge-to-edge
|
|
57
|
+
*/
|
|
58
|
+
const keyboardVerticalOffset = isAndroidApi35 ? keyboardAvoidOffset : -safeArea.paddingBottom + keyboardAvoidOffset;
|
|
48
59
|
const {
|
|
49
60
|
colors,
|
|
50
61
|
typography
|
|
@@ -100,7 +111,7 @@ const ChannelInput = props => {
|
|
|
100
111
|
});
|
|
101
112
|
}
|
|
102
113
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.KeyboardAvoidingView, {
|
|
103
|
-
keyboardVerticalOffset:
|
|
114
|
+
keyboardVerticalOffset: keyboardVerticalOffset,
|
|
104
115
|
behavior: KEYBOARD_AVOID_VIEW_BEHAVIOR
|
|
105
116
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
106
117
|
style: {
|
|
@@ -133,7 +144,7 @@ const ChannelInput = props => {
|
|
|
133
144
|
messageToEdit: messageToEdit,
|
|
134
145
|
setMessageToEdit: setMessageToEdit,
|
|
135
146
|
style: textInputStyle
|
|
136
|
-
}))), /*#__PURE__*/_react.default.createElement(SafeAreaBottom, {
|
|
147
|
+
}))), !isAndroidApi35 && /*#__PURE__*/_react.default.createElement(SafeAreaBottom, {
|
|
137
148
|
height: safeArea.paddingBottom
|
|
138
149
|
}))), mentionAvailable && props.SuggestedMentionList && /*#__PURE__*/_react.default.createElement(props.SuggestedMentionList, {
|
|
139
150
|
text: text,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_uikitReactNativeFoundation","_uikitUtils","_useContext","_useMentionTextInput","_interopRequireDefault","_AttachmentsButton","_EditInput","_MessageToReplyPreview","_SendInput","_VoiceMessageInput","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","AUTO_FOCUS","Platform","select","ios","android","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","ChannelInput","props","channel","keyboardAvoidOffset","messageToEdit","setMessageToEdit","safeArea","useSafeAreaPadding","colors","typography","useUIKitTheme","sbOptions","mentionManager","useSendbirdChat","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","useMentionTextInput","inputMode","useIIFE","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","inputHeight","setInputHeight","useState","styles","inputDefault","height","fontStyle","useMemo","body3","fontSize","lineHeight","textAlignVertical","textInputStyle","StyleSheet","flatten","input","style","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","replace","shouldRenderInput","createElement","SafeAreaBottom","paddingBottom","Fragment","KeyboardAvoidingView","keyboardVerticalOffset","behavior","View","paddingStart","paddingEnd","backgroundColor","background","onLayout","nativeEvent","layout","inputContainer","key","ref","VoiceMessageInput","AttachmentsButton","MessageToReplyPreview","autoFocus","SuggestedMentionList","topInset","paddingTop","bottomInset","useEffect","triggerTyping","action","endTyping","startTyping","catch","error","Logger","debug","setText","chatDisabled","isUserMessage","setTimeout","_textInputRef$current","current","focus","createStyleSheet","justifyContent","width","flex","marginEnd","borderRadius","minHeight","maxHeight","_default","exports","React","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, StyleProp, StyleSheet, TextInput, TextStyle, View } from 'react-native';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n Logger,\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdMember,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n replace,\n useIIFE,\n useSafeAreaPadding,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\nimport useMentionTextInput from '../../hooks/useMentionTextInput';\nimport type { CommonComponent, MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport type { MessageToReplyPreviewProps } from './MessageToReplyPreview';\nimport { MessageToReplyPreview } from './MessageToReplyPreview';\nimport SendInput from './SendInput';\nimport VoiceMessageInput, { VoiceMessageInputProps } from './VoiceMessageInput';\n\nexport type SuggestedMentionListProps = {\n text: string;\n selection: Range;\n topInset: number;\n bottomInset: number;\n inputHeight: number;\n onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;\n mentionedUsers: MentionedUser[];\n /**\n * Whether to show user id information on each item.\n * */\n showUserId?: boolean;\n};\n\nexport type ChannelInputProps = {\n // style\n style?: StyleProp<TextStyle>;\n\n // default\n channel: SendbirdBaseChannel;\n shouldRenderInput: boolean;\n keyboardAvoidOffset: number;\n\n // default actions\n onPressSendUserMessage: (params: SendbirdUserMessageCreateParams) => Promise<void>;\n onPressSendFileMessage: (params: SendbirdFileMessageCreateParams) => Promise<void>;\n onPressUpdateUserMessage: (message: SendbirdUserMessage, params: SendbirdUserMessageUpdateParams) => Promise<void>;\n onPressUpdateFileMessage: (message: SendbirdFileMessage, params: SendbirdFileMessageUpdateParams) => Promise<void>;\n\n // input status\n inputFrozen: boolean;\n inputMuted: boolean;\n inputDisabled: boolean;\n\n // edit\n messageToEdit: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // reply - only available on group channel\n messageToReply?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToReply?: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n messageForThread?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n\n // mention\n SuggestedMentionList?: CommonComponent<SuggestedMentionListProps>;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;\n MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null;\n VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | null;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\n// -> This will affect to keyboard blur when add/remove first mentioned user.\n// const GET_INPUT_KEY = (shouldReset: boolean) => {\n// return Platform.OS === 'ios' && shouldReset ? 'uikit-input-clear' : 'uikit-input';\n// };\n\n// TODO: Refactor 'Edit' mode to clearly\nconst ChannelInput = (props: ChannelInputProps) => {\n const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;\n\n const safeArea = useSafeAreaPadding(['top', 'left', 'right', 'bottom']);\n const { colors, typography } = useUIKitTheme();\n const { sbOptions, mentionManager } = useSendbirdChat();\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit,\n });\n const inputMode = useIIFE(() => {\n if (messageToEdit && !messageToEdit.isFileMessage()) return 'edit';\n else return 'send';\n });\n\n const mentionAvailable =\n sbOptions.uikit.groupChannel.channel.enableMention && channel.isGroupChannel() && !channel.isBroadcast;\n const inputKeyToRemount = 'input'; //GET_INPUT_KEY(mentionAvailable ? mentionedUsers.length === 0 : false);\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n const fontStyle = useMemo(() => {\n if (!typography.body3.fontSize) return typography.body3;\n // NOTE: iOS does not support textAlignVertical, so we should adjust lineHeight to center the text in multiline TextInput.\n return { ...typography.body3, lineHeight: typography.body3.fontSize * 1.275, textAlignVertical: 'center' };\n }, [typography.body3.fontSize]);\n\n const textInputStyle = StyleSheet.flatten([styles.input, fontStyle, props.style]);\n\n useTypingTrigger(text, channel);\n useTextClearOnDisabled(onChangeText, props.inputDisabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention = (user: SendbirdMember, searchStringRange: Range) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={safeArea.paddingBottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView\n keyboardVerticalOffset={-safeArea.paddingBottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View\n style={{\n paddingStart: safeArea.paddingStart,\n paddingEnd: safeArea.paddingEnd,\n backgroundColor: colors.background,\n }}\n >\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n VoiceMessageInput={props.VoiceMessageInput ?? VoiceMessageInput}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n MessageToReplyPreview={props.MessageToReplyPreview ?? MessageToReplyPreview}\n style={textInputStyle}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n autoFocus={AUTO_FOCUS}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n style={textInputStyle}\n />\n )}\n </View>\n <SafeAreaBottom height={safeArea.paddingBottom} />\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && props.SuggestedMentionList && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={safeArea.paddingTop}\n bottomInset={safeArea.paddingBottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {\n useEffect(\n () => {\n function triggerTyping() {\n if (channel.isGroupChannel()) {\n const action = () => (text.length === 0 ? channel.endTyping() : channel.startTyping());\n action().catch((error) => {\n Logger.debug('ChannelInput: Failed to trigger typing', error);\n });\n }\n }\n\n triggerTyping();\n },\n channel.isGroupChannel() ? [text] : [],\n );\n};\n\nconst useTextClearOnDisabled = (setText: (val: string) => void, chatDisabled: boolean) => {\n useEffect(() => {\n if (chatDisabled) setText('');\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: React.MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdBaseMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n input: {\n flex: 1,\n marginEnd: 4,\n borderRadius: 20,\n paddingTop: 8,\n paddingBottom: 8,\n minHeight: 36,\n // Android - padding area is hidden\n // iOS - padding area is visible\n maxHeight: Platform.select({ ios: 36 * 2 + 16, android: 36 * 2 }),\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAgBA,IAAAI,WAAA,GAAAJ,OA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AE;MAAEC,OAAO,EAAE,EAAE,GAAG;IAAE,CAAC;EAClE;AACF,CAAC,CAAC;AAAC,IAAAmH,QAAA,GAAAC,OAAA,CAAAhJ,OAAA,gBAEYiJ,cAAK,CAACC,IAAI,CAACnH,YAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_uikitReactNativeFoundation","_uikitUtils","_useContext","_useMentionTextInput","_interopRequireDefault","_AttachmentsButton","_EditInput","_MessageToReplyPreview","_SendInput","_VoiceMessageInput","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","AUTO_FOCUS","Platform","select","ios","android","isAndroidApi35","OS","Version","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","ChannelInput","props","channel","keyboardAvoidOffset","messageToEdit","setMessageToEdit","safeArea","useSafeAreaPadding","keyboardVerticalOffset","paddingBottom","colors","typography","useUIKitTheme","sbOptions","mentionManager","useSendbirdChat","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","useMentionTextInput","inputMode","useIIFE","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","inputHeight","setInputHeight","useState","styles","inputDefault","height","fontStyle","useMemo","body3","fontSize","lineHeight","textAlignVertical","textInputStyle","StyleSheet","flatten","input","style","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","replace","shouldRenderInput","createElement","SafeAreaBottom","Fragment","KeyboardAvoidingView","behavior","View","paddingStart","paddingEnd","backgroundColor","background","onLayout","nativeEvent","layout","inputContainer","key","ref","VoiceMessageInput","AttachmentsButton","MessageToReplyPreview","autoFocus","SuggestedMentionList","topInset","paddingTop","bottomInset","useEffect","triggerTyping","action","endTyping","startTyping","catch","error","Logger","debug","setText","chatDisabled","isUserMessage","setTimeout","_textInputRef$current","current","focus","createStyleSheet","justifyContent","width","flex","marginEnd","borderRadius","minHeight","maxHeight","_default","exports","React","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, StyleProp, StyleSheet, TextInput, TextStyle, View } from 'react-native';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n Logger,\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdMember,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n replace,\n useIIFE,\n useSafeAreaPadding,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\nimport useMentionTextInput from '../../hooks/useMentionTextInput';\nimport type { CommonComponent, MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport type { MessageToReplyPreviewProps } from './MessageToReplyPreview';\nimport { MessageToReplyPreview } from './MessageToReplyPreview';\nimport SendInput from './SendInput';\nimport VoiceMessageInput, { VoiceMessageInputProps } from './VoiceMessageInput';\n\nexport type SuggestedMentionListProps = {\n text: string;\n selection: Range;\n topInset: number;\n bottomInset: number;\n inputHeight: number;\n onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;\n mentionedUsers: MentionedUser[];\n /**\n * Whether to show user id information on each item.\n * */\n showUserId?: boolean;\n};\n\nexport type ChannelInputProps = {\n // style\n style?: StyleProp<TextStyle>;\n\n // default\n channel: SendbirdBaseChannel;\n shouldRenderInput: boolean;\n keyboardAvoidOffset: number;\n\n // default actions\n onPressSendUserMessage: (params: SendbirdUserMessageCreateParams) => Promise<void>;\n onPressSendFileMessage: (params: SendbirdFileMessageCreateParams) => Promise<void>;\n onPressUpdateUserMessage: (message: SendbirdUserMessage, params: SendbirdUserMessageUpdateParams) => Promise<void>;\n onPressUpdateFileMessage: (message: SendbirdFileMessage, params: SendbirdFileMessageUpdateParams) => Promise<void>;\n\n // input status\n inputFrozen: boolean;\n inputMuted: boolean;\n inputDisabled: boolean;\n\n // edit\n messageToEdit: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // reply - only available on group channel\n messageToReply?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToReply?: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n messageForThread?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n\n // mention\n SuggestedMentionList?: CommonComponent<SuggestedMentionListProps>;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;\n MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null;\n VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | null;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst isAndroidApi35 = Platform.OS === 'android' && Platform.Version >= 35;\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({\n ios: 'padding' as const,\n android: isAndroidApi35 ? ('padding' as const) : undefined,\n default: undefined,\n});\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\n// -> This will affect to keyboard blur when add/remove first mentioned user.\n// const GET_INPUT_KEY = (shouldReset: boolean) => {\n// return Platform.OS === 'ios' && shouldReset ? 'uikit-input-clear' : 'uikit-input';\n// };\n\n// TODO: Refactor 'Edit' mode to clearly\nconst ChannelInput = (props: ChannelInputProps) => {\n const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;\n\n const safeArea = useSafeAreaPadding(['top', 'left', 'right', 'bottom']);\n\n // Android API 35+ keyboard avoidance handling\n /**\n * Android API 35+ introduced edge-to-edge layouts, which changed how keyboard avoidance should be handled.\n * For API 35+, the system manages insets automatically, so we use the provided keyboardAvoidOffset directly.\n * For older Android versions, we manually subtract the safe area bottom padding to avoid overlapping with system UI.\n * See: https://developer.android.com/develop/ui/views/layout/edge-to-edge\n */\n const keyboardVerticalOffset = isAndroidApi35 ? keyboardAvoidOffset : -safeArea.paddingBottom + keyboardAvoidOffset;\n const { colors, typography } = useUIKitTheme();\n const { sbOptions, mentionManager } = useSendbirdChat();\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit,\n });\n const inputMode = useIIFE(() => {\n if (messageToEdit && !messageToEdit.isFileMessage()) return 'edit';\n else return 'send';\n });\n\n const mentionAvailable =\n sbOptions.uikit.groupChannel.channel.enableMention && channel.isGroupChannel() && !channel.isBroadcast;\n const inputKeyToRemount = 'input'; //GET_INPUT_KEY(mentionAvailable ? mentionedUsers.length === 0 : false);\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n const fontStyle = useMemo(() => {\n if (!typography.body3.fontSize) return typography.body3;\n // NOTE: iOS does not support textAlignVertical, so we should adjust lineHeight to center the text in multiline TextInput.\n return { ...typography.body3, lineHeight: typography.body3.fontSize * 1.275, textAlignVertical: 'center' };\n }, [typography.body3.fontSize]);\n\n const textInputStyle = StyleSheet.flatten([styles.input, fontStyle, props.style]);\n\n useTypingTrigger(text, channel);\n useTextClearOnDisabled(onChangeText, props.inputDisabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention = (user: SendbirdMember, searchStringRange: Range) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={safeArea.paddingBottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView keyboardVerticalOffset={keyboardVerticalOffset} behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}>\n <View\n style={{\n paddingStart: safeArea.paddingStart,\n paddingEnd: safeArea.paddingEnd,\n backgroundColor: colors.background,\n }}\n >\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n VoiceMessageInput={props.VoiceMessageInput ?? VoiceMessageInput}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n MessageToReplyPreview={props.MessageToReplyPreview ?? MessageToReplyPreview}\n style={textInputStyle}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n autoFocus={AUTO_FOCUS}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n style={textInputStyle}\n />\n )}\n </View>\n {!isAndroidApi35 && <SafeAreaBottom height={safeArea.paddingBottom} />}\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && props.SuggestedMentionList && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={safeArea.paddingTop}\n bottomInset={safeArea.paddingBottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {\n useEffect(\n () => {\n function triggerTyping() {\n if (channel.isGroupChannel()) {\n const action = () => (text.length === 0 ? channel.endTyping() : channel.startTyping());\n action().catch((error) => {\n Logger.debug('ChannelInput: Failed to trigger typing', error);\n });\n }\n }\n\n triggerTyping();\n },\n channel.isGroupChannel() ? [text] : [],\n );\n};\n\nconst useTextClearOnDisabled = (setText: (val: string) => void, chatDisabled: boolean) => {\n useEffect(() => {\n if (chatDisabled) setText('');\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: React.MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdBaseMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n input: {\n flex: 1,\n marginEnd: 4,\n borderRadius: 20,\n paddingTop: 8,\n paddingBottom: 8,\n minHeight: 36,\n // Android - padding area is hidden\n // iOS - padding area is visible\n maxHeight: Platform.select({ ios: 36 * 2 + 16, android: 36 * 2 }),\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,2BAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAgBA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAGA,IAAAO,kBAAA,GAAAD,sBAAA,CAAAN,OAAA;AACA,IAAAQ,UAAA,GAAAF,sBAAA,CAAAN,OAAA;AAEA,IAAAS,sBAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAJ,sBAAA,CAAAN,OAAA;AACA,IAAAW,kBAAA,GAAAL,sBAAA,CAAAN,OAAA;AAAgF,SAAAM,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAA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OAAA,CAAAnJ,OAAA,gBAEYoJ,cAAK,CAACC,IAAI,CAACnH,YAAY,CAAC","ignoreList":[]}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION","_default","exports","default"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.10.
|
|
1
|
+
{"version":3,"names":["VERSION","_default","exports","default"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.10.1';\nexport default VERSION;\n"],"mappings":";;;;;;AAAA,MAAMA,OAAO,GAAG,QAAQ;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACVH,OAAO","ignoreList":[]}
|
|
@@ -15,8 +15,10 @@ const AUTO_FOCUS = Platform.select({
|
|
|
15
15
|
android: true,
|
|
16
16
|
default: false
|
|
17
17
|
});
|
|
18
|
+
const isAndroidApi35 = Platform.OS === 'android' && Platform.Version >= 35;
|
|
18
19
|
const KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({
|
|
19
20
|
ios: 'padding',
|
|
21
|
+
android: isAndroidApi35 ? 'padding' : undefined,
|
|
20
22
|
default: undefined
|
|
21
23
|
});
|
|
22
24
|
|
|
@@ -36,6 +38,15 @@ const ChannelInput = props => {
|
|
|
36
38
|
setMessageToEdit
|
|
37
39
|
} = props;
|
|
38
40
|
const safeArea = useSafeAreaPadding(['top', 'left', 'right', 'bottom']);
|
|
41
|
+
|
|
42
|
+
// Android API 35+ keyboard avoidance handling
|
|
43
|
+
/**
|
|
44
|
+
* Android API 35+ introduced edge-to-edge layouts, which changed how keyboard avoidance should be handled.
|
|
45
|
+
* For API 35+, the system manages insets automatically, so we use the provided keyboardAvoidOffset directly.
|
|
46
|
+
* For older Android versions, we manually subtract the safe area bottom padding to avoid overlapping with system UI.
|
|
47
|
+
* See: https://developer.android.com/develop/ui/views/layout/edge-to-edge
|
|
48
|
+
*/
|
|
49
|
+
const keyboardVerticalOffset = isAndroidApi35 ? keyboardAvoidOffset : -safeArea.paddingBottom + keyboardAvoidOffset;
|
|
39
50
|
const {
|
|
40
51
|
colors,
|
|
41
52
|
typography
|
|
@@ -91,7 +102,7 @@ const ChannelInput = props => {
|
|
|
91
102
|
});
|
|
92
103
|
}
|
|
93
104
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
94
|
-
keyboardVerticalOffset:
|
|
105
|
+
keyboardVerticalOffset: keyboardVerticalOffset,
|
|
95
106
|
behavior: KEYBOARD_AVOID_VIEW_BEHAVIOR
|
|
96
107
|
}, /*#__PURE__*/React.createElement(View, {
|
|
97
108
|
style: {
|
|
@@ -124,7 +135,7 @@ const ChannelInput = props => {
|
|
|
124
135
|
messageToEdit: messageToEdit,
|
|
125
136
|
setMessageToEdit: setMessageToEdit,
|
|
126
137
|
style: textInputStyle
|
|
127
|
-
}))), /*#__PURE__*/React.createElement(SafeAreaBottom, {
|
|
138
|
+
}))), !isAndroidApi35 && /*#__PURE__*/React.createElement(SafeAreaBottom, {
|
|
128
139
|
height: safeArea.paddingBottom
|
|
129
140
|
}))), mentionAvailable && props.SuggestedMentionList && /*#__PURE__*/React.createElement(props.SuggestedMentionList, {
|
|
130
141
|
text: text,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useMemo","useState","KeyboardAvoidingView","Platform","StyleSheet","View","createStyleSheet","useUIKitTheme","Logger","replace","useIIFE","useSafeAreaPadding","useSendbirdChat","useMentionTextInput","AttachmentsButton","EditInput","MessageToReplyPreview","SendInput","VoiceMessageInput","AUTO_FOCUS","select","ios","android","default","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","ChannelInput","props","channel","keyboardAvoidOffset","messageToEdit","setMessageToEdit","safeArea","colors","typography","sbOptions","mentionManager","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","inputMode","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","inputHeight","setInputHeight","styles","inputDefault","height","fontStyle","body3","fontSize","lineHeight","textAlignVertical","textInputStyle","flatten","input","style","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","length","shouldRenderInput","createElement","SafeAreaBottom","paddingBottom","Fragment","keyboardVerticalOffset","behavior","paddingStart","paddingEnd","backgroundColor","background","onLayout","e","nativeEvent","layout","inputContainer","_extends","key","ref","autoFocus","SuggestedMentionList","topInset","paddingTop","bottomInset","triggerTyping","action","endTyping","startTyping","catch","error","debug","setText","chatDisabled","isUserMessage","setTimeout","_textInputRef$current","current","focus","justifyContent","width","flex","marginEnd","borderRadius","minHeight","maxHeight","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, StyleProp, StyleSheet, TextInput, TextStyle, View } from 'react-native';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n Logger,\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdMember,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n replace,\n useIIFE,\n useSafeAreaPadding,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\nimport useMentionTextInput from '../../hooks/useMentionTextInput';\nimport type { CommonComponent, MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport type { MessageToReplyPreviewProps } from './MessageToReplyPreview';\nimport { MessageToReplyPreview } from './MessageToReplyPreview';\nimport SendInput from './SendInput';\nimport VoiceMessageInput, { VoiceMessageInputProps } from './VoiceMessageInput';\n\nexport type SuggestedMentionListProps = {\n text: string;\n selection: Range;\n topInset: number;\n bottomInset: number;\n inputHeight: number;\n onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;\n mentionedUsers: MentionedUser[];\n /**\n * Whether to show user id information on each item.\n * */\n showUserId?: boolean;\n};\n\nexport type ChannelInputProps = {\n // style\n style?: StyleProp<TextStyle>;\n\n // default\n channel: SendbirdBaseChannel;\n shouldRenderInput: boolean;\n keyboardAvoidOffset: number;\n\n // default actions\n onPressSendUserMessage: (params: SendbirdUserMessageCreateParams) => Promise<void>;\n onPressSendFileMessage: (params: SendbirdFileMessageCreateParams) => Promise<void>;\n onPressUpdateUserMessage: (message: SendbirdUserMessage, params: SendbirdUserMessageUpdateParams) => Promise<void>;\n onPressUpdateFileMessage: (message: SendbirdFileMessage, params: SendbirdFileMessageUpdateParams) => Promise<void>;\n\n // input status\n inputFrozen: boolean;\n inputMuted: boolean;\n inputDisabled: boolean;\n\n // edit\n messageToEdit: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // reply - only available on group channel\n messageToReply?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToReply?: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n messageForThread?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n\n // mention\n SuggestedMentionList?: CommonComponent<SuggestedMentionListProps>;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;\n MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null;\n VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | null;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\n// -> This will affect to keyboard blur when add/remove first mentioned user.\n// const GET_INPUT_KEY = (shouldReset: boolean) => {\n// return Platform.OS === 'ios' && shouldReset ? 'uikit-input-clear' : 'uikit-input';\n// };\n\n// TODO: Refactor 'Edit' mode to clearly\nconst ChannelInput = (props: ChannelInputProps) => {\n const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;\n\n const safeArea = useSafeAreaPadding(['top', 'left', 'right', 'bottom']);\n const { colors, typography } = useUIKitTheme();\n const { sbOptions, mentionManager } = useSendbirdChat();\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit,\n });\n const inputMode = useIIFE(() => {\n if (messageToEdit && !messageToEdit.isFileMessage()) return 'edit';\n else return 'send';\n });\n\n const mentionAvailable =\n sbOptions.uikit.groupChannel.channel.enableMention && channel.isGroupChannel() && !channel.isBroadcast;\n const inputKeyToRemount = 'input'; //GET_INPUT_KEY(mentionAvailable ? mentionedUsers.length === 0 : false);\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n const fontStyle = useMemo(() => {\n if (!typography.body3.fontSize) return typography.body3;\n // NOTE: iOS does not support textAlignVertical, so we should adjust lineHeight to center the text in multiline TextInput.\n return { ...typography.body3, lineHeight: typography.body3.fontSize * 1.275, textAlignVertical: 'center' };\n }, [typography.body3.fontSize]);\n\n const textInputStyle = StyleSheet.flatten([styles.input, fontStyle, props.style]);\n\n useTypingTrigger(text, channel);\n useTextClearOnDisabled(onChangeText, props.inputDisabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention = (user: SendbirdMember, searchStringRange: Range) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={safeArea.paddingBottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView\n keyboardVerticalOffset={-safeArea.paddingBottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View\n style={{\n paddingStart: safeArea.paddingStart,\n paddingEnd: safeArea.paddingEnd,\n backgroundColor: colors.background,\n }}\n >\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n VoiceMessageInput={props.VoiceMessageInput ?? VoiceMessageInput}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n MessageToReplyPreview={props.MessageToReplyPreview ?? MessageToReplyPreview}\n style={textInputStyle}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n autoFocus={AUTO_FOCUS}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n style={textInputStyle}\n />\n )}\n </View>\n <SafeAreaBottom height={safeArea.paddingBottom} />\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && props.SuggestedMentionList && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={safeArea.paddingTop}\n bottomInset={safeArea.paddingBottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {\n useEffect(\n () => {\n function triggerTyping() {\n if (channel.isGroupChannel()) {\n const action = () => (text.length === 0 ? channel.endTyping() : channel.startTyping());\n action().catch((error) => {\n Logger.debug('ChannelInput: Failed to trigger typing', error);\n });\n }\n }\n\n triggerTyping();\n },\n channel.isGroupChannel() ? [text] : [],\n );\n};\n\nconst useTextClearOnDisabled = (setText: (val: string) => void, chatDisabled: boolean) => {\n useEffect(() => {\n if (chatDisabled) setText('');\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: React.MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdBaseMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n input: {\n flex: 1,\n marginEnd: 4,\n borderRadius: 20,\n paddingTop: 8,\n paddingBottom: 8,\n minHeight: 36,\n // Android - padding area is hidden\n // iOS - padding area is visible\n maxHeight: Platform.select({ ios: 36 * 2 + 16, android: 36 * 2 }),\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,oBAAoB,EAAEC,QAAQ,EAAaC,UAAU,EAAwBC,IAAI,QAAQ,cAAc;AAEhH,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACzF,SACEC,MAAM,EAUNC,OAAO,EACPC,OAAO,EACPC,kBAAkB,QACb,uBAAuB;AAE9B,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,mBAAmB,MAAM,iCAAiC;AAGjE,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,SAAS,MAAM,aAAa;AAEnC,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,iBAAiB,MAAkC,qBAAqB;AAsD/E,MAAMC,UAAU,GAAGhB,QAAQ,CAACiB,MAAM,C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ZC,YAAY,EAAE,EAAE;IAChBpB,UAAU,EAAE,CAAC;IACbnB,aAAa,EAAE,CAAC;IAChBwC,SAAS,EAAE,EAAE;IACb;IACA;IACAC,SAAS,EAAExH,QAAQ,CAACiB,MAAM,CAAC;MAAEC,GAAG,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE;MAAEC,OAAO,EAAE,EAAE,GAAG;IAAE,CAAC;EAClE;AACF,CAAC,CAAC;AAEF,4BAAexB,KAAK,CAAC8H,IAAI,CAAClG,YAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useEffect","useMemo","useState","KeyboardAvoidingView","Platform","StyleSheet","View","createStyleSheet","useUIKitTheme","Logger","replace","useIIFE","useSafeAreaPadding","useSendbirdChat","useMentionTextInput","AttachmentsButton","EditInput","MessageToReplyPreview","SendInput","VoiceMessageInput","AUTO_FOCUS","select","ios","android","default","isAndroidApi35","OS","Version","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","ChannelInput","props","channel","keyboardAvoidOffset","messageToEdit","setMessageToEdit","safeArea","keyboardVerticalOffset","paddingBottom","colors","typography","sbOptions","mentionManager","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","inputMode","isFileMessage","mentionAvailable","uikit","groupChannel","enableMention","isGroupChannel","isBroadcast","inputKeyToRemount","inputHeight","setInputHeight","styles","inputDefault","height","fontStyle","body3","fontSize","lineHeight","textAlignVertical","textInputStyle","flatten","input","style","useTypingTrigger","useTextClearOnDisabled","inputDisabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","length","shouldRenderInput","createElement","SafeAreaBottom","Fragment","behavior","paddingStart","paddingEnd","backgroundColor","background","onLayout","e","nativeEvent","layout","inputContainer","_extends","key","ref","autoFocus","SuggestedMentionList","topInset","paddingTop","bottomInset","triggerTyping","action","endTyping","startTyping","catch","error","debug","setText","chatDisabled","isUserMessage","setTimeout","_textInputRef$current","current","focus","justifyContent","width","flex","marginEnd","borderRadius","minHeight","maxHeight","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, StyleProp, StyleSheet, TextInput, TextStyle, View } from 'react-native';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n Logger,\n SendbirdBaseChannel,\n SendbirdBaseMessage,\n SendbirdFileMessage,\n SendbirdFileMessageCreateParams,\n SendbirdFileMessageUpdateParams,\n SendbirdMember,\n SendbirdUserMessage,\n SendbirdUserMessageCreateParams,\n SendbirdUserMessageUpdateParams,\n replace,\n useIIFE,\n useSafeAreaPadding,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../hooks/useContext';\nimport useMentionTextInput from '../../hooks/useMentionTextInput';\nimport type { CommonComponent, MentionedUser, Range } from '../../types';\nimport type { AttachmentsButtonProps } from './AttachmentsButton';\nimport AttachmentsButton from './AttachmentsButton';\nimport EditInput from './EditInput';\nimport type { MessageToReplyPreviewProps } from './MessageToReplyPreview';\nimport { MessageToReplyPreview } from './MessageToReplyPreview';\nimport SendInput from './SendInput';\nimport VoiceMessageInput, { VoiceMessageInputProps } from './VoiceMessageInput';\n\nexport type SuggestedMentionListProps = {\n text: string;\n selection: Range;\n topInset: number;\n bottomInset: number;\n inputHeight: number;\n onPressToMention: (user: SendbirdMember, searchStringRange: Range) => void;\n mentionedUsers: MentionedUser[];\n /**\n * Whether to show user id information on each item.\n * */\n showUserId?: boolean;\n};\n\nexport type ChannelInputProps = {\n // style\n style?: StyleProp<TextStyle>;\n\n // default\n channel: SendbirdBaseChannel;\n shouldRenderInput: boolean;\n keyboardAvoidOffset: number;\n\n // default actions\n onPressSendUserMessage: (params: SendbirdUserMessageCreateParams) => Promise<void>;\n onPressSendFileMessage: (params: SendbirdFileMessageCreateParams) => Promise<void>;\n onPressUpdateUserMessage: (message: SendbirdUserMessage, params: SendbirdUserMessageUpdateParams) => Promise<void>;\n onPressUpdateFileMessage: (message: SendbirdFileMessage, params: SendbirdFileMessageUpdateParams) => Promise<void>;\n\n // input status\n inputFrozen: boolean;\n inputMuted: boolean;\n inputDisabled: boolean;\n\n // edit\n messageToEdit: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n\n // reply - only available on group channel\n messageToReply?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n setMessageToReply?: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;\n messageForThread?: undefined | SendbirdUserMessage | SendbirdFileMessage;\n\n // mention\n SuggestedMentionList?: CommonComponent<SuggestedMentionListProps>;\n\n // sub-components\n AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;\n MessageToReplyPreview?: (props: MessageToReplyPreviewProps) => React.ReactNode | null;\n VoiceMessageInput?: (props: VoiceMessageInputProps) => React.ReactNode | null;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst isAndroidApi35 = Platform.OS === 'android' && Platform.Version >= 35;\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({\n ios: 'padding' as const,\n android: isAndroidApi35 ? ('padding' as const) : undefined,\n default: undefined,\n});\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\n// -> This will affect to keyboard blur when add/remove first mentioned user.\n// const GET_INPUT_KEY = (shouldReset: boolean) => {\n// return Platform.OS === 'ios' && shouldReset ? 'uikit-input-clear' : 'uikit-input';\n// };\n\n// TODO: Refactor 'Edit' mode to clearly\nconst ChannelInput = (props: ChannelInputProps) => {\n const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;\n\n const safeArea = useSafeAreaPadding(['top', 'left', 'right', 'bottom']);\n\n // Android API 35+ keyboard avoidance handling\n /**\n * Android API 35+ introduced edge-to-edge layouts, which changed how keyboard avoidance should be handled.\n * For API 35+, the system manages insets automatically, so we use the provided keyboardAvoidOffset directly.\n * For older Android versions, we manually subtract the safe area bottom padding to avoid overlapping with system UI.\n * See: https://developer.android.com/develop/ui/views/layout/edge-to-edge\n */\n const keyboardVerticalOffset = isAndroidApi35 ? keyboardAvoidOffset : -safeArea.paddingBottom + keyboardAvoidOffset;\n const { colors, typography } = useUIKitTheme();\n const { sbOptions, mentionManager } = useSendbirdChat();\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit,\n });\n const inputMode = useIIFE(() => {\n if (messageToEdit && !messageToEdit.isFileMessage()) return 'edit';\n else return 'send';\n });\n\n const mentionAvailable =\n sbOptions.uikit.groupChannel.channel.enableMention && channel.isGroupChannel() && !channel.isBroadcast;\n const inputKeyToRemount = 'input'; //GET_INPUT_KEY(mentionAvailable ? mentionedUsers.length === 0 : false);\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n const fontStyle = useMemo(() => {\n if (!typography.body3.fontSize) return typography.body3;\n // NOTE: iOS does not support textAlignVertical, so we should adjust lineHeight to center the text in multiline TextInput.\n return { ...typography.body3, lineHeight: typography.body3.fontSize * 1.275, textAlignVertical: 'center' };\n }, [typography.body3.fontSize]);\n\n const textInputStyle = StyleSheet.flatten([styles.input, fontStyle, props.style]);\n\n useTypingTrigger(text, channel);\n useTextClearOnDisabled(onChangeText, props.inputDisabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention = (user: SendbirdMember, searchStringRange: Range) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={safeArea.paddingBottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView keyboardVerticalOffset={keyboardVerticalOffset} behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}>\n <View\n style={{\n paddingStart: safeArea.paddingStart,\n paddingEnd: safeArea.paddingEnd,\n backgroundColor: colors.background,\n }}\n >\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n VoiceMessageInput={props.VoiceMessageInput ?? VoiceMessageInput}\n AttachmentsButton={props.AttachmentsButton ?? AttachmentsButton}\n MessageToReplyPreview={props.MessageToReplyPreview ?? MessageToReplyPreview}\n style={textInputStyle}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={inputKeyToRemount}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n autoFocus={AUTO_FOCUS}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n style={textInputStyle}\n />\n )}\n </View>\n {!isAndroidApi35 && <SafeAreaBottom height={safeArea.paddingBottom} />}\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && props.SuggestedMentionList && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={safeArea.paddingTop}\n bottomInset={safeArea.paddingBottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdBaseChannel) => {\n useEffect(\n () => {\n function triggerTyping() {\n if (channel.isGroupChannel()) {\n const action = () => (text.length === 0 ? channel.endTyping() : channel.startTyping());\n action().catch((error) => {\n Logger.debug('ChannelInput: Failed to trigger typing', error);\n });\n }\n }\n\n triggerTyping();\n },\n channel.isGroupChannel() ? [text] : [],\n );\n};\n\nconst useTextClearOnDisabled = (setText: (val: string) => void, chatDisabled: boolean) => {\n useEffect(() => {\n if (chatDisabled) setText('');\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: React.MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdBaseMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n input: {\n flex: 1,\n marginEnd: 4,\n borderRadius: 20,\n paddingTop: 8,\n paddingBottom: 8,\n minHeight: 36,\n // Android - padding area is hidden\n // iOS - padding area is visible\n maxHeight: Platform.select({ ios: 36 * 2 + 16, android: 36 * 2 }),\n },\n});\n\nexport default React.memo(ChannelInput);\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,oBAAoB,EAAEC,QAAQ,EAAaC,UAAU,EAAwBC,IAAI,QAAQ,cAAc;AAEhH,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,yCAAyC;AACzF,SACEC,MAAM,EAUNC,OAAO,EACPC,OAAO,EACPC,kBAAkB,QACb,uBAAuB;AAE9B,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,mBAAmB,MAAM,iCAAiC;AAGjE,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,SAAS,MAAM,aAAa;AAEnC,SAASC,qBAAqB,QAAQ,yBAAyB;AAC/D,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,iBAAiB,MAAkC,qBAAqB;AAsD/E,MAAMC,UAAU,GAAGhB,QAAQ,CAACiB,MAAM,CAAC;EAAEC,GAAG,EAAE,KAAK;EAAEC,OAAO,EAAE,IAAI;EAAEC,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AC;EAC9B2F,cAAc,EAAE;IACduB,cAAc,EAAE,QAAQ;IACxBC,KAAK,EAAE;EACT,CAAC;EACD7D,YAAY,EAAE;IACZC,MAAM,EAAE;EACV,CAAC;EACDQ,KAAK,EAAE;IACLqD,IAAI,EAAE,CAAC;IACPC,SAAS,EAAE,CAAC;IACZC,YAAY,EAAE,EAAE;IAChBpB,UAAU,EAAE,CAAC;IACbnE,aAAa,EAAE,CAAC;IAChBwF,SAAS,EAAE,EAAE;IACb;IACA;IACAC,SAAS,EAAE3H,QAAQ,CAACiB,MAAM,CAAC;MAAEC,GAAG,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE;MAAEC,OAAO,EAAE,EAAE,GAAG;IAAE,CAAC;EAClE;AACF,CAAC,CAAC;AAEF,4BAAexB,KAAK,CAACiI,IAAI,CAAClG,YAAY,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.10.
|
|
1
|
+
{"version":3,"names":["VERSION"],"sources":["version.ts"],"sourcesContent":["const VERSION = '3.10.1';\nexport default VERSION;\n"],"mappings":"AAAA,MAAMA,OAAO,GAAG,QAAQ;AACxB,eAAeA,OAAO","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@ import type { StringSet } from '../localization/StringSet.type';
|
|
|
14
14
|
import type { ClipboardServiceInterface, FileServiceInterface, MediaServiceInterface, NotificationServiceInterface, PlayerServiceInterface, RecorderServiceInterface } from '../platform/types';
|
|
15
15
|
import { ErrorBoundaryProps, LocalCacheStorage } from '../types';
|
|
16
16
|
export declare const SendbirdUIKit: Readonly<{
|
|
17
|
-
VERSION: "3.10.
|
|
17
|
+
VERSION: "3.10.1";
|
|
18
18
|
PLATFORM: string;
|
|
19
19
|
DEFAULT: {
|
|
20
20
|
AUTO_PUSH_TOKEN_REGISTRATION: boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const VERSION = "3.10.
|
|
1
|
+
declare const VERSION = "3.10.1";
|
|
2
2
|
export default VERSION;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.1",
|
|
4
4
|
"description": "Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sendbird",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@openspacelabs/react-native-zoomable-view": "^2.1.5",
|
|
63
|
-
"@sendbird/uikit-chat-hooks": "3.10.
|
|
64
|
-
"@sendbird/uikit-react-native-foundation": "3.10.
|
|
65
|
-
"@sendbird/uikit-tools": "0.0.
|
|
66
|
-
"@sendbird/uikit-utils": "3.10.
|
|
63
|
+
"@sendbird/uikit-chat-hooks": "3.10.1",
|
|
64
|
+
"@sendbird/uikit-react-native-foundation": "3.10.1",
|
|
65
|
+
"@sendbird/uikit-tools": "0.0.15",
|
|
66
|
+
"@sendbird/uikit-utils": "3.10.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@bam.tech/react-native-image-resizer": "^3.0.4",
|
|
@@ -218,5 +218,5 @@
|
|
|
218
218
|
]
|
|
219
219
|
]
|
|
220
220
|
},
|
|
221
|
-
"gitHead": "
|
|
221
|
+
"gitHead": "4202a8ca4c1db6bb15b37fda743ea36f95b457b3"
|
|
222
222
|
}
|
|
@@ -82,7 +82,12 @@ export type ChannelInputProps = {
|
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
const AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });
|
|
85
|
-
const
|
|
85
|
+
const isAndroidApi35 = Platform.OS === 'android' && Platform.Version >= 35;
|
|
86
|
+
const KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({
|
|
87
|
+
ios: 'padding' as const,
|
|
88
|
+
android: isAndroidApi35 ? ('padding' as const) : undefined,
|
|
89
|
+
default: undefined,
|
|
90
|
+
});
|
|
86
91
|
|
|
87
92
|
// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)
|
|
88
93
|
// To workaround temporarily, change the key for re-mount the component.
|
|
@@ -96,6 +101,15 @@ const ChannelInput = (props: ChannelInputProps) => {
|
|
|
96
101
|
const { channel, keyboardAvoidOffset, messageToEdit, setMessageToEdit } = props;
|
|
97
102
|
|
|
98
103
|
const safeArea = useSafeAreaPadding(['top', 'left', 'right', 'bottom']);
|
|
104
|
+
|
|
105
|
+
// Android API 35+ keyboard avoidance handling
|
|
106
|
+
/**
|
|
107
|
+
* Android API 35+ introduced edge-to-edge layouts, which changed how keyboard avoidance should be handled.
|
|
108
|
+
* For API 35+, the system manages insets automatically, so we use the provided keyboardAvoidOffset directly.
|
|
109
|
+
* For older Android versions, we manually subtract the safe area bottom padding to avoid overlapping with system UI.
|
|
110
|
+
* See: https://developer.android.com/develop/ui/views/layout/edge-to-edge
|
|
111
|
+
*/
|
|
112
|
+
const keyboardVerticalOffset = isAndroidApi35 ? keyboardAvoidOffset : -safeArea.paddingBottom + keyboardAvoidOffset;
|
|
99
113
|
const { colors, typography } = useUIKitTheme();
|
|
100
114
|
const { sbOptions, mentionManager } = useSendbirdChat();
|
|
101
115
|
|
|
@@ -138,10 +152,7 @@ const ChannelInput = (props: ChannelInputProps) => {
|
|
|
138
152
|
|
|
139
153
|
return (
|
|
140
154
|
<>
|
|
141
|
-
<KeyboardAvoidingView
|
|
142
|
-
keyboardVerticalOffset={-safeArea.paddingBottom + keyboardAvoidOffset}
|
|
143
|
-
behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}
|
|
144
|
-
>
|
|
155
|
+
<KeyboardAvoidingView keyboardVerticalOffset={keyboardVerticalOffset} behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}>
|
|
145
156
|
<View
|
|
146
157
|
style={{
|
|
147
158
|
paddingStart: safeArea.paddingStart,
|
|
@@ -181,7 +192,7 @@ const ChannelInput = (props: ChannelInputProps) => {
|
|
|
181
192
|
/>
|
|
182
193
|
)}
|
|
183
194
|
</View>
|
|
184
|
-
<SafeAreaBottom height={safeArea.paddingBottom} />
|
|
195
|
+
{!isAndroidApi35 && <SafeAreaBottom height={safeArea.paddingBottom} />}
|
|
185
196
|
</View>
|
|
186
197
|
</KeyboardAvoidingView>
|
|
187
198
|
{mentionAvailable && props.SuggestedMentionList && (
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const VERSION = '3.10.
|
|
1
|
+
const VERSION = '3.10.1';
|
|
2
2
|
export default VERSION;
|