@sendbird/uikit-react-native-foundation 1.0.0 → 1.1.0
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/Image/index.js.map +1 -1
- package/lib/commonjs/styles/HeaderStyleContext.js +10 -2
- package/lib/commonjs/styles/HeaderStyleContext.js.map +1 -1
- package/lib/commonjs/styles/createScaleFactor.js +2 -1
- package/lib/commonjs/styles/createScaleFactor.js.map +1 -1
- package/lib/commonjs/theme/UIKitThemeProvider.js.map +1 -1
- package/lib/commonjs/ui/ActionMenu/index.js.map +1 -1
- package/lib/commonjs/ui/Alert/index.js.map +1 -1
- package/lib/commonjs/ui/Avatar/AvatarGroup.js.map +1 -1
- package/lib/commonjs/ui/Avatar/AvatarIcon.js.map +1 -1
- package/lib/commonjs/ui/Avatar/index.js.map +1 -1
- package/lib/commonjs/ui/Badge/index.js.map +1 -1
- package/lib/commonjs/ui/BottomSheet/index.js.map +1 -1
- package/lib/commonjs/ui/Button/index.js.map +1 -1
- package/lib/commonjs/ui/ChannelFrozenBanner/index.js.map +1 -1
- package/lib/commonjs/ui/Dialog/DialogBox.js.map +1 -1
- package/lib/commonjs/ui/Dialog/DialogSheet.js.map +1 -1
- package/lib/commonjs/ui/Dialog/index.js.map +1 -1
- package/lib/commonjs/ui/Divider/index.js.map +1 -1
- package/lib/commonjs/ui/GroupChannelPreview/index.js +15 -11
- package/lib/commonjs/ui/GroupChannelPreview/index.js.map +1 -1
- package/lib/commonjs/ui/Header/index.js +3 -8
- package/lib/commonjs/ui/Header/index.js.map +1 -1
- package/lib/commonjs/ui/Icon/index.js.map +1 -1
- package/lib/commonjs/ui/LoadingSpinner/index.js.map +1 -1
- package/lib/commonjs/ui/MenuBar/index.js.map +1 -1
- package/lib/commonjs/ui/Modal/index.js.map +1 -1
- package/lib/commonjs/ui/Placeholder/index.js.map +1 -1
- package/lib/commonjs/ui/Prompt/index.js.map +1 -1
- package/lib/commonjs/ui/Switch/index.js.map +1 -1
- package/lib/commonjs/ui/Text/index.js.map +1 -1
- package/lib/commonjs/ui/Toast/index.js.map +1 -1
- package/lib/commonjs/ui/URLParsedText/index.js.map +1 -1
- package/lib/module/components/Image/index.js.map +1 -1
- package/lib/module/styles/HeaderStyleContext.js +10 -3
- package/lib/module/styles/HeaderStyleContext.js.map +1 -1
- package/lib/module/styles/createScaleFactor.js +2 -1
- package/lib/module/styles/createScaleFactor.js.map +1 -1
- package/lib/module/theme/UIKitThemeProvider.js.map +1 -1
- package/lib/module/ui/ActionMenu/index.js.map +1 -1
- package/lib/module/ui/Alert/index.js.map +1 -1
- package/lib/module/ui/Avatar/AvatarGroup.js.map +1 -1
- package/lib/module/ui/Avatar/AvatarIcon.js.map +1 -1
- package/lib/module/ui/Avatar/index.js.map +1 -1
- package/lib/module/ui/Badge/index.js.map +1 -1
- package/lib/module/ui/BottomSheet/index.js.map +1 -1
- package/lib/module/ui/Button/index.js.map +1 -1
- package/lib/module/ui/ChannelFrozenBanner/index.js.map +1 -1
- package/lib/module/ui/Dialog/DialogBox.js.map +1 -1
- package/lib/module/ui/Dialog/DialogSheet.js.map +1 -1
- package/lib/module/ui/Dialog/index.js.map +1 -1
- package/lib/module/ui/Divider/index.js.map +1 -1
- package/lib/module/ui/GroupChannelPreview/index.js +15 -9
- package/lib/module/ui/GroupChannelPreview/index.js.map +1 -1
- package/lib/module/ui/Header/index.js +4 -8
- package/lib/module/ui/Header/index.js.map +1 -1
- package/lib/module/ui/Icon/index.js.map +1 -1
- package/lib/module/ui/LoadingSpinner/index.js.map +1 -1
- package/lib/module/ui/MenuBar/index.js.map +1 -1
- package/lib/module/ui/Modal/index.js.map +1 -1
- package/lib/module/ui/Placeholder/index.js.map +1 -1
- package/lib/module/ui/Prompt/index.js.map +1 -1
- package/lib/module/ui/Switch/index.js.map +1 -1
- package/lib/module/ui/Text/index.js.map +1 -1
- package/lib/module/ui/Toast/index.js.map +1 -1
- package/lib/module/ui/URLParsedText/index.js.map +1 -1
- package/lib/typescript/src/components/Image/index.d.ts +1 -2
- package/lib/typescript/src/styles/HeaderStyleContext.d.ts +2 -1
- package/lib/typescript/src/styles/getDefaultHeaderHeight.d.ts +1 -1
- package/lib/typescript/src/theme/UIKitThemeProvider.d.ts +3 -3
- package/lib/typescript/src/ui/ActionMenu/index.d.ts +1 -2
- package/lib/typescript/src/ui/Alert/index.d.ts +1 -2
- package/lib/typescript/src/ui/Avatar/AvatarGroup.d.ts +3 -3
- package/lib/typescript/src/ui/Avatar/AvatarIcon.d.ts +1 -2
- package/lib/typescript/src/ui/Avatar/index.d.ts +1 -2
- package/lib/typescript/src/ui/Badge/index.d.ts +1 -2
- package/lib/typescript/src/ui/BottomSheet/index.d.ts +1 -2
- package/lib/typescript/src/ui/Button/index.d.ts +3 -3
- package/lib/typescript/src/ui/ChannelFrozenBanner/index.d.ts +1 -2
- package/lib/typescript/src/ui/Dialog/DialogBox.d.ts +3 -3
- package/lib/typescript/src/ui/Dialog/DialogSheet.d.ts +4 -4
- package/lib/typescript/src/ui/Dialog/index.d.ts +3 -3
- package/lib/typescript/src/ui/Divider/index.d.ts +1 -2
- package/lib/typescript/src/ui/GroupChannelPreview/index.d.ts +3 -2
- package/lib/typescript/src/ui/Header/index.d.ts +6 -10
- package/lib/typescript/src/ui/Icon/index.d.ts +1 -2
- package/lib/typescript/src/ui/LoadingSpinner/index.d.ts +1 -2
- package/lib/typescript/src/ui/MenuBar/index.d.ts +1 -1
- package/lib/typescript/src/ui/Modal/index.d.ts +1 -2
- package/lib/typescript/src/ui/Placeholder/index.d.ts +1 -2
- package/lib/typescript/src/ui/Prompt/index.d.ts +1 -2
- package/lib/typescript/src/ui/Switch/index.d.ts +3 -3
- package/lib/typescript/src/ui/Text/index.d.ts +1 -2
- package/lib/typescript/src/ui/Toast/index.d.ts +5 -5
- package/lib/typescript/src/ui/URLParsedText/index.d.ts +1 -2
- package/package.json +5 -5
- package/src/components/Image/index.ts +1 -2
- package/src/styles/HeaderStyleContext.tsx +8 -3
- package/src/styles/createScaleFactor.ts +2 -1
- package/src/theme/UIKitThemeProvider.tsx +4 -2
- package/src/ui/ActionMenu/index.tsx +1 -1
- package/src/ui/Alert/index.tsx +1 -8
- package/src/ui/Avatar/AvatarGroup.tsx +5 -2
- package/src/ui/Avatar/AvatarIcon.tsx +1 -1
- package/src/ui/Avatar/index.tsx +12 -3
- package/src/ui/Badge/index.tsx +1 -1
- package/src/ui/BottomSheet/index.tsx +1 -1
- package/src/ui/Button/index.tsx +4 -4
- package/src/ui/ChannelFrozenBanner/index.tsx +1 -1
- package/src/ui/Dialog/DialogBox.tsx +3 -3
- package/src/ui/Dialog/DialogSheet.tsx +4 -4
- package/src/ui/Dialog/index.tsx +3 -3
- package/src/ui/Divider/index.tsx +1 -1
- package/src/ui/GroupChannelPreview/index.tsx +18 -9
- package/src/ui/Header/index.tsx +9 -17
- package/src/ui/Icon/index.tsx +7 -2
- package/src/ui/LoadingSpinner/index.tsx +2 -2
- package/src/ui/MenuBar/index.tsx +2 -2
- package/src/ui/Modal/index.tsx +2 -2
- package/src/ui/Placeholder/index.tsx +1 -1
- package/src/ui/Prompt/index.tsx +2 -2
- package/src/ui/Switch/index.tsx +4 -4
- package/src/ui/Text/index.tsx +1 -1
- package/src/ui/Toast/index.tsx +8 -4
- package/src/ui/URLParsedText/index.tsx +1 -1
|
@@ -11,5 +11,5 @@ export declare type MenuBarProps = {
|
|
|
11
11
|
actionLabel?: string;
|
|
12
12
|
actionItem?: React.ReactNode;
|
|
13
13
|
};
|
|
14
|
-
declare const MenuBar:
|
|
14
|
+
declare const MenuBar: ({ variant, disabled, onPress, name, icon, iconColor, iconBackgroundColor, actionLabel, actionItem, }: MenuBarProps) => JSX.Element;
|
|
15
15
|
export default MenuBar;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ModalProps, StyleProp, ViewStyle } from 'react-native';
|
|
3
2
|
declare type Props = {
|
|
4
3
|
type?: 'slide' | 'fade';
|
|
@@ -14,5 +13,5 @@ declare type Props = {
|
|
|
14
13
|
* Modal Close: Triggered by Modal.props.onClose() call
|
|
15
14
|
* - Modal.props.onClose() -> visible false -> animation start -> modalVisible false
|
|
16
15
|
* */
|
|
17
|
-
declare const Modal:
|
|
16
|
+
declare const Modal: ({ children, onClose, backgroundStyle, onDismiss, type, visible, disableBackgroundClose, enableKeyboardAvoid, statusBarTranslucent, ...props }: Props) => JSX.Element;
|
|
18
17
|
export default Modal;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import Icon from '../Icon';
|
|
3
2
|
declare type Props = {
|
|
4
3
|
loading?: boolean;
|
|
@@ -7,5 +6,5 @@ declare type Props = {
|
|
|
7
6
|
errorRetryLabel?: string;
|
|
8
7
|
onPressRetry?: () => void;
|
|
9
8
|
};
|
|
10
|
-
declare const Placeholder:
|
|
9
|
+
declare const Placeholder: ({ icon, loading, message, errorRetryLabel, onPressRetry }: Props) => JSX.Element;
|
|
11
10
|
export default Placeholder;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export declare type PromptItem = {
|
|
3
2
|
title: string;
|
|
4
3
|
placeholder?: string;
|
|
@@ -14,5 +13,5 @@ declare type Props = {
|
|
|
14
13
|
onDismiss?: () => void;
|
|
15
14
|
autoFocus?: boolean;
|
|
16
15
|
} & PromptItem;
|
|
17
|
-
declare const Prompt:
|
|
16
|
+
declare const Prompt: ({ onDismiss, visible, onHide, autoFocus, title, defaultValue, placeholder, onSubmit, onCancel, submitLabel, cancelLabel, }: Props) => JSX.Element;
|
|
18
17
|
export default Prompt;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
declare type SwitchProps = React.PropsWithChildren<{
|
|
3
3
|
trackColor?: string;
|
|
4
4
|
thumbColor?: string;
|
|
5
5
|
inactiveThumbColor?: string;
|
|
6
6
|
inactiveTrackColor?: string;
|
|
7
7
|
value: boolean;
|
|
8
8
|
onChangeValue: (val: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
declare const Switch:
|
|
9
|
+
}>;
|
|
10
|
+
declare const Switch: ({ value, onChangeValue, inactiveThumbColor, inactiveTrackColor, trackColor, thumbColor, }: SwitchProps) => JSX.Element;
|
|
11
11
|
export default Switch;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { TextProps as RNTextProps } from 'react-native';
|
|
3
2
|
import type { TypoName, UIKitTheme } from '../../types';
|
|
4
3
|
declare type TypographyProps = Partial<Record<TypoName, boolean>>;
|
|
5
4
|
export declare type TextProps = RNTextProps & TypographyProps & {
|
|
6
5
|
color?: ((colors: UIKitTheme['colors']) => string) | string;
|
|
7
6
|
};
|
|
8
|
-
declare const Text:
|
|
7
|
+
declare const Text: ({ children, color, style, ...props }: TextProps) => JSX.Element;
|
|
9
8
|
export default Text;
|
|
@@ -3,16 +3,16 @@ declare type ToastType = 'normal' | 'error' | 'success';
|
|
|
3
3
|
declare type Context = {
|
|
4
4
|
show(text: string, type?: ToastType): void;
|
|
5
5
|
};
|
|
6
|
-
declare type Props = {
|
|
6
|
+
declare type Props = React.PropsWithChildren<{
|
|
7
7
|
top?: number;
|
|
8
8
|
bottom?: number;
|
|
9
9
|
visible: boolean;
|
|
10
10
|
type: ToastType;
|
|
11
11
|
children: string;
|
|
12
|
-
};
|
|
13
|
-
declare const Toast: React.FC<Props>;
|
|
14
|
-
export declare const ToastProvider: React.FC<{
|
|
15
|
-
dismissTimeout?: number;
|
|
16
12
|
}>;
|
|
13
|
+
declare const Toast: ({ visible, type, children, top, bottom }: Props) => JSX.Element;
|
|
14
|
+
export declare const ToastProvider: ({ children, dismissTimeout, }: React.PropsWithChildren<{
|
|
15
|
+
dismissTimeout?: number | undefined;
|
|
16
|
+
}>) => JSX.Element;
|
|
17
17
|
export declare const useToast: () => Context;
|
|
18
18
|
export default Toast;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { TextProps } from '../Text';
|
|
3
2
|
declare type OnPressUrl = (url: string, httpProtocol: boolean) => void;
|
|
4
3
|
declare type Props = TextProps & {
|
|
5
4
|
onPressUrl?: OnPressUrl;
|
|
6
5
|
strict?: boolean;
|
|
7
6
|
};
|
|
8
|
-
declare const URLParsedText:
|
|
7
|
+
declare const URLParsedText: ({ children, onPressUrl, strict, ...props }: Props) => JSX.Element;
|
|
9
8
|
export default URLParsedText;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sendbird/uikit-react-native-foundation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "react-native-uikit",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@sendbird/uikit-utils": "1.
|
|
41
|
+
"@sendbird/uikit-utils": "1.1.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@types/react": "
|
|
45
|
-
"@types/react-native": "
|
|
44
|
+
"@types/react": "*",
|
|
45
|
+
"@types/react-native": "*",
|
|
46
46
|
"react": "17.0.2",
|
|
47
47
|
"react-native": "0.66.4",
|
|
48
48
|
"react-native-builder-bob": "^0.18.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"readmeFile": "./README.md",
|
|
81
81
|
"displayName": "@sendbird/uikit-react-native-foundation"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "787ef6d52fec5d01e9b831d7a6f17e33614e2d09"
|
|
84
84
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
1
|
import type { ImageProps as NativeImageProps } from 'react-native';
|
|
3
2
|
import { NativeModules } from 'react-native';
|
|
4
3
|
|
|
@@ -8,7 +7,7 @@ export interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'o
|
|
|
8
7
|
tintColor?: string;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
|
-
export type SendbirdImageComponent =
|
|
10
|
+
export type SendbirdImageComponent = (props: SendbirdImageProps) => JSX.Element;
|
|
12
11
|
|
|
13
12
|
function getImageModule(): SendbirdImageComponent {
|
|
14
13
|
const hasFastImage = Boolean(NativeModules.FastImageView);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StatusBar } from 'react-native';
|
|
2
|
+
import { StatusBar, useWindowDimensions } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
5
5
|
import type { BaseHeaderProps, HeaderElement } from '../types';
|
|
6
|
+
import getDefaultHeaderHeight from './getDefaultHeaderHeight';
|
|
6
7
|
|
|
7
8
|
export type HeaderStyleContextType = {
|
|
8
9
|
HeaderComponent: (
|
|
@@ -20,22 +21,25 @@ export type HeaderStyleContextType = {
|
|
|
20
21
|
defaultTitleAlign: 'left' | 'center';
|
|
21
22
|
statusBarTranslucent: boolean;
|
|
22
23
|
topInset: number;
|
|
24
|
+
defaultHeight: number;
|
|
23
25
|
};
|
|
24
26
|
export const HeaderStyleContext = React.createContext<HeaderStyleContextType>({
|
|
25
27
|
HeaderComponent: () => null,
|
|
26
28
|
defaultTitleAlign: 'left',
|
|
27
29
|
statusBarTranslucent: true,
|
|
28
30
|
topInset: StatusBar.currentHeight ?? 0,
|
|
31
|
+
defaultHeight: getDefaultHeaderHeight(false),
|
|
29
32
|
});
|
|
30
33
|
|
|
31
34
|
type Props = Pick<HeaderStyleContextType, 'statusBarTranslucent' | 'defaultTitleAlign' | 'HeaderComponent'>;
|
|
32
|
-
export const HeaderStyleProvider
|
|
35
|
+
export const HeaderStyleProvider = ({
|
|
33
36
|
children,
|
|
34
37
|
HeaderComponent = () => null,
|
|
35
38
|
defaultTitleAlign,
|
|
36
39
|
statusBarTranslucent,
|
|
37
|
-
}) => {
|
|
40
|
+
}: React.PropsWithChildren<Props>) => {
|
|
38
41
|
const { top } = useSafeAreaInsets();
|
|
42
|
+
const { width, height } = useWindowDimensions();
|
|
39
43
|
|
|
40
44
|
return (
|
|
41
45
|
<HeaderStyleContext.Provider
|
|
@@ -44,6 +48,7 @@ export const HeaderStyleProvider: React.FC<Props> = ({
|
|
|
44
48
|
defaultTitleAlign,
|
|
45
49
|
statusBarTranslucent,
|
|
46
50
|
topInset: statusBarTranslucent ? top : 0,
|
|
51
|
+
defaultHeight: getDefaultHeaderHeight(width > height),
|
|
47
52
|
}}
|
|
48
53
|
>
|
|
49
54
|
{children}
|
|
@@ -6,7 +6,8 @@ const DESIGNED_DEVICE_WIDTH = 360;
|
|
|
6
6
|
|
|
7
7
|
const createScaleFactor = (deviceWidth = DESIGNED_DEVICE_WIDTH) => {
|
|
8
8
|
const ratio = Math.min(width, height) / deviceWidth;
|
|
9
|
-
|
|
9
|
+
const rangedRatio = Math.min(Math.max(0.85, ratio), 1.25);
|
|
10
|
+
return (dp: number) => PixelRatio.roundToNearestPixel(dp * rangedRatio);
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
createScaleFactor.updateScaleFactor = (scaleFactor: (dp: number) => number) => {
|
|
@@ -4,8 +4,10 @@ import type { UIKitTheme } from '../types';
|
|
|
4
4
|
import LightUIKitTheme from './LightUIKitTheme';
|
|
5
5
|
import UIKitThemeContext from './UIKitThemeContext';
|
|
6
6
|
|
|
7
|
-
type Props = {
|
|
8
|
-
|
|
7
|
+
type Props = React.PropsWithChildren<{
|
|
8
|
+
theme?: UIKitTheme;
|
|
9
|
+
}>;
|
|
10
|
+
const UIKitThemeProvider = ({ children, theme = LightUIKitTheme }: Props) => {
|
|
9
11
|
return <UIKitThemeContext.Provider value={theme}>{children}</UIKitThemeContext.Provider>;
|
|
10
12
|
};
|
|
11
13
|
|
|
@@ -26,7 +26,7 @@ type Props = {
|
|
|
26
26
|
onError?: (error: unknown) => void;
|
|
27
27
|
onDismiss?: () => void;
|
|
28
28
|
} & ActionMenuItem;
|
|
29
|
-
const ActionMenu
|
|
29
|
+
const ActionMenu = ({ visible, onHide, onError, onDismiss, title, menuItems }: Props) => {
|
|
30
30
|
const { statusBarTranslucent } = useHeaderStyle();
|
|
31
31
|
const { colors } = useUIKitTheme();
|
|
32
32
|
const [pending, setPending] = useState(false);
|
package/src/ui/Alert/index.tsx
CHANGED
|
@@ -20,14 +20,7 @@ type Props = {
|
|
|
20
20
|
onHide: () => void;
|
|
21
21
|
onDismiss?: () => void;
|
|
22
22
|
} & AlertItem;
|
|
23
|
-
const Alert:
|
|
24
|
-
onDismiss,
|
|
25
|
-
visible,
|
|
26
|
-
onHide,
|
|
27
|
-
title = '',
|
|
28
|
-
message = '',
|
|
29
|
-
buttons = [{ text: 'OK' }],
|
|
30
|
-
}) => {
|
|
23
|
+
const Alert = ({ onDismiss, visible, onHide, title = '', message = '', buttons = [{ text: 'OK' }] }: Props) => {
|
|
31
24
|
const { statusBarTranslucent } = useHeaderStyle();
|
|
32
25
|
const { colors } = useUIKitTheme();
|
|
33
26
|
|
|
@@ -3,8 +3,11 @@ import { StyleProp, View, ViewStyle } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
const MAX = 4;
|
|
5
5
|
|
|
6
|
-
type Props = {
|
|
7
|
-
|
|
6
|
+
type Props = React.PropsWithChildren<{
|
|
7
|
+
size?: number;
|
|
8
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
9
|
+
}>;
|
|
10
|
+
const AvatarGroup = ({ children, containerStyle, size = 56 }: Props) => {
|
|
8
11
|
const childAmount = React.Children.count(children);
|
|
9
12
|
|
|
10
13
|
if (childAmount === 0) {
|
|
@@ -11,7 +11,7 @@ type Props = {
|
|
|
11
11
|
backgroundColor?: string;
|
|
12
12
|
containerStyle?: StyleProp<ViewStyle>;
|
|
13
13
|
};
|
|
14
|
-
const AvatarIcon
|
|
14
|
+
const AvatarIcon = ({ size = 56, icon, containerStyle, backgroundColor }: Props) => {
|
|
15
15
|
const { colors, palette } = useUIKitTheme();
|
|
16
16
|
return (
|
|
17
17
|
<View
|
package/src/ui/Avatar/index.tsx
CHANGED
|
@@ -10,7 +10,10 @@ import Icon from '../Icon';
|
|
|
10
10
|
import AvatarGroup from './AvatarGroup';
|
|
11
11
|
import AvatarIcon from './AvatarIcon';
|
|
12
12
|
|
|
13
|
-
type SubComponents = {
|
|
13
|
+
type SubComponents = {
|
|
14
|
+
Group: typeof AvatarGroup;
|
|
15
|
+
Icon: typeof AvatarIcon;
|
|
16
|
+
};
|
|
14
17
|
type Props = {
|
|
15
18
|
uri?: string;
|
|
16
19
|
size?: number;
|
|
@@ -18,7 +21,13 @@ type Props = {
|
|
|
18
21
|
muted?: boolean;
|
|
19
22
|
containerStyle?: StyleProp<ViewStyle>;
|
|
20
23
|
};
|
|
21
|
-
const Avatar:
|
|
24
|
+
const Avatar: ((props: Props) => JSX.Element) & SubComponents = ({
|
|
25
|
+
uri,
|
|
26
|
+
square,
|
|
27
|
+
muted = false,
|
|
28
|
+
size = 56,
|
|
29
|
+
containerStyle,
|
|
30
|
+
}) => {
|
|
22
31
|
const { colors, palette } = useUIKitTheme();
|
|
23
32
|
const [loadFailure, setLoadFailure] = useState(false);
|
|
24
33
|
|
|
@@ -47,7 +56,7 @@ const Avatar: React.FC<Props> & SubComponents = ({ uri, square, muted = false, s
|
|
|
47
56
|
);
|
|
48
57
|
};
|
|
49
58
|
|
|
50
|
-
const MutedOverlay
|
|
59
|
+
const MutedOverlay = ({ size }: { size: number }) => {
|
|
51
60
|
const { palette } = useUIKitTheme();
|
|
52
61
|
return (
|
|
53
62
|
<View style={[styles.container, StyleSheet.absoluteFill]}>
|
package/src/ui/Badge/index.tsx
CHANGED
|
@@ -16,7 +16,7 @@ type Props = {
|
|
|
16
16
|
size?: 'small' | 'default';
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const Badge
|
|
19
|
+
const Badge = ({ count, maxCount, badgeColor, textColor, style, size = 'default' }: Props) => {
|
|
20
20
|
const { colors } = useUIKitTheme();
|
|
21
21
|
const isSmall = size === 'small';
|
|
22
22
|
return (
|
|
@@ -22,7 +22,7 @@ type Props = {
|
|
|
22
22
|
onError?: (error: unknown) => void;
|
|
23
23
|
onDismiss?: () => void;
|
|
24
24
|
} & BottomSheetItem;
|
|
25
|
-
const BottomSheet
|
|
25
|
+
const BottomSheet = ({ onDismiss, onHide, visible, sheetItems }: Props) => {
|
|
26
26
|
const { statusBarTranslucent } = useHeaderStyle();
|
|
27
27
|
const { width } = useWindowDimensions();
|
|
28
28
|
const { bottom, left, right } = useSafeAreaInsets();
|
package/src/ui/Button/index.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
|
6
6
|
import Icon from '../Icon';
|
|
7
7
|
import Text from '../Text';
|
|
8
8
|
|
|
9
|
-
type Props = {
|
|
9
|
+
type Props = React.PropsWithChildren<{
|
|
10
10
|
style?: StyleProp<ViewStyle>;
|
|
11
11
|
icon?: keyof typeof Icon.Assets;
|
|
12
12
|
variant?: 'contained' | 'text';
|
|
@@ -14,8 +14,8 @@ type Props = {
|
|
|
14
14
|
onPress?: () => void;
|
|
15
15
|
buttonColor?: string;
|
|
16
16
|
contentColor?: string;
|
|
17
|
-
}
|
|
18
|
-
const Button
|
|
17
|
+
}>;
|
|
18
|
+
const Button = ({
|
|
19
19
|
icon,
|
|
20
20
|
variant = 'contained',
|
|
21
21
|
buttonColor,
|
|
@@ -24,7 +24,7 @@ const Button: React.FC<Props> = ({
|
|
|
24
24
|
onPress,
|
|
25
25
|
style,
|
|
26
26
|
children,
|
|
27
|
-
}) => {
|
|
27
|
+
}: Props) => {
|
|
28
28
|
const { colors } = useUIKitTheme();
|
|
29
29
|
|
|
30
30
|
const getStateColor = (pressed: boolean, disabled?: boolean) => {
|
|
@@ -12,7 +12,7 @@ type Props = {
|
|
|
12
12
|
backgroundColor?: string;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const ChannelFrozenBanner
|
|
15
|
+
const ChannelFrozenBanner = ({ text = 'Channel is frozen', backgroundColor, textColor, style }: Props) => {
|
|
16
16
|
const { palette } = useUIKitTheme();
|
|
17
17
|
|
|
18
18
|
return (
|
|
@@ -4,10 +4,10 @@ import { StyleProp, View, ViewStyle } from 'react-native';
|
|
|
4
4
|
import createStyleSheet from '../../styles/createStyleSheet';
|
|
5
5
|
import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
6
6
|
|
|
7
|
-
type Props = {
|
|
7
|
+
type Props = React.PropsWithChildren<{
|
|
8
8
|
style?: StyleProp<ViewStyle>;
|
|
9
|
-
}
|
|
10
|
-
const DialogBox
|
|
9
|
+
}>;
|
|
10
|
+
const DialogBox = ({ style, children }: Props) => {
|
|
11
11
|
const { colors } = useUIKitTheme();
|
|
12
12
|
return (
|
|
13
13
|
<View style={[styles.container, { backgroundColor: colors.ui.dialog.default.none.background }, style]}>
|
|
@@ -6,10 +6,10 @@ import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
|
6
6
|
import Icon from '../Icon';
|
|
7
7
|
import Text from '../Text';
|
|
8
8
|
|
|
9
|
-
type Props = {
|
|
9
|
+
type Props = React.PropsWithChildren<{
|
|
10
10
|
style?: StyleProp<ViewStyle>;
|
|
11
|
-
}
|
|
12
|
-
const DialogSheet:
|
|
11
|
+
}>;
|
|
12
|
+
const DialogSheet: ((props: Props) => JSX.Element) & { Item: typeof SheetItem } = ({ style, children }) => {
|
|
13
13
|
const { colors } = useUIKitTheme();
|
|
14
14
|
return (
|
|
15
15
|
<View style={[styles.container, { backgroundColor: colors.ui.dialog.default.none.background }, style]}>
|
|
@@ -24,7 +24,7 @@ export type SheetItemProps = {
|
|
|
24
24
|
title: string;
|
|
25
25
|
titleColor?: string;
|
|
26
26
|
};
|
|
27
|
-
const SheetItem
|
|
27
|
+
const SheetItem = ({ icon, title, iconColor, titleColor }: SheetItemProps) => {
|
|
28
28
|
const { colors } = useUIKitTheme();
|
|
29
29
|
return (
|
|
30
30
|
<View style={[styles.sheetItemContainer, { backgroundColor: colors.ui.dialog.default.none.background }]}>
|
package/src/ui/Dialog/index.tsx
CHANGED
|
@@ -45,14 +45,14 @@ const ActionMenuContext = React.createContext<Pick<DialogContextType, 'openMenu'
|
|
|
45
45
|
const PromptContext = React.createContext<Pick<DialogContextType, 'openPrompt'> | null>(null);
|
|
46
46
|
const BottomSheetContext = React.createContext<Pick<DialogContextType, 'openSheet'> | null>(null);
|
|
47
47
|
|
|
48
|
-
type Props = {
|
|
48
|
+
type Props = React.PropsWithChildren<{
|
|
49
49
|
defaultLabels?: {
|
|
50
50
|
alert?: { ok?: string };
|
|
51
51
|
prompt?: { placeholder?: string; ok?: string; cancel?: string };
|
|
52
52
|
};
|
|
53
|
-
}
|
|
53
|
+
}>;
|
|
54
54
|
const DISMISS_TIMEOUT = 3000;
|
|
55
|
-
export const DialogProvider
|
|
55
|
+
export const DialogProvider = ({ defaultLabels, children }: Props) => {
|
|
56
56
|
const waitDismissTimeout = useRef<NodeJS.Timeout>();
|
|
57
57
|
const waitDismissPromise = useRef<() => void>();
|
|
58
58
|
const waitDismiss = useCallback((resolver: () => void) => {
|
package/src/ui/Divider/index.tsx
CHANGED
|
@@ -9,7 +9,7 @@ type Props = {
|
|
|
9
9
|
space?: number;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const Divider
|
|
12
|
+
const Divider = ({ style, space }: Props) => {
|
|
13
13
|
const { colors } = useUIKitTheme();
|
|
14
14
|
return (
|
|
15
15
|
<View style={[style, styles.divider, { paddingHorizontal: space }]}>
|
|
@@ -15,7 +15,10 @@ type Props = {
|
|
|
15
15
|
coverUrl: string;
|
|
16
16
|
|
|
17
17
|
title: string;
|
|
18
|
+
|
|
18
19
|
titleCaption: string;
|
|
20
|
+
titleCaptionLeft?: React.ReactElement;
|
|
21
|
+
|
|
19
22
|
bodyIcon?: keyof typeof Icon.Assets;
|
|
20
23
|
body: string;
|
|
21
24
|
|
|
@@ -27,7 +30,7 @@ type Props = {
|
|
|
27
30
|
notificationOff?: boolean;
|
|
28
31
|
};
|
|
29
32
|
|
|
30
|
-
const GroupChannelPreview
|
|
33
|
+
const GroupChannelPreview = ({
|
|
31
34
|
customCover,
|
|
32
35
|
coverUrl,
|
|
33
36
|
memberCount,
|
|
@@ -37,9 +40,10 @@ const GroupChannelPreview: React.FC<Props> = ({
|
|
|
37
40
|
bodyIcon,
|
|
38
41
|
title,
|
|
39
42
|
titleCaption,
|
|
43
|
+
titleCaptionLeft,
|
|
40
44
|
frozen,
|
|
41
45
|
notificationOff,
|
|
42
|
-
}) => {
|
|
46
|
+
}: Props) => {
|
|
43
47
|
const { colors } = useUIKitTheme();
|
|
44
48
|
const color = colors.ui.groupChannelPreview;
|
|
45
49
|
|
|
@@ -60,7 +64,7 @@ const GroupChannelPreview: React.FC<Props> = ({
|
|
|
60
64
|
</View>
|
|
61
65
|
<View style={styles.rightSection}>
|
|
62
66
|
<View style={styles.rightTopSection}>
|
|
63
|
-
<View style={styles.
|
|
67
|
+
<View style={styles.channelInfoContainer}>
|
|
64
68
|
<Text numberOfLines={1} subtitle1 style={styles.channelInfoTitle} color={color.default.none.textTitle}>
|
|
65
69
|
{title}
|
|
66
70
|
</Text>
|
|
@@ -74,8 +78,9 @@ const GroupChannelPreview: React.FC<Props> = ({
|
|
|
74
78
|
)}
|
|
75
79
|
{notificationOff && <Icon size={16} icon={'notifications-off-filled'} color={colors.onBackground03} />}
|
|
76
80
|
</View>
|
|
77
|
-
<View style={styles.
|
|
78
|
-
|
|
81
|
+
<View style={styles.titleCaptionContainer}>
|
|
82
|
+
{titleCaptionLeft}
|
|
83
|
+
<Text caption2 color={color.default.none.textTitleCaption} style={styles.titleCaptionText}>
|
|
79
84
|
{titleCaption}
|
|
80
85
|
</Text>
|
|
81
86
|
</View>
|
|
@@ -132,7 +137,7 @@ const styles = createStyleSheet({
|
|
|
132
137
|
flexDirection: 'row',
|
|
133
138
|
marginBottom: 4,
|
|
134
139
|
},
|
|
135
|
-
|
|
140
|
+
channelInfoContainer: {
|
|
136
141
|
flex: 1,
|
|
137
142
|
marginRight: 4,
|
|
138
143
|
alignItems: 'center',
|
|
@@ -149,9 +154,13 @@ const styles = createStyleSheet({
|
|
|
149
154
|
channelInfoFrozen: {
|
|
150
155
|
marginRight: 4,
|
|
151
156
|
},
|
|
152
|
-
|
|
157
|
+
titleCaptionContainer: {
|
|
158
|
+
alignItems: 'flex-start',
|
|
159
|
+
flexDirection: 'row',
|
|
153
160
|
marginLeft: 4,
|
|
154
|
-
|
|
161
|
+
},
|
|
162
|
+
titleCaptionText: {
|
|
163
|
+
marginTop: 2,
|
|
155
164
|
},
|
|
156
165
|
rightBottomSection: {
|
|
157
166
|
flex: 1,
|
|
@@ -190,4 +199,4 @@ const styles = createStyleSheet({
|
|
|
190
199
|
},
|
|
191
200
|
});
|
|
192
201
|
|
|
193
|
-
export default
|
|
202
|
+
export default GroupChannelPreview;
|
package/src/ui/Header/index.tsx
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacity, TouchableOpacityProps, View
|
|
2
|
+
import { TouchableOpacity, TouchableOpacityProps, View } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
|
|
5
5
|
import { conditionChaining } from '@sendbird/uikit-utils';
|
|
6
6
|
|
|
7
7
|
import type { BaseHeaderProps } from '../../index';
|
|
8
8
|
import createStyleSheet from '../../styles/createStyleSheet';
|
|
9
|
-
import getDefaultHeaderHeight from '../../styles/getDefaultHeaderHeight';
|
|
10
9
|
import useHeaderStyle from '../../styles/useHeaderStyle';
|
|
11
10
|
import useUIKitTheme from '../../theme/useUIKitTheme';
|
|
12
11
|
import Text, { TextProps } from '../Text';
|
|
@@ -24,7 +23,7 @@ type HeaderProps = BaseHeaderProps<
|
|
|
24
23
|
>;
|
|
25
24
|
|
|
26
25
|
const AlignMapper = { left: 'flex-start', center: 'center', right: 'flex-end' } as const;
|
|
27
|
-
const Header:
|
|
26
|
+
const Header: ((props: HeaderProps) => JSX.Element) & {
|
|
28
27
|
Button: typeof HeaderButton;
|
|
29
28
|
Title: typeof HeaderTitle;
|
|
30
29
|
Subtitle: typeof HeaderSubtitle;
|
|
@@ -38,8 +37,7 @@ const Header: React.FC<HeaderProps> & {
|
|
|
38
37
|
onPressRight,
|
|
39
38
|
clearTitleMargin = false,
|
|
40
39
|
}) => {
|
|
41
|
-
const { topInset, defaultTitleAlign } = useHeaderStyle();
|
|
42
|
-
const { width, height } = useWindowDimensions();
|
|
40
|
+
const { topInset, defaultTitleAlign, defaultHeight } = useHeaderStyle();
|
|
43
41
|
const { colors } = useUIKitTheme();
|
|
44
42
|
const { left: paddingLeft, right: paddingRight } = useSafeAreaInsets();
|
|
45
43
|
|
|
@@ -64,7 +62,7 @@ const Header: React.FC<HeaderProps> & {
|
|
|
64
62
|
},
|
|
65
63
|
]}
|
|
66
64
|
>
|
|
67
|
-
<View style={[styles.header, { height:
|
|
65
|
+
<View style={[styles.header, { height: defaultHeight }]}>
|
|
68
66
|
<LeftSide titleAlign={actualTitleAlign} left={left} onPressLeft={onPressLeft} />
|
|
69
67
|
<View
|
|
70
68
|
style={[
|
|
@@ -82,7 +80,7 @@ const Header: React.FC<HeaderProps> & {
|
|
|
82
80
|
);
|
|
83
81
|
};
|
|
84
82
|
|
|
85
|
-
const LeftSide
|
|
83
|
+
const LeftSide = ({ titleAlign, onPressLeft, left }: HeaderProps) => {
|
|
86
84
|
if (titleAlign === 'center') {
|
|
87
85
|
return <View style={styles.left}>{left && <HeaderButton onPress={onPressLeft}>{left}</HeaderButton>}</View>;
|
|
88
86
|
}
|
|
@@ -94,7 +92,7 @@ const LeftSide: React.FC<HeaderProps> = ({ titleAlign, onPressLeft, left }) => {
|
|
|
94
92
|
);
|
|
95
93
|
};
|
|
96
94
|
|
|
97
|
-
const RightSide
|
|
95
|
+
const RightSide = ({ titleAlign, onPressRight, right }: HeaderProps) => {
|
|
98
96
|
if (titleAlign === 'center') {
|
|
99
97
|
return <View style={styles.right}>{right && <HeaderButton onPress={onPressRight}>{right}</HeaderButton>}</View>;
|
|
100
98
|
}
|
|
@@ -106,14 +104,14 @@ const RightSide: React.FC<HeaderProps> = ({ titleAlign, onPressRight, right }) =
|
|
|
106
104
|
);
|
|
107
105
|
};
|
|
108
106
|
|
|
109
|
-
const HeaderTitle
|
|
107
|
+
const HeaderTitle = ({ children, style, ...props }: TextProps) => {
|
|
110
108
|
return (
|
|
111
109
|
<Text {...props} h1 numberOfLines={1} style={style}>
|
|
112
110
|
{children}
|
|
113
111
|
</Text>
|
|
114
112
|
);
|
|
115
113
|
};
|
|
116
|
-
const HeaderSubtitle
|
|
114
|
+
const HeaderSubtitle = ({ children, style, ...props }: TextProps) => {
|
|
117
115
|
const { colors } = useUIKitTheme();
|
|
118
116
|
return (
|
|
119
117
|
<Text color={colors.onBackground03} {...props} caption2 numberOfLines={1} style={style}>
|
|
@@ -121,13 +119,7 @@ const HeaderSubtitle: React.FC<{ children: string } & TextProps> = ({ children,
|
|
|
121
119
|
</Text>
|
|
122
120
|
);
|
|
123
121
|
};
|
|
124
|
-
const HeaderButton:
|
|
125
|
-
children,
|
|
126
|
-
disabled,
|
|
127
|
-
onPress,
|
|
128
|
-
color,
|
|
129
|
-
...props
|
|
130
|
-
}) => {
|
|
122
|
+
const HeaderButton = ({ children, disabled, onPress, color, ...props }: TouchableOpacityProps & { color?: string }) => {
|
|
131
123
|
return (
|
|
132
124
|
<TouchableOpacity
|
|
133
125
|
style={styles.button}
|
package/src/ui/Icon/index.tsx
CHANGED
|
@@ -15,8 +15,13 @@ type Props = {
|
|
|
15
15
|
style?: StyleProp<ImageStyle>;
|
|
16
16
|
containerStyle?: StyleProp<ViewStyle>;
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const Icon: ((props: Props) => JSX.Element) & { Assets: typeof IconAssets } = ({
|
|
19
|
+
icon,
|
|
20
|
+
color,
|
|
21
|
+
size = 24,
|
|
22
|
+
containerStyle,
|
|
23
|
+
style,
|
|
24
|
+
}) => {
|
|
20
25
|
const sizeStyle = sizeStyles[size as SizeFactor] ?? { width: size, height: size };
|
|
21
26
|
const { colors } = useUIKitTheme();
|
|
22
27
|
return (
|
|
@@ -10,7 +10,7 @@ type Props = {
|
|
|
10
10
|
style?: StyleProp<ViewStyle>;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const LoadingSpinner
|
|
13
|
+
const LoadingSpinner = ({ size = 24, color, style }: Props) => {
|
|
14
14
|
const { colors } = useUIKitTheme();
|
|
15
15
|
return (
|
|
16
16
|
<Rotate style={style}>
|
|
@@ -37,7 +37,7 @@ const useLoopAnimated = (duration: number, useNativeDriver = true) => {
|
|
|
37
37
|
return animated;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const Rotate: React.
|
|
40
|
+
const Rotate = ({ children, style }: React.PropsWithChildren<{ style: StyleProp<ViewStyle> }>) => {
|
|
41
41
|
const loop = useLoopAnimated(1000);
|
|
42
42
|
const rotate = loop.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'] });
|
|
43
43
|
return <Animated.View style={[style, { transform: [{ rotate }] }]}>{children}</Animated.View>;
|