@sendbird/uikit-react-native-foundation 2.0.0 → 2.0.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.
Files changed (44) hide show
  1. package/lib/commonjs/index.js +16 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/theme/DarkUIKitTheme.js +10 -0
  4. package/lib/commonjs/theme/DarkUIKitTheme.js.map +1 -1
  5. package/lib/commonjs/theme/LightUIKitTheme.js +10 -0
  6. package/lib/commonjs/theme/LightUIKitTheme.js.map +1 -1
  7. package/lib/commonjs/types.js.map +1 -1
  8. package/lib/commonjs/ui/GroupChannelPreview/index.js +11 -2
  9. package/lib/commonjs/ui/GroupChannelPreview/index.js.map +1 -1
  10. package/lib/commonjs/ui/OutlinedButton/index.js +57 -0
  11. package/lib/commonjs/ui/OutlinedButton/index.js.map +1 -0
  12. package/lib/commonjs/ui/ProfileCard/index.js +94 -0
  13. package/lib/commonjs/ui/ProfileCard/index.js.map +1 -0
  14. package/lib/commonjs/ui/Toast/index.js +15 -7
  15. package/lib/commonjs/ui/Toast/index.js.map +1 -1
  16. package/lib/module/index.js +2 -0
  17. package/lib/module/index.js.map +1 -1
  18. package/lib/module/theme/DarkUIKitTheme.js +10 -0
  19. package/lib/module/theme/DarkUIKitTheme.js.map +1 -1
  20. package/lib/module/theme/LightUIKitTheme.js +10 -0
  21. package/lib/module/theme/LightUIKitTheme.js.map +1 -1
  22. package/lib/module/types.js.map +1 -1
  23. package/lib/module/ui/GroupChannelPreview/index.js +11 -2
  24. package/lib/module/ui/GroupChannelPreview/index.js.map +1 -1
  25. package/lib/module/ui/OutlinedButton/index.js +43 -0
  26. package/lib/module/ui/OutlinedButton/index.js.map +1 -0
  27. package/lib/module/ui/ProfileCard/index.js +78 -0
  28. package/lib/module/ui/ProfileCard/index.js.map +1 -0
  29. package/lib/module/ui/Toast/index.js +17 -9
  30. package/lib/module/ui/Toast/index.js.map +1 -1
  31. package/lib/typescript/src/index.d.ts +2 -0
  32. package/lib/typescript/src/types.d.ts +5 -1
  33. package/lib/typescript/src/ui/GroupChannelPreview/index.d.ts +2 -1
  34. package/lib/typescript/src/ui/OutlinedButton/index.d.ts +8 -0
  35. package/lib/typescript/src/ui/ProfileCard/index.d.ts +11 -0
  36. package/package.json +3 -3
  37. package/src/index.ts +2 -0
  38. package/src/theme/DarkUIKitTheme.ts +10 -0
  39. package/src/theme/LightUIKitTheme.ts +10 -0
  40. package/src/types.ts +7 -1
  41. package/src/ui/GroupChannelPreview/index.tsx +13 -0
  42. package/src/ui/OutlinedButton/index.tsx +42 -0
  43. package/src/ui/ProfileCard/index.tsx +73 -0
  44. package/src/ui/Toast/index.tsx +15 -9
@@ -13,6 +13,7 @@ declare type Props = {
13
13
  maxBadgeCount?: number;
14
14
  frozen?: boolean;
15
15
  notificationOff?: boolean;
16
+ broadcast?: boolean;
16
17
  };
17
- declare const GroupChannelPreview: ({ customCover, coverUrl, memberCount, badgeCount, maxBadgeCount, body, bodyIcon, title, titleCaption, titleCaptionLeft, frozen, notificationOff, }: Props) => JSX.Element;
18
+ declare const GroupChannelPreview: ({ customCover, coverUrl, memberCount, badgeCount, maxBadgeCount, body, bodyIcon, title, titleCaption, titleCaptionLeft, frozen, notificationOff, broadcast, }: Props) => JSX.Element;
18
19
  export default GroupChannelPreview;
@@ -0,0 +1,8 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ declare type OutlinedButtonProps = {
3
+ children: string;
4
+ containerStyle?: StyleProp<ViewStyle>;
5
+ onPress?: () => void;
6
+ };
7
+ declare const OutlinedButton: ({ children, onPress, containerStyle }: OutlinedButtonProps) => JSX.Element;
8
+ export default OutlinedButton;
@@ -0,0 +1,11 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ declare type Props = {
3
+ uri: string;
4
+ username: string;
5
+ button?: JSX.Element;
6
+ bodyLabel: string;
7
+ body: string;
8
+ containerStyle?: StyleProp<ViewStyle>;
9
+ };
10
+ declare const ProfileCard: ({ uri, username, bodyLabel, body, button, containerStyle }: Props) => JSX.Element;
11
+ export default ProfileCard;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendbird/uikit-react-native-foundation",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "react-native-uikit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -38,7 +38,7 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@sendbird/uikit-utils": "2.0.0"
41
+ "@sendbird/uikit-utils": "2.0.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/react": "*",
@@ -80,5 +80,5 @@
80
80
  "readmeFile": "./README.md",
81
81
  "displayName": "@sendbird/uikit-react-native-foundation"
82
82
  },
83
- "gitHead": "955f7adf0891976d8553d9c3b4c171225c775bc9"
83
+ "gitHead": "95323825da753f20b931b4a8b7e187cd8dc6284e"
84
84
  }
package/src/index.ts CHANGED
@@ -24,7 +24,9 @@ export { default as GroupChannelPreview } from './ui/GroupChannelPreview';
24
24
  export { default as Header } from './ui/Header';
25
25
  export { default as LoadingSpinner } from './ui/LoadingSpinner';
26
26
  export { default as MenuBar, MenuBarProps } from './ui/MenuBar';
27
+ export { default as OutlinedButton } from './ui/OutlinedButton';
27
28
  export { default as Placeholder } from './ui/Placeholder';
29
+ export { default as ProfileCard } from './ui/ProfileCard';
28
30
  export { default as Prompt } from './ui/Prompt';
29
31
  export { default as Toast, useToast, ToastProvider } from './ui/Toast';
30
32
 
@@ -169,6 +169,16 @@ const DarkUIKitTheme = createTheme({
169
169
  },
170
170
  },
171
171
  },
172
+ profileCard: {
173
+ default: {
174
+ none: {
175
+ textUsername: palette.onBackgroundDark01,
176
+ textBodyLabel: palette.onBackgroundDark02,
177
+ textBody: palette.onBackgroundDark01,
178
+ background: palette.background500,
179
+ },
180
+ },
181
+ },
172
182
  },
173
183
  }),
174
184
  });
@@ -169,6 +169,16 @@ const LightUIKitTheme = createTheme({
169
169
  },
170
170
  },
171
171
  },
172
+ profileCard: {
173
+ default: {
174
+ none: {
175
+ textUsername: palette.onBackgroundLight01,
176
+ textBodyLabel: palette.onBackgroundLight02,
177
+ textBody: palette.onBackgroundLight01,
178
+ background: palette.background50,
179
+ },
180
+ },
181
+ },
172
182
  },
173
183
  }),
174
184
  });
package/src/types.ts CHANGED
@@ -39,7 +39,9 @@ export type Component =
39
39
  | 'Placeholder'
40
40
  | 'Message'
41
41
  | 'DateSeparator'
42
- | 'GroupChannelPreview';
42
+ | 'GroupChannelPreview'
43
+ | 'ProfileCard';
44
+
43
45
  export type GetColorTree<
44
46
  Tree extends {
45
47
  Variant: {
@@ -65,6 +67,7 @@ export type ComponentColorTree = GetColorTree<{
65
67
  Message: 'incoming' | 'outgoing';
66
68
  DateSeparator: 'default';
67
69
  GroupChannelPreview: 'default';
70
+ ProfileCard: 'default';
68
71
  };
69
72
  State: {
70
73
  Header: 'none';
@@ -76,6 +79,7 @@ export type ComponentColorTree = GetColorTree<{
76
79
  Message: 'enabled' | 'pressed';
77
80
  DateSeparator: 'none';
78
81
  GroupChannelPreview: 'none';
82
+ ProfileCard: 'none';
79
83
  };
80
84
  ColorPart: {
81
85
  Header: 'background' | 'borderBottom';
@@ -96,6 +100,7 @@ export type ComponentColorTree = GetColorTree<{
96
100
  | 'coverBackground'
97
101
  | 'bodyIconBackground'
98
102
  | 'separator';
103
+ ProfileCard: 'textUsername' | 'textBodyLabel' | 'textBody' | 'background';
99
104
  };
100
105
  }>;
101
106
  export type ComponentColors<T extends Component> = {
@@ -139,6 +144,7 @@ export interface UIKitColors {
139
144
  message: ComponentColors<'Message'>;
140
145
  dateSeparator: ComponentColors<'DateSeparator'>;
141
146
  groupChannelPreview: ComponentColors<'GroupChannelPreview'>;
147
+ profileCard: ComponentColors<'ProfileCard'>;
142
148
  };
143
149
  }
144
150
 
@@ -28,6 +28,7 @@ type Props = {
28
28
 
29
29
  frozen?: boolean;
30
30
  notificationOff?: boolean;
31
+ broadcast?: boolean;
31
32
  };
32
33
 
33
34
  const GroupChannelPreview = ({
@@ -43,6 +44,7 @@ const GroupChannelPreview = ({
43
44
  titleCaptionLeft,
44
45
  frozen,
45
46
  notificationOff,
47
+ broadcast,
46
48
  }: Props) => {
47
49
  const { colors } = useUIKitTheme();
48
50
  const color = colors.ui.groupChannelPreview;
@@ -65,6 +67,14 @@ const GroupChannelPreview = ({
65
67
  <View style={styles.rightSection}>
66
68
  <View style={styles.rightTopSection}>
67
69
  <View style={styles.channelInfoContainer}>
70
+ {broadcast && (
71
+ <Icon
72
+ size={16}
73
+ icon={'broadcast'}
74
+ color={colors.secondary}
75
+ containerStyle={styles.channelInfoBroadcast}
76
+ />
77
+ )}
68
78
  <Text numberOfLines={1} subtitle1 style={styles.channelInfoTitle} color={color.default.none.textTitle}>
69
79
  {title}
70
80
  </Text>
@@ -148,6 +158,9 @@ const styles = createStyleSheet({
148
158
  alignItems: 'center',
149
159
  flexDirection: 'row',
150
160
  },
161
+ channelInfoBroadcast: {
162
+ marginRight: 4,
163
+ },
151
164
  channelInfoTitle: {
152
165
  flexShrink: 1,
153
166
  marginRight: 4,
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { Pressable, StyleProp, ViewStyle } from 'react-native';
3
+
4
+ import Text from '../../components/Text';
5
+ import createStyleSheet from '../../styles/createStyleSheet';
6
+ import useUIKitTheme from '../../theme/useUIKitTheme';
7
+
8
+ type OutlinedButtonProps = {
9
+ children: string;
10
+ containerStyle?: StyleProp<ViewStyle>;
11
+ onPress?: () => void;
12
+ };
13
+
14
+ const OutlinedButton = ({ children, onPress, containerStyle }: OutlinedButtonProps) => {
15
+ const { colors } = useUIKitTheme();
16
+ return (
17
+ <Pressable
18
+ onPress={onPress}
19
+ style={[styles.outlinedButton, { borderColor: colors.onBackground01 }, containerStyle]}
20
+ >
21
+ <Text button color={colors.onBackground01} numberOfLines={1} style={styles.outlinedButtonText}>
22
+ {children}
23
+ </Text>
24
+ </Pressable>
25
+ );
26
+ };
27
+
28
+ const styles = createStyleSheet({
29
+ outlinedButton: {
30
+ borderRadius: 4,
31
+ padding: 16,
32
+ borderWidth: 1,
33
+ alignItems: 'center',
34
+ justifyContent: 'center',
35
+ },
36
+ outlinedButtonText: {
37
+ textAlign: 'center',
38
+ width: '100%',
39
+ },
40
+ });
41
+
42
+ export default OutlinedButton;
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import { StyleProp, View, ViewStyle } from 'react-native';
3
+
4
+ import Divider from '../../components/Divider';
5
+ import Text from '../../components/Text';
6
+ import createStyleSheet from '../../styles/createStyleSheet';
7
+ import useUIKitTheme from '../../theme/useUIKitTheme';
8
+ import Avatar from '../Avatar';
9
+
10
+ type Props = {
11
+ uri: string;
12
+ username: string;
13
+
14
+ button?: JSX.Element;
15
+
16
+ bodyLabel: string;
17
+ body: string;
18
+
19
+ containerStyle?: StyleProp<ViewStyle>;
20
+ };
21
+
22
+ const ProfileCard = ({ uri, username, bodyLabel, body, button, containerStyle }: Props) => {
23
+ const { colors } = useUIKitTheme();
24
+ const color = colors.ui.profileCard.default.none;
25
+
26
+ return (
27
+ <View style={[styles.container, { backgroundColor: color.background }, containerStyle]}>
28
+ <View style={styles.profileContainer}>
29
+ <Avatar uri={uri} size={80} containerStyle={styles.profileAvatar} />
30
+ <Text h1 color={color.textUsername} numberOfLines={1}>
31
+ {username}
32
+ </Text>
33
+ </View>
34
+ {button && <View style={styles.messageButtonArea}>{button}</View>}
35
+ <Divider space={16} />
36
+ <View style={styles.profileInfoContainer}>
37
+ <Text body2 color={color.textBodyLabel} style={styles.profileInfoBodyLabel}>
38
+ {bodyLabel}
39
+ </Text>
40
+ <Text body3 numberOfLines={1} color={color.textBody}>
41
+ {body}
42
+ </Text>
43
+ </View>
44
+ </View>
45
+ );
46
+ };
47
+
48
+ const styles = createStyleSheet({
49
+ container: {
50
+ paddingTop: 32,
51
+ width: '100%',
52
+ },
53
+ profileContainer: {
54
+ alignItems: 'center',
55
+ paddingHorizontal: 16,
56
+ marginBottom: 24,
57
+ },
58
+ profileAvatar: {
59
+ marginBottom: 8,
60
+ },
61
+ profileInfoContainer: {
62
+ padding: 16,
63
+ },
64
+ profileInfoBodyLabel: {
65
+ marginBottom: 4,
66
+ },
67
+ messageButtonArea: {
68
+ marginHorizontal: 24,
69
+ marginBottom: 24,
70
+ },
71
+ });
72
+
73
+ export default ProfileCard;
@@ -1,5 +1,5 @@
1
- import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
2
- import { Animated } from 'react-native';
1
+ import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { Animated, KeyboardAvoidingView, Platform } from 'react-native';
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
4
 
5
5
  import Icon from '../../components/Icon';
@@ -22,10 +22,10 @@ type Props = React.PropsWithChildren<{
22
22
 
23
23
  const useOpacity = () => {
24
24
  const opacity = useRef(new Animated.Value(0)).current;
25
- const transition = useCallback(
26
- (value: number) => Animated.timing(opacity, { toValue: value, duration: 500, useNativeDriver: true }).start(),
27
- [],
28
- );
25
+ const transition = (value: number) => {
26
+ Animated.timing(opacity, { toValue: value, duration: 500, useNativeDriver: true }).start();
27
+ };
28
+
29
29
  return {
30
30
  opacity,
31
31
  show: () => transition(1),
@@ -87,9 +87,15 @@ export const ToastProvider = ({
87
87
  return (
88
88
  <ToastContext.Provider value={{ show: (text, type = 'normal') => text && setState({ text, type, visible: true }) }}>
89
89
  {children}
90
- <Toast type={state.type} visible={state.visible} bottom={bottom + styles.toastPosition.bottom}>
91
- {state.text}
92
- </Toast>
90
+ <KeyboardAvoidingView
91
+ behavior={Platform.OS === 'ios' ? 'position' : undefined}
92
+ keyboardVerticalOffset={-bottom}
93
+ pointerEvents={'none'}
94
+ >
95
+ <Toast type={state.type} visible={state.visible} bottom={bottom + styles.toastPosition.bottom}>
96
+ {state.text}
97
+ </Toast>
98
+ </KeyboardAvoidingView>
93
99
  </ToastContext.Provider>
94
100
  );
95
101
  };