@sendbird/uikit-react-native-foundation 2.4.1 → 2.4.2
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/README.md +1 -1
- package/lib/commonjs/assets/bundle-icons.js +0 -3
- package/lib/commonjs/assets/bundle-icons.js.map +1 -1
- package/lib/commonjs/assets/icon/index.js.map +1 -1
- package/lib/commonjs/components/Box/index.js +0 -9
- package/lib/commonjs/components/Box/index.js.map +1 -1
- package/lib/commonjs/components/Divider/index.js +0 -7
- package/lib/commonjs/components/Divider/index.js.map +1 -1
- package/lib/commonjs/components/Icon/index.js +0 -9
- package/lib/commonjs/components/Icon/index.js.map +1 -1
- package/lib/commonjs/components/Image/Image.fastimage.js +8 -17
- package/lib/commonjs/components/Image/Image.fastimage.js.map +1 -1
- package/lib/commonjs/components/Image/Image.reactnative.js +0 -6
- package/lib/commonjs/components/Image/Image.reactnative.js.map +1 -1
- package/lib/commonjs/components/Image/index.js +0 -5
- package/lib/commonjs/components/Image/index.js.map +1 -1
- package/lib/commonjs/components/ImageWithPlaceholder/index.js +0 -15
- package/lib/commonjs/components/ImageWithPlaceholder/index.js.map +1 -1
- package/lib/commonjs/components/Modal/index.js +6 -24
- package/lib/commonjs/components/Modal/index.js.map +1 -1
- package/lib/commonjs/components/PressBox/index.js +0 -11
- package/lib/commonjs/components/PressBox/index.js.map +1 -1
- package/lib/commonjs/components/RegexText/index.js +2 -8
- package/lib/commonjs/components/RegexText/index.js.map +1 -1
- package/lib/commonjs/components/Switch/index.js +0 -14
- package/lib/commonjs/components/Switch/index.js.map +1 -1
- package/lib/commonjs/components/Text/index.js +0 -8
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/TextInput/index.js +0 -8
- package/lib/commonjs/components/TextInput/index.js.map +1 -1
- package/lib/commonjs/components/URLParsedText/index.js +0 -14
- package/lib/commonjs/components/URLParsedText/index.js.map +1 -1
- package/lib/commonjs/index.js +0 -49
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/styles/HeaderStyleContext.js +0 -9
- package/lib/commonjs/styles/HeaderStyleContext.js.map +1 -1
- package/lib/commonjs/styles/createScaleFactor.js +0 -6
- package/lib/commonjs/styles/createScaleFactor.js.map +1 -1
- package/lib/commonjs/styles/createSelectByColorScheme.js +0 -2
- package/lib/commonjs/styles/createSelectByColorScheme.js.map +1 -1
- package/lib/commonjs/styles/createStyleSheet.js +1 -6
- package/lib/commonjs/styles/createStyleSheet.js.map +1 -1
- package/lib/commonjs/styles/createTypography.js +0 -3
- package/lib/commonjs/styles/createTypography.js.map +1 -1
- package/lib/commonjs/styles/getDefaultHeaderHeight.js +0 -2
- package/lib/commonjs/styles/getDefaultHeaderHeight.js.map +1 -1
- package/lib/commonjs/styles/useHeaderStyle.js +0 -4
- package/lib/commonjs/styles/useHeaderStyle.js.map +1 -1
- package/lib/commonjs/theme/DarkUIKitTheme.js +0 -3
- package/lib/commonjs/theme/DarkUIKitTheme.js.map +1 -1
- package/lib/commonjs/theme/LightUIKitTheme.js +0 -3
- package/lib/commonjs/theme/LightUIKitTheme.js.map +1 -1
- package/lib/commonjs/theme/Palette.js.map +1 -1
- package/lib/commonjs/theme/UIKitThemeContext.js +0 -4
- package/lib/commonjs/theme/UIKitThemeContext.js.map +1 -1
- package/lib/commonjs/theme/UIKitThemeProvider.js +0 -6
- package/lib/commonjs/theme/UIKitThemeProvider.js.map +1 -1
- package/lib/commonjs/theme/createTheme.js +0 -13
- package/lib/commonjs/theme/createTheme.js.map +1 -1
- package/lib/commonjs/theme/useUIKitTheme.js +0 -5
- package/lib/commonjs/theme/useUIKitTheme.js.map +1 -1
- package/lib/commonjs/ui/ActionMenu/index.js +2 -20
- package/lib/commonjs/ui/ActionMenu/index.js.map +1 -1
- package/lib/commonjs/ui/Alert/index.js +0 -12
- package/lib/commonjs/ui/Alert/index.js.map +1 -1
- package/lib/commonjs/ui/Avatar/AvatarGroup.js +0 -17
- package/lib/commonjs/ui/Avatar/AvatarGroup.js.map +1 -1
- package/lib/commonjs/ui/Avatar/AvatarIcon.js +0 -8
- package/lib/commonjs/ui/Avatar/AvatarIcon.js.map +1 -1
- package/lib/commonjs/ui/Avatar/index.js +0 -15
- package/lib/commonjs/ui/Avatar/index.js.map +1 -1
- package/lib/commonjs/ui/Badge/index.js +0 -9
- package/lib/commonjs/ui/Badge/index.js.map +1 -1
- package/lib/commonjs/ui/BottomSheet/index.js +0 -10
- package/lib/commonjs/ui/BottomSheet/index.js.map +1 -1
- package/lib/commonjs/ui/Button/index.js +0 -11
- package/lib/commonjs/ui/Button/index.js.map +1 -1
- package/lib/commonjs/ui/ChannelFrozenBanner/index.js +0 -8
- package/lib/commonjs/ui/ChannelFrozenBanner/index.js.map +1 -1
- package/lib/commonjs/ui/Dialog/DialogBox.js +0 -7
- package/lib/commonjs/ui/Dialog/DialogBox.js.map +1 -1
- package/lib/commonjs/ui/Dialog/DialogSheet.js +0 -10
- package/lib/commonjs/ui/Dialog/DialogSheet.js.map +1 -1
- package/lib/commonjs/ui/Dialog/index.js +0 -30
- package/lib/commonjs/ui/Dialog/index.js.map +1 -1
- package/lib/commonjs/ui/GroupChannelPreview/index.js +0 -13
- package/lib/commonjs/ui/GroupChannelPreview/index.js.map +1 -1
- package/lib/commonjs/ui/Header/index.js +0 -24
- package/lib/commonjs/ui/Header/index.js.map +1 -1
- package/lib/commonjs/ui/LoadingSpinner/index.js +0 -12
- package/lib/commonjs/ui/LoadingSpinner/index.js.map +1 -1
- package/lib/commonjs/ui/MenuBar/index.js +0 -11
- package/lib/commonjs/ui/MenuBar/index.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.admin.js +0 -7
- package/lib/commonjs/ui/OpenChannelMessage/Message.admin.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.file.image.js +0 -10
- package/lib/commonjs/ui/OpenChannelMessage/Message.file.image.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.file.js +0 -14
- package/lib/commonjs/ui/OpenChannelMessage/Message.file.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.file.video.js +0 -16
- package/lib/commonjs/ui/OpenChannelMessage/Message.file.video.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.unknown.js +0 -10
- package/lib/commonjs/ui/OpenChannelMessage/Message.unknown.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.user.js +0 -14
- package/lib/commonjs/ui/OpenChannelMessage/Message.user.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/Message.user.og.js +0 -17
- package/lib/commonjs/ui/OpenChannelMessage/Message.user.og.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/MessageContainer.js +0 -21
- package/lib/commonjs/ui/OpenChannelMessage/MessageContainer.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelMessage/index.js +0 -9
- package/lib/commonjs/ui/OpenChannelMessage/index.js.map +1 -1
- package/lib/commonjs/ui/OpenChannelPreview/index.js +0 -12
- package/lib/commonjs/ui/OpenChannelPreview/index.js.map +1 -1
- package/lib/commonjs/ui/OutlinedButton/index.js +0 -8
- package/lib/commonjs/ui/OutlinedButton/index.js.map +1 -1
- package/lib/commonjs/ui/Placeholder/index.js +2 -13
- package/lib/commonjs/ui/Placeholder/index.js.map +1 -1
- package/lib/commonjs/ui/ProfileCard/index.js +0 -10
- package/lib/commonjs/ui/ProfileCard/index.js.map +1 -1
- package/lib/commonjs/ui/Prompt/index.js +3 -20
- package/lib/commonjs/ui/Prompt/index.js.map +1 -1
- package/lib/commonjs/ui/Toast/index.js +2 -23
- package/lib/commonjs/ui/Toast/index.js.map +1 -1
- package/lib/module/assets/bundle-icons.js +0 -3
- package/lib/module/assets/bundle-icons.js.map +1 -1
- package/lib/module/assets/icon/index.js.map +1 -1
- package/lib/module/components/Box/index.js +0 -4
- package/lib/module/components/Box/index.js.map +1 -1
- package/lib/module/components/Divider/index.js +0 -2
- package/lib/module/components/Divider/index.js.map +1 -1
- package/lib/module/components/Icon/index.js +0 -2
- package/lib/module/components/Icon/index.js.map +1 -1
- package/lib/module/components/Image/Image.fastimage.js +8 -15
- package/lib/module/components/Image/Image.fastimage.js.map +1 -1
- package/lib/module/components/Image/Image.reactnative.js +0 -3
- package/lib/module/components/Image/Image.reactnative.js.map +1 -1
- package/lib/module/components/Image/index.js +0 -3
- package/lib/module/components/Image/index.js.map +1 -1
- package/lib/module/components/ImageWithPlaceholder/index.js +0 -4
- package/lib/module/components/ImageWithPlaceholder/index.js.map +1 -1
- package/lib/module/components/Modal/index.js +6 -16
- package/lib/module/components/Modal/index.js.map +1 -1
- package/lib/module/components/PressBox/index.js +0 -5
- package/lib/module/components/PressBox/index.js.map +1 -1
- package/lib/module/components/RegexText/index.js +2 -4
- package/lib/module/components/RegexText/index.js.map +1 -1
- package/lib/module/components/Switch/index.js +0 -6
- package/lib/module/components/Switch/index.js.map +1 -1
- package/lib/module/components/Text/index.js +0 -4
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/TextInput/index.js +0 -1
- package/lib/module/components/TextInput/index.js.map +1 -1
- package/lib/module/components/URLParsedText/index.js +0 -5
- package/lib/module/components/URLParsedText/index.js.map +1 -1
- package/lib/module/index.js +5 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/styles/HeaderStyleContext.js.map +1 -1
- package/lib/module/styles/createScaleFactor.js +0 -3
- package/lib/module/styles/createScaleFactor.js.map +1 -1
- package/lib/module/styles/createSelectByColorScheme.js +0 -1
- package/lib/module/styles/createSelectByColorScheme.js.map +1 -1
- package/lib/module/styles/createStyleSheet.js +1 -4
- package/lib/module/styles/createStyleSheet.js.map +1 -1
- package/lib/module/styles/createTypography.js +0 -2
- package/lib/module/styles/createTypography.js.map +1 -1
- package/lib/module/styles/getDefaultHeaderHeight.js +0 -2
- package/lib/module/styles/getDefaultHeaderHeight.js.map +1 -1
- package/lib/module/styles/useHeaderStyle.js +0 -2
- package/lib/module/styles/useHeaderStyle.js.map +1 -1
- package/lib/module/theme/DarkUIKitTheme.js.map +1 -1
- package/lib/module/theme/LightUIKitTheme.js.map +1 -1
- package/lib/module/theme/Palette.js.map +1 -1
- package/lib/module/theme/UIKitThemeContext.js.map +1 -1
- package/lib/module/theme/UIKitThemeProvider.js +0 -2
- package/lib/module/theme/UIKitThemeProvider.js.map +1 -1
- package/lib/module/theme/createTheme.js +0 -9
- package/lib/module/theme/createTheme.js.map +1 -1
- package/lib/module/theme/useUIKitTheme.js +0 -2
- package/lib/module/theme/useUIKitTheme.js.map +1 -1
- package/lib/module/ui/ActionMenu/index.js +2 -7
- package/lib/module/ui/ActionMenu/index.js.map +1 -1
- package/lib/module/ui/Alert/index.js +0 -2
- package/lib/module/ui/Alert/index.js.map +1 -1
- package/lib/module/ui/Avatar/AvatarGroup.js +0 -12
- package/lib/module/ui/Avatar/AvatarGroup.js.map +1 -1
- package/lib/module/ui/Avatar/AvatarIcon.js +0 -2
- package/lib/module/ui/Avatar/AvatarIcon.js.map +1 -1
- package/lib/module/ui/Avatar/index.js +0 -3
- package/lib/module/ui/Avatar/index.js.map +1 -1
- package/lib/module/ui/Badge/index.js +0 -2
- package/lib/module/ui/Badge/index.js.map +1 -1
- package/lib/module/ui/BottomSheet/index.js +0 -3
- package/lib/module/ui/BottomSheet/index.js.map +1 -1
- package/lib/module/ui/Button/index.js +0 -4
- package/lib/module/ui/Button/index.js.map +1 -1
- package/lib/module/ui/ChannelFrozenBanner/index.js +0 -2
- package/lib/module/ui/ChannelFrozenBanner/index.js.map +1 -1
- package/lib/module/ui/Dialog/DialogBox.js +0 -2
- package/lib/module/ui/Dialog/DialogBox.js.map +1 -1
- package/lib/module/ui/Dialog/DialogSheet.js +0 -3
- package/lib/module/ui/Dialog/DialogSheet.js.map +1 -1
- package/lib/module/ui/Dialog/index.js +0 -6
- package/lib/module/ui/Dialog/index.js.map +1 -1
- package/lib/module/ui/GroupChannelPreview/index.js +0 -3
- package/lib/module/ui/GroupChannelPreview/index.js.map +1 -1
- package/lib/module/ui/Header/index.js +0 -14
- package/lib/module/ui/Header/index.js.map +1 -1
- package/lib/module/ui/LoadingSpinner/index.js +0 -4
- package/lib/module/ui/LoadingSpinner/index.js.map +1 -1
- package/lib/module/ui/MenuBar/index.js +0 -2
- package/lib/module/ui/MenuBar/index.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.admin.js +0 -2
- package/lib/module/ui/OpenChannelMessage/Message.admin.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.file.image.js +0 -2
- package/lib/module/ui/OpenChannelMessage/Message.file.image.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.file.js +0 -3
- package/lib/module/ui/OpenChannelMessage/Message.file.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.file.video.js +0 -4
- package/lib/module/ui/OpenChannelMessage/Message.file.video.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.unknown.js +0 -4
- package/lib/module/ui/OpenChannelMessage/Message.unknown.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.user.js +0 -6
- package/lib/module/ui/OpenChannelMessage/Message.user.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/Message.user.og.js +0 -6
- package/lib/module/ui/OpenChannelMessage/Message.user.og.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/MessageContainer.js +0 -9
- package/lib/module/ui/OpenChannelMessage/MessageContainer.js.map +1 -1
- package/lib/module/ui/OpenChannelMessage/index.js.map +1 -1
- package/lib/module/ui/OpenChannelPreview/index.js +0 -3
- package/lib/module/ui/OpenChannelPreview/index.js.map +1 -1
- package/lib/module/ui/OutlinedButton/index.js +0 -2
- package/lib/module/ui/OutlinedButton/index.js.map +1 -1
- package/lib/module/ui/Placeholder/index.js +2 -3
- package/lib/module/ui/Placeholder/index.js.map +1 -1
- package/lib/module/ui/ProfileCard/index.js +0 -2
- package/lib/module/ui/ProfileCard/index.js.map +1 -1
- package/lib/module/ui/Prompt/index.js +3 -6
- package/lib/module/ui/Prompt/index.js.map +1 -1
- package/lib/module/ui/Toast/index.js +2 -8
- package/lib/module/ui/Toast/index.js.map +1 -1
- package/package.json +15 -8
- package/src/components/Image/Image.fastimage.tsx +17 -1
|
@@ -5,7 +5,6 @@ import Text from '../../components/Text';
|
|
|
5
5
|
import createStyleSheet from '../../styles/createStyleSheet';
|
|
6
6
|
import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
7
7
|
import Avatar from '../Avatar';
|
|
8
|
-
|
|
9
8
|
const ProfileCard = _ref => {
|
|
10
9
|
let {
|
|
11
10
|
uri,
|
|
@@ -49,7 +48,6 @@ const ProfileCard = _ref => {
|
|
|
49
48
|
color: color.textBody
|
|
50
49
|
}, body)));
|
|
51
50
|
};
|
|
52
|
-
|
|
53
51
|
const styles = createStyleSheet({
|
|
54
52
|
container: {
|
|
55
53
|
paddingTop: 32,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","Divider","Text","createStyleSheet","useUIKitTheme","Avatar","ProfileCard","uri","username","bodyLabel","body","button","containerStyle","colors","color","ui","profileCard","default","none","styles","container","backgroundColor","background","profileContainer","profileAvatar","textUsername","messageButtonArea","profileInfoContainer","textBodyLabel","profileInfoBodyLabel","textBody","paddingTop","width","alignItems","paddingHorizontal","marginBottom","padding","marginHorizontal"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\nimport { StyleProp, View, ViewStyle } from 'react-native';\n\nimport Divider from '../../components/Divider';\nimport Text from '../../components/Text';\nimport createStyleSheet from '../../styles/createStyleSheet';\nimport useUIKitTheme from '../../theme/useUIKitTheme';\nimport Avatar from '../Avatar';\n\ntype Props = {\n uri: string;\n username: string;\n\n button?: JSX.Element;\n\n bodyLabel: string;\n body: string;\n\n containerStyle?: StyleProp<ViewStyle>;\n};\n\nconst ProfileCard = ({ uri, username, bodyLabel, body, button, containerStyle }: Props) => {\n const { colors } = useUIKitTheme();\n const color = colors.ui.profileCard.default.none;\n\n return (\n <View style={[styles.container, { backgroundColor: color.background }, containerStyle]}>\n <View style={styles.profileContainer}>\n <Avatar uri={uri} size={80} containerStyle={styles.profileAvatar} />\n <Text h1 color={color.textUsername} numberOfLines={1}>\n {username}\n </Text>\n </View>\n {button && <View style={styles.messageButtonArea}>{button}</View>}\n <Divider space={16} />\n <View style={styles.profileInfoContainer}>\n <Text body2 color={color.textBodyLabel} style={styles.profileInfoBodyLabel}>\n {bodyLabel}\n </Text>\n <Text body3 numberOfLines={1} color={color.textBody}>\n {body}\n </Text>\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n paddingTop: 32,\n width: '100%',\n },\n profileContainer: {\n alignItems: 'center',\n paddingHorizontal: 16,\n marginBottom: 24,\n },\n profileAvatar: {\n marginBottom: 8,\n },\n profileInfoContainer: {\n padding: 16,\n },\n profileInfoBodyLabel: {\n marginBottom: 4,\n },\n messageButtonArea: {\n marginHorizontal: 24,\n marginBottom: 24,\n },\n});\n\nexport default ProfileCard;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["React","View","Divider","Text","createStyleSheet","useUIKitTheme","Avatar","ProfileCard","_ref","uri","username","bodyLabel","body","button","containerStyle","colors","color","ui","profileCard","default","none","createElement","style","styles","container","backgroundColor","background","profileContainer","size","profileAvatar","h1","textUsername","numberOfLines","messageButtonArea","space","profileInfoContainer","body2","textBodyLabel","profileInfoBodyLabel","body3","textBody","paddingTop","width","alignItems","paddingHorizontal","marginBottom","padding","marginHorizontal"],"sources":["index.tsx"],"sourcesContent":["import React from 'react';\nimport { StyleProp, View, ViewStyle } from 'react-native';\n\nimport Divider from '../../components/Divider';\nimport Text from '../../components/Text';\nimport createStyleSheet from '../../styles/createStyleSheet';\nimport useUIKitTheme from '../../theme/useUIKitTheme';\nimport Avatar from '../Avatar';\n\ntype Props = {\n uri: string;\n username: string;\n\n button?: JSX.Element;\n\n bodyLabel: string;\n body: string;\n\n containerStyle?: StyleProp<ViewStyle>;\n};\n\nconst ProfileCard = ({ uri, username, bodyLabel, body, button, containerStyle }: Props) => {\n const { colors } = useUIKitTheme();\n const color = colors.ui.profileCard.default.none;\n\n return (\n <View style={[styles.container, { backgroundColor: color.background }, containerStyle]}>\n <View style={styles.profileContainer}>\n <Avatar uri={uri} size={80} containerStyle={styles.profileAvatar} />\n <Text h1 color={color.textUsername} numberOfLines={1}>\n {username}\n </Text>\n </View>\n {button && <View style={styles.messageButtonArea}>{button}</View>}\n <Divider space={16} />\n <View style={styles.profileInfoContainer}>\n <Text body2 color={color.textBodyLabel} style={styles.profileInfoBodyLabel}>\n {bodyLabel}\n </Text>\n <Text body3 numberOfLines={1} color={color.textBody}>\n {body}\n </Text>\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n paddingTop: 32,\n width: '100%',\n },\n profileContainer: {\n alignItems: 'center',\n paddingHorizontal: 16,\n marginBottom: 24,\n },\n profileAvatar: {\n marginBottom: 8,\n },\n profileInfoContainer: {\n padding: 16,\n },\n profileInfoBodyLabel: {\n marginBottom: 4,\n },\n messageButtonArea: {\n marginHorizontal: 24,\n marginBottom: 24,\n },\n});\n\nexport default ProfileCard;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAoBC,IAAI,QAAmB,cAAc;AAEzD,OAAOC,OAAO,MAAM,0BAA0B;AAC9C,OAAOC,IAAI,MAAM,uBAAuB;AACxC,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,OAAOC,aAAa,MAAM,2BAA2B;AACrD,OAAOC,MAAM,MAAM,WAAW;AAc9B,MAAMC,WAAW,GAAGC,IAAA,IAAuE;EAAA,IAAtE;IAAEC,GAAG;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI;IAAEC,MAAM;IAAEC;EAAsB,CAAC,GAAAN,IAAA;EACpF,MAAM;IAAEO;EAAO,CAAC,GAAGV,aAAa,EAAE;EAClC,MAAMW,KAAK,GAAGD,MAAM,CAACE,EAAE,CAACC,WAAW,CAACC,OAAO,CAACC,IAAI;EAE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EAAE;IAChBgB,UAAU,EAAE,QAAQ;IACpBC,iBAAiB,EAAE,EAAE;IACrBC,YAAY,EAAE;EAChB,CAAC;EACDhB,aAAa,EAAE;IACbgB,YAAY,EAAE;EAChB,CAAC;EACDV,oBAAoB,EAAE;IACpBW,OAAO,EAAE;EACX,CAAC;EACDR,oBAAoB,EAAE;IACpBO,YAAY,EAAE;EAChB,CAAC;EACDZ,iBAAiB,EAAE;IACjBc,gBAAgB,EAAE,EAAE;IACpBF,YAAY,EAAE;EAChB;AACF,CAAC,CAAC;AAEF,eAAetC,WAAW"}
|
|
@@ -9,7 +9,6 @@ import useHeaderStyle from '../../styles/useHeaderStyle';
|
|
|
9
9
|
import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
10
10
|
import Button from '../Button';
|
|
11
11
|
import DialogBox from '../Dialog/DialogBox';
|
|
12
|
-
|
|
13
12
|
const Prompt = _ref => {
|
|
14
13
|
let {
|
|
15
14
|
onDismiss,
|
|
@@ -42,18 +41,18 @@ const Prompt = _ref => {
|
|
|
42
41
|
text: submitLabel,
|
|
43
42
|
onPress: () => onSubmit(text)
|
|
44
43
|
}];
|
|
45
|
-
const [text, setText] = useState(defaultValue);
|
|
44
|
+
const [text, setText] = useState(defaultValue);
|
|
45
|
+
|
|
46
|
+
// FIXME: autoFocus trick with modal
|
|
46
47
|
// Android
|
|
47
48
|
// - InputProps.autoFocus is not trigger keyboard appearing.
|
|
48
49
|
// - InputRef.focus() is trigger keyboard appearing, but position of keyboard selection is always the start of text.
|
|
49
50
|
// iOS
|
|
50
51
|
// - InputProps.autoFocus is trigger weird UI behavior on landscape mode.
|
|
51
|
-
|
|
52
52
|
useEffect(() => {
|
|
53
53
|
if (autoFocus && visible) {
|
|
54
54
|
setTimeout(() => {
|
|
55
55
|
var _inputRef$current, _inputRef$current2;
|
|
56
|
-
|
|
57
56
|
if (Platform.OS === 'android') (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
|
|
58
57
|
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
|
|
59
58
|
}, 250);
|
|
@@ -111,7 +110,6 @@ const Prompt = _ref => {
|
|
|
111
110
|
contentColor: colors.ui.dialog.default.none.highlight,
|
|
112
111
|
onPress: () => {
|
|
113
112
|
Keyboard.dismiss();
|
|
114
|
-
|
|
115
113
|
try {
|
|
116
114
|
onPress === null || onPress === void 0 ? void 0 : onPress();
|
|
117
115
|
} finally {
|
|
@@ -121,7 +119,6 @@ const Prompt = _ref => {
|
|
|
121
119
|
}, text);
|
|
122
120
|
}))));
|
|
123
121
|
};
|
|
124
|
-
|
|
125
122
|
const styles = createStyleSheet({
|
|
126
123
|
container: {
|
|
127
124
|
paddingTop: 8
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useRef","useState","Keyboard","Platform","View","useWindowDimensions","NOOP","Modal","Text","TextInput","createStyleSheet","useHeaderStyle","useUIKitTheme","Button","DialogBox","Prompt","onDismiss","visible","onHide","autoFocus","title","defaultValue","placeholder","onSubmit","onCancel","submitLabel","cancelLabel","statusBarTranslucent","colors","inputRef","width","height","buttons","text","onPress","setText","setTimeout","OS","current","blur","focus","alignItems","justifyContent","styles","container","Boolean","titleContainer","ui","dialog","default","none","flex","inputContainer","paddingHorizontal","paddingVertical","buttonContainer","map","index","button","highlight","dismiss","paddingTop","marginBottom","flexDirection","padding","marginLeft"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Keyboard, Platform, TextInput as RNTextInput, View, useWindowDimensions } from 'react-native';\n\nimport { NOOP } from '@sendbird/uikit-utils';\n\nimport Modal from '../../components/Modal';\nimport Text from '../../components/Text';\nimport TextInput from '../../components/TextInput';\nimport createStyleSheet from '../../styles/createStyleSheet';\nimport useHeaderStyle from '../../styles/useHeaderStyle';\nimport useUIKitTheme from '../../theme/useUIKitTheme';\nimport Button from '../Button';\nimport DialogBox from '../Dialog/DialogBox';\n\nexport type PromptItem = {\n title: string;\n placeholder?: string;\n defaultValue?: string;\n onSubmit?: (text: string) => void;\n submitLabel?: string;\n onCancel?: () => void;\n cancelLabel?: string;\n};\n\ntype Props = {\n visible: boolean;\n onHide: () => void;\n onDismiss?: () => void;\n autoFocus?: boolean;\n} & PromptItem;\nconst Prompt = ({\n onDismiss,\n visible,\n onHide,\n autoFocus = true,\n title,\n defaultValue = '',\n placeholder = 'Enter',\n onSubmit = NOOP,\n onCancel = NOOP,\n submitLabel = 'Submit',\n cancelLabel = 'Cancel',\n}: Props) => {\n const { statusBarTranslucent } = useHeaderStyle();\n const { colors } = useUIKitTheme();\n const inputRef = useRef<RNTextInput>(null);\n const { width, height } = useWindowDimensions();\n\n const buttons = [\n { text: cancelLabel, onPress: onCancel },\n { text: submitLabel, onPress: () => onSubmit(text) },\n ];\n\n const [text, setText] = useState(defaultValue);\n\n // FIXME: autoFocus trick with modal\n // Android\n // - InputProps.autoFocus is not trigger keyboard appearing.\n // - InputRef.focus() is trigger keyboard appearing, but position of keyboard selection is always the start of text.\n // iOS\n // - InputProps.autoFocus is trigger weird UI behavior on landscape mode.\n useEffect(() => {\n if (autoFocus && visible) {\n setTimeout(() => {\n if (Platform.OS === 'android') inputRef.current?.blur();\n inputRef.current?.focus();\n }, 250);\n }\n }, [autoFocus, visible, `${width}-${height}`]);\n\n return (\n <Modal\n enableKeyboardAvoid\n disableBackgroundClose\n onClose={onHide}\n onDismiss={() => {\n setText('');\n onDismiss?.();\n }}\n statusBarTranslucent={statusBarTranslucent}\n visible={visible}\n backgroundStyle={{ alignItems: 'center', justifyContent: 'center' }}\n >\n <DialogBox style={styles.container}>\n {Boolean(title) && (\n <View style={styles.titleContainer}>\n <Text h1 color={colors.ui.dialog.default.none.text} numberOfLines={1} style={{ flex: 1 }}>\n {title}\n </Text>\n </View>\n )}\n\n <View style={styles.inputContainer}>\n <TextInput\n autoFocus={autoFocus && Platform.OS === 'android'}\n ref={inputRef}\n placeholder={placeholder}\n variant={'underline'}\n value={text}\n onChangeText={setText}\n style={{ paddingHorizontal: 0, paddingVertical: 10 }}\n />\n </View>\n\n <View style={styles.buttonContainer}>\n {buttons.map(({ text, onPress }, index) => {\n return (\n <Button\n key={text + index}\n variant={'text'}\n style={styles.button}\n contentColor={colors.ui.dialog.default.none.highlight}\n onPress={() => {\n Keyboard.dismiss();\n try {\n onPress?.();\n } finally {\n onHide();\n }\n }}\n >\n {text}\n </Button>\n );\n })}\n </View>\n </DialogBox>\n </Modal>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n paddingTop: 8,\n },\n titleContainer: {\n marginBottom: 12,\n paddingVertical: 12,\n paddingHorizontal: 24,\n flexDirection: 'row',\n alignItems: 'center',\n },\n inputContainer: {\n paddingHorizontal: 24,\n marginBottom: 12,\n },\n buttonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-end',\n padding: 12,\n },\n button: {\n marginLeft: 8,\n },\n});\n\nexport default Prompt;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","useState","Keyboard","Platform","View","useWindowDimensions","NOOP","Modal","Text","TextInput","createStyleSheet","useHeaderStyle","useUIKitTheme","Button","DialogBox","Prompt","_ref","onDismiss","visible","onHide","autoFocus","title","defaultValue","placeholder","onSubmit","onCancel","submitLabel","cancelLabel","statusBarTranslucent","colors","inputRef","width","height","buttons","text","onPress","setText","setTimeout","_inputRef$current","_inputRef$current2","OS","current","blur","focus","createElement","enableKeyboardAvoid","disableBackgroundClose","onClose","backgroundStyle","alignItems","justifyContent","style","styles","container","Boolean","titleContainer","h1","color","ui","dialog","default","none","numberOfLines","flex","inputContainer","ref","variant","value","onChangeText","paddingHorizontal","paddingVertical","buttonContainer","map","_ref2","index","key","button","contentColor","highlight","dismiss","paddingTop","marginBottom","flexDirection","padding","marginLeft"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { Keyboard, Platform, TextInput as RNTextInput, View, useWindowDimensions } from 'react-native';\n\nimport { NOOP } from '@sendbird/uikit-utils';\n\nimport Modal from '../../components/Modal';\nimport Text from '../../components/Text';\nimport TextInput from '../../components/TextInput';\nimport createStyleSheet from '../../styles/createStyleSheet';\nimport useHeaderStyle from '../../styles/useHeaderStyle';\nimport useUIKitTheme from '../../theme/useUIKitTheme';\nimport Button from '../Button';\nimport DialogBox from '../Dialog/DialogBox';\n\nexport type PromptItem = {\n title: string;\n placeholder?: string;\n defaultValue?: string;\n onSubmit?: (text: string) => void;\n submitLabel?: string;\n onCancel?: () => void;\n cancelLabel?: string;\n};\n\ntype Props = {\n visible: boolean;\n onHide: () => void;\n onDismiss?: () => void;\n autoFocus?: boolean;\n} & PromptItem;\nconst Prompt = ({\n onDismiss,\n visible,\n onHide,\n autoFocus = true,\n title,\n defaultValue = '',\n placeholder = 'Enter',\n onSubmit = NOOP,\n onCancel = NOOP,\n submitLabel = 'Submit',\n cancelLabel = 'Cancel',\n}: Props) => {\n const { statusBarTranslucent } = useHeaderStyle();\n const { colors } = useUIKitTheme();\n const inputRef = useRef<RNTextInput>(null);\n const { width, height } = useWindowDimensions();\n\n const buttons = [\n { text: cancelLabel, onPress: onCancel },\n { text: submitLabel, onPress: () => onSubmit(text) },\n ];\n\n const [text, setText] = useState(defaultValue);\n\n // FIXME: autoFocus trick with modal\n // Android\n // - InputProps.autoFocus is not trigger keyboard appearing.\n // - InputRef.focus() is trigger keyboard appearing, but position of keyboard selection is always the start of text.\n // iOS\n // - InputProps.autoFocus is trigger weird UI behavior on landscape mode.\n useEffect(() => {\n if (autoFocus && visible) {\n setTimeout(() => {\n if (Platform.OS === 'android') inputRef.current?.blur();\n inputRef.current?.focus();\n }, 250);\n }\n }, [autoFocus, visible, `${width}-${height}`]);\n\n return (\n <Modal\n enableKeyboardAvoid\n disableBackgroundClose\n onClose={onHide}\n onDismiss={() => {\n setText('');\n onDismiss?.();\n }}\n statusBarTranslucent={statusBarTranslucent}\n visible={visible}\n backgroundStyle={{ alignItems: 'center', justifyContent: 'center' }}\n >\n <DialogBox style={styles.container}>\n {Boolean(title) && (\n <View style={styles.titleContainer}>\n <Text h1 color={colors.ui.dialog.default.none.text} numberOfLines={1} style={{ flex: 1 }}>\n {title}\n </Text>\n </View>\n )}\n\n <View style={styles.inputContainer}>\n <TextInput\n autoFocus={autoFocus && Platform.OS === 'android'}\n ref={inputRef}\n placeholder={placeholder}\n variant={'underline'}\n value={text}\n onChangeText={setText}\n style={{ paddingHorizontal: 0, paddingVertical: 10 }}\n />\n </View>\n\n <View style={styles.buttonContainer}>\n {buttons.map(({ text, onPress }, index) => {\n return (\n <Button\n key={text + index}\n variant={'text'}\n style={styles.button}\n contentColor={colors.ui.dialog.default.none.highlight}\n onPress={() => {\n Keyboard.dismiss();\n try {\n onPress?.();\n } finally {\n onHide();\n }\n }}\n >\n {text}\n </Button>\n );\n })}\n </View>\n </DialogBox>\n </Modal>\n );\n};\n\nconst styles = createStyleSheet({\n container: {\n paddingTop: 8,\n },\n titleContainer: {\n marginBottom: 12,\n paddingVertical: 12,\n paddingHorizontal: 24,\n flexDirection: 'row',\n alignItems: 'center',\n },\n inputContainer: {\n paddingHorizontal: 24,\n marginBottom: 12,\n },\n buttonContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'flex-end',\n padding: 12,\n },\n button: {\n marginLeft: 8,\n },\n});\n\nexport default Prompt;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC1D,SAASC,QAAQ,EAAEC,QAAQ,EAA4BC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AAEtG,SAASC,IAAI,QAAQ,uBAAuB;AAE5C,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,OAAOC,IAAI,MAAM,uBAAuB;AACxC,OAAOC,SAAS,MAAM,4BAA4B;AAClD,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,OAAOC,cA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AChB,CAAC;EACDV,eAAe,EAAE;IACfW,aAAa,EAAE,KAAK;IACpBjC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,UAAU;IAC1BiC,OAAO,EAAE;EACX,CAAC;EACDP,MAAM,EAAE;IACNQ,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEF,eAAerE,MAAM"}
|
|
@@ -6,10 +6,8 @@ import Text from '../../components/Text';
|
|
|
6
6
|
import createStyleSheet from '../../styles/createStyleSheet';
|
|
7
7
|
import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
8
8
|
const ToastContext = /*#__PURE__*/createContext(null);
|
|
9
|
-
|
|
10
9
|
const useOpacity = () => {
|
|
11
10
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
12
|
-
|
|
13
11
|
const transition = value => {
|
|
14
12
|
Animated.timing(opacity, {
|
|
15
13
|
toValue: value,
|
|
@@ -17,14 +15,12 @@ const useOpacity = () => {
|
|
|
17
15
|
useNativeDriver: true
|
|
18
16
|
}).start();
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
return {
|
|
22
19
|
opacity,
|
|
23
20
|
show: () => transition(1),
|
|
24
21
|
hide: () => transition(0)
|
|
25
22
|
};
|
|
26
23
|
};
|
|
27
|
-
|
|
28
24
|
const Toast = _ref => {
|
|
29
25
|
let {
|
|
30
26
|
visible,
|
|
@@ -50,14 +46,12 @@ const Toast = _ref => {
|
|
|
50
46
|
light: palette.error200
|
|
51
47
|
});
|
|
52
48
|
}
|
|
53
|
-
|
|
54
49
|
if (type === 'success') {
|
|
55
50
|
return select({
|
|
56
51
|
dark: palette.secondary300,
|
|
57
52
|
light: palette.secondary200
|
|
58
53
|
});
|
|
59
54
|
}
|
|
60
|
-
|
|
61
55
|
return 'transparent';
|
|
62
56
|
}, [type, select]);
|
|
63
57
|
const backgroundColor = useMemo(() => {
|
|
@@ -88,7 +82,6 @@ const Toast = _ref => {
|
|
|
88
82
|
style: styles.text
|
|
89
83
|
}, children));
|
|
90
84
|
};
|
|
91
|
-
|
|
92
85
|
const VISIBLE_MS = 3000;
|
|
93
86
|
export const ToastProvider = _ref2 => {
|
|
94
87
|
let {
|
|
@@ -106,7 +99,8 @@ export const ToastProvider = _ref2 => {
|
|
|
106
99
|
useEffect(() => {
|
|
107
100
|
if (!state.visible) return;
|
|
108
101
|
const hideTimeout = setTimeout(() => {
|
|
109
|
-
setState(prev => ({
|
|
102
|
+
setState(prev => ({
|
|
103
|
+
...prev,
|
|
110
104
|
visible: false
|
|
111
105
|
}));
|
|
112
106
|
}, dismissTimeout);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useContext","useEffect","useMemo","useRef","useState","Animated","KeyboardAvoidingView","Platform","useSafeAreaInsets","Icon","Text","createStyleSheet","useUIKitTheme","ToastContext","useOpacity","opacity","Value","current","transition","value","timing","toValue","duration","useNativeDriver","start","show","hide","Toast","visible","type","children","top","bottom","colors","select","palette","color","dark","error300","light","error200","secondary300","secondary200","backgroundColor","styles","toast","icon","onBackgroundReverse01","text","VISIBLE_MS","ToastProvider","dismissTimeout","state","setState","hideTimeout","setTimeout","prev","clearTimeout","
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","useEffect","useMemo","useRef","useState","Animated","KeyboardAvoidingView","Platform","useSafeAreaInsets","Icon","Text","createStyleSheet","useUIKitTheme","ToastContext","useOpacity","opacity","Value","current","transition","value","timing","toValue","duration","useNativeDriver","start","show","hide","Toast","_ref","visible","type","children","top","bottom","colors","select","palette","color","dark","error300","light","error200","secondary300","secondary200","backgroundColor","createElement","View","pointerEvents","style","styles","toast","icon","containerStyle","onBackgroundReverse01","body3","numberOfLines","text","VISIBLE_MS","ToastProvider","_ref2","dismissTimeout","state","setState","hideTimeout","setTimeout","prev","clearTimeout","Provider","arguments","length","undefined","behavior","OS","keyboardVerticalOffset","toastPosition","useToast","context","Error","position","height","paddingHorizontal","justifyContent","alignItems","alignSelf","borderRadius","flexDirection","marginRight","maxWidth"],"sources":["index.tsx"],"sourcesContent":["import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport { Animated, KeyboardAvoidingView, Platform } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport Icon from '../../components/Icon';\nimport Text from '../../components/Text';\nimport createStyleSheet from '../../styles/createStyleSheet';\nimport useUIKitTheme from '../../theme/useUIKitTheme';\n\ntype ToastType = 'normal' | 'error' | 'success';\ntype Context = { show(text: string, type?: ToastType): void };\n\nconst ToastContext = createContext<Context | null>(null);\n\ntype Props = React.PropsWithChildren<{\n top?: number;\n bottom?: number;\n visible: boolean;\n type: ToastType;\n children: string;\n}>;\n\nconst useOpacity = () => {\n const opacity = useRef(new Animated.Value(0)).current;\n const transition = (value: number) => {\n Animated.timing(opacity, { toValue: value, duration: 500, useNativeDriver: true }).start();\n };\n\n return {\n opacity,\n show: () => transition(1),\n hide: () => transition(0),\n };\n};\n\nconst Toast = ({ visible, type, children, top, bottom }: Props) => {\n const { colors, select, palette } = useUIKitTheme();\n const { opacity, show, hide } = useOpacity();\n\n const color = useMemo(() => {\n if (type === 'error') {\n return select({ dark: palette.error300, light: palette.error200 });\n }\n if (type === 'success') {\n return select({ dark: palette.secondary300, light: palette.secondary200 });\n }\n return 'transparent';\n }, [type, select]);\n\n const backgroundColor = useMemo(() => {\n return select({ light: 'rgba(0,0,0,0.64)', dark: 'rgba(255,255,255,0.64)' });\n }, [select]);\n\n useEffect(() => {\n visible ? show() : hide();\n }, [visible]);\n\n return (\n <Animated.View pointerEvents={'none'} style={[styles.toast, { opacity, top, bottom, backgroundColor }]}>\n {type !== 'normal' && (\n <Icon icon={type === 'success' ? 'done' : 'error'} color={color} containerStyle={styles.icon} />\n )}\n <Text color={colors.onBackgroundReverse01} body3 numberOfLines={2} style={styles.text}>\n {children}\n </Text>\n </Animated.View>\n );\n};\n\nconst VISIBLE_MS = 3000;\nexport const ToastProvider = ({\n children,\n dismissTimeout = VISIBLE_MS,\n}: React.PropsWithChildren<{ dismissTimeout?: number }>) => {\n const [state, setState] = useState({ visible: false, type: 'error' as ToastType, text: '' });\n const { bottom } = useSafeAreaInsets();\n\n useEffect(() => {\n if (!state.visible) return;\n\n const hideTimeout = setTimeout(() => {\n setState((prev) => ({ ...prev, visible: false }));\n }, dismissTimeout);\n return () => clearTimeout(hideTimeout);\n });\n\n return (\n <ToastContext.Provider value={{ show: (text, type = 'normal') => text && setState({ text, type, visible: true }) }}>\n {children}\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'position' : undefined}\n keyboardVerticalOffset={-bottom}\n pointerEvents={'none'}\n >\n <Toast type={state.type} visible={state.visible} bottom={bottom + styles.toastPosition.bottom}>\n {state.text}\n </Toast>\n </KeyboardAvoidingView>\n </ToastContext.Provider>\n );\n};\n\nexport const useToast = () => {\n const context = useContext(ToastContext);\n if (!context) throw new Error('ToastContext is not provided, wrap your app with ToastProvider');\n return context;\n};\n\nconst styles = createStyleSheet({\n toast: {\n position: 'absolute',\n height: 48,\n paddingHorizontal: 12,\n justifyContent: 'center',\n alignItems: 'center',\n alignSelf: 'center',\n borderRadius: 24,\n flexDirection: 'row',\n },\n icon: {\n marginRight: 4,\n },\n text: {\n maxWidth: 240,\n paddingHorizontal: 4,\n },\n toastPosition: {\n bottom: 60,\n },\n});\n\nexport default Toast;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC9F,SAASC,QAAQ,EAAEC,oBAAoB,EAAEC,QAAQ,QAAQ,cAAc;AACvE,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,OAAOC,IAAI,MAAM,uBAAuB;AACxC,OAAOC,IAAI,MAAM,uBAAuB;AACxC,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,OAAOC,aAAa,MAAM,2BAA2B;AAKrD,MAAMC,YAAY,gBAAGd,aAAa,CAAiB,IAAI,CAAC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UAAU,CAACa,YAAY,CAAC;EACxC,IAAI,CAAC+D,OAAO,EAAE,MAAM,IAAIC,KAAK,CAAC,gEAAgE,CAAC;EAC/F,OAAOD,OAAO;AAChB,CAAC;AAED,MAAM3B,MAAM,GAAGtC,gBAAgB,CAAC;EAC9BuC,KAAK,EAAE;IACL4B,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,iBAAiB,EAAE,EAAE;IACrBC,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,aAAa,EAAE;EACjB,CAAC;EACDlC,IAAI,EAAE;IACJmC,WAAW,EAAE;EACf,CAAC;EACD9B,IAAI,EAAE;IACJ+B,QAAQ,EAAE,GAAG;IACbP,iBAAiB,EAAE;EACrB,CAAC;EACDN,aAAa,EAAE;IACbzC,MAAM,EAAE;EACV;AACF,CAAC,CAAC;AAEF,eAAeN,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native-foundation",
|
|
3
|
-
"version": "2.4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.4.2",
|
|
4
|
+
"description": "A foundational UI kit for building chat-enabled React Native apps.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sendbird",
|
|
7
|
+
"uikit",
|
|
8
|
+
"React Native",
|
|
9
|
+
"chat",
|
|
10
|
+
"messaging",
|
|
11
|
+
"UI components",
|
|
12
|
+
"customizable",
|
|
13
|
+
"theme",
|
|
14
|
+
"design system"
|
|
15
|
+
],
|
|
5
16
|
"main": "lib/commonjs/index",
|
|
6
17
|
"module": "lib/module/index",
|
|
7
18
|
"types": "lib/typescript/src/index.d.ts",
|
|
@@ -19,10 +30,6 @@
|
|
|
19
30
|
"clean": "del lib",
|
|
20
31
|
"generate-icons": "node src/assets/bundle-icons.js"
|
|
21
32
|
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"react-native",
|
|
24
|
-
"sendbird"
|
|
25
|
-
],
|
|
26
33
|
"repository": {
|
|
27
34
|
"type": "git",
|
|
28
35
|
"url": "https://github.com/sendbird/sendbird-uikit-react-native.git",
|
|
@@ -39,7 +46,7 @@
|
|
|
39
46
|
"access": "public"
|
|
40
47
|
},
|
|
41
48
|
"dependencies": {
|
|
42
|
-
"@sendbird/uikit-utils": "2.4.
|
|
49
|
+
"@sendbird/uikit-utils": "2.4.2"
|
|
43
50
|
},
|
|
44
51
|
"devDependencies": {
|
|
45
52
|
"@types/react": "*",
|
|
@@ -81,5 +88,5 @@
|
|
|
81
88
|
"readmeFile": "./README.md",
|
|
82
89
|
"displayName": "@sendbird/uikit-react-native-foundation"
|
|
83
90
|
},
|
|
84
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "ae9e60edc60cdd4f6e9b0e4019e84584e807bc2c"
|
|
85
92
|
}
|
|
@@ -30,6 +30,13 @@ function convertSource(source: SendbirdImageProps['source']): Source | number {
|
|
|
30
30
|
cache: convertCache(source.cache), //'immutable' | 'web' | 'cacheOnly'
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
function convertDefaultSource(source?: SendbirdImageProps['defaultSource']): number | undefined {
|
|
34
|
+
if (typeof source === 'number') {
|
|
35
|
+
return source;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
33
40
|
|
|
34
41
|
function convertResizeMode(mode?: SendbirdImageProps['resizeMode']): ResizeMode | undefined {
|
|
35
42
|
switch (mode) {
|
|
@@ -52,7 +59,15 @@ try {
|
|
|
52
59
|
FastImage = require('react-native-fast-image') as (props: FastImageProps) => JSX.Element;
|
|
53
60
|
} catch {}
|
|
54
61
|
|
|
55
|
-
const Image_FastImage: SendbirdImageComponent = ({
|
|
62
|
+
const Image_FastImage: SendbirdImageComponent = ({
|
|
63
|
+
source,
|
|
64
|
+
defaultSource,
|
|
65
|
+
resizeMode,
|
|
66
|
+
onLoad,
|
|
67
|
+
onError,
|
|
68
|
+
style,
|
|
69
|
+
...props
|
|
70
|
+
}) => {
|
|
56
71
|
return (
|
|
57
72
|
<FastImage
|
|
58
73
|
{...props}
|
|
@@ -60,6 +75,7 @@ const Image_FastImage: SendbirdImageComponent = ({ source, resizeMode, onLoad, o
|
|
|
60
75
|
onError={onError && (() => onError({}))}
|
|
61
76
|
style={style as FastImageProps['style']}
|
|
62
77
|
source={convertSource(source)}
|
|
78
|
+
defaultSource={convertDefaultSource(defaultSource)}
|
|
63
79
|
resizeMode={convertResizeMode(resizeMode)}
|
|
64
80
|
/>
|
|
65
81
|
);
|