Skip to content

Commit

Permalink
Merge pull request #142 from sendbird/feat/update-deps
Browse files Browse the repository at this point in the history
chore: update package dependencies
  • Loading branch information
bang9 authored Nov 2, 2023
2 parents 9c0a3f5 + 93a095c commit 0c49d69
Show file tree
Hide file tree
Showing 36 changed files with 423 additions and 312 deletions.
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"trailingComma": "all",
"bracketSpacing": true,
"arrowParens": "always",
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": ["<THIRD_PARTY_MODULES>", "@sendbird[./]?", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { MediaServiceInterface } from '@sendbird/uikit-react-native';
import type { ReactNode } from 'react';

const isMediaFile = (_: string) => 0;
const MyDocumentPickerModule = {
Expand Down Expand Up @@ -34,7 +35,7 @@ async function fileServiceInterface(service: FileServiceInterface) {
* {@link }
* */
async function mediaServiceInterface(service: MediaServiceInterface) {
const jsx: JSX.Element = service.VideoComponent({
const jsx: ReactNode = service.VideoComponent({
source: 0 as number | { uri: string },
resizeMode: '' as 'cover' | 'stretch' | 'contain' | undefined,
onLoad: () => 0,
Expand Down
5 changes: 2 additions & 3 deletions docs-validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"@types/jest": "^26.0.23",
"@types/react": "^18.0.15",
"@types/react": "*",
"@types/react-native": "*",
"@types/react-test-renderer": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"babel-jest": "^26.6.3",
Expand All @@ -44,6 +43,6 @@
"react-dom": "17.0.2",
"react-native-monorepo-tools": "^1.1.4",
"react-test-renderer": "17.0.2",
"typescript": "4.9.4"
"typescript": "5.2.2"
}
}
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,31 @@
},
"devDependencies": {
"@testing-library/react-native": "11",
"@trivago/prettier-plugin-sort-imports": "^3.4.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.1",
"@types/jest": "^29.4.0",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"babel-jest": "^29.4.3",
"chalk": "^4",
"concurrently": "^8.0.1",
"conventional-changelog-conventionalcommits": "^5.0.0",
"del-cli": "^4.0.1",
"eslint": "^8.6.0",
"eslint-config-prettier": "^8.5.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.4.3",
"lerna": "^5.1.6",
"node-fetch": "2.x",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"react": "17.0.2",
"react-native": "0.67.5",
"react-native-builder-bob": "^0.18.2",
"react-native-fast-image": "^8.5.11",
"react-native-safe-area-context": "^3.3.2",
"react-test-renderer": "^17.0.2",
"typedoc": "^0.23.7",
"typescript": "4.9.4"
"typedoc": "^0.25.3",
"typescript": "5.2.2"
},
"jest": {
"preset": "react-native",
Expand Down Expand Up @@ -96,6 +96,8 @@
]
},
"resolutions": {
"@sendbird/chat": "4.9.8"
"@sendbird/chat": "4.9.8",
"@types/react": "^18",
"@types/react-native": "^0.67"
}
}
2 changes: 1 addition & 1 deletion packages/uikit-chat-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@types/react": "*",
"react": "17.0.2",
"react-native-builder-bob": "^0.18.0",
"typescript": "4.9.4"
"typescript": "5.2.2"
},
"peerDependencies": {
"@sendbird/chat": "^4.9.8",
Expand Down
2 changes: 1 addition & 1 deletion packages/uikit-react-native-foundation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"react-native-builder-bob": "^0.18.0",
"react-native-fast-image": "^8.5.11",
"react-native-safe-area-context": "^3.3.2",
"typescript": "4.9.4"
"typescript": "5.2.2"
},
"peerDependencies": {
"react": ">=17.0.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode } from 'react';
import { Image, ImageStyle, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';

import { FileType, convertFileTypeToMessageType, getFileIconFromMessageType } from '@sendbird/uikit-utils';
Expand All @@ -17,7 +17,7 @@ type Props = {
style?: StyleProp<ImageStyle>;
containerStyle?: StyleProp<ViewStyle>;
};
const Icon: ((props: Props) => JSX.Element) & {
const Icon: ((props: Props) => ReactNode) & {
Assets: typeof IconAssets;
File: typeof FileIcon;
} = ({ icon, color, size = 24, containerStyle, style }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { ReactNode } from 'react';
import type { FastImageProps } from 'react-native-fast-image';

let FastImageInternal: (props: FastImageProps) => JSX.Element | null = () => null;
let FastImageInternal: (props: FastImageProps) => ReactNode | null = () => null;

try {
FastImageInternal = require('react-native-fast-image') as (props: FastImageProps) => JSX.Element;
FastImageInternal = require('react-native-fast-image') as (props: FastImageProps) => ReactNode;
} catch {}

export default FastImageInternal;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ReactNode } from 'react';
import type { ImageProps as NativeImageProps } from 'react-native';
import { NativeModules } from 'react-native';

Expand All @@ -7,7 +8,7 @@ export interface SendbirdImageProps extends Omit<NativeImageProps, 'onLoad' | 'o
tintColor?: string;
}

export type SendbirdImageComponent = (props: SendbirdImageProps) => JSX.Element;
export type SendbirdImageComponent = (props: SendbirdImageProps) => ReactNode;

function getImageModule(): SendbirdImageComponent {
const hasFastImage = Boolean(NativeModules.FastImageView);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode } from 'react';

import { replaceWithRegex } from '@sendbird/uikit-utils';

Expand All @@ -12,15 +12,15 @@ export interface RegexTextPattern {
index: number;
keyPrefix: string;
parentProps?: TextProps;
}): string | JSX.Element;
}): string | ReactNode;
}

type Props = { patterns: RegexTextPattern[] } & TextProps;

const RegexText = ({ children, patterns, ...props }: Props) => {
if (patterns.length === 0 || typeof children !== 'string') return <>{children}</>;

const matchedTexts: Array<string | JSX.Element> = [children];
const matchedTexts: Array<string | ReactNode> = [children];

patterns.forEach(({ regex, replacer }, patterIndex) => {
const matchedTextsTemp = matchedTexts.concat();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { HeaderProps } from '../ui/Header';
import getDefaultHeaderHeight from './getDefaultHeaderHeight';

export type HeaderStyleContextType = {
HeaderComponent: (props: HeaderProps) => React.ReactElement | null;
HeaderComponent: (props: HeaderProps) => React.ReactNode | null;
defaultTitleAlign: 'left' | 'center';
statusBarTranslucent: boolean;
topInset: number;
Expand Down
10 changes: 5 additions & 5 deletions packages/uikit-react-native-foundation/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import type { ReactElement, ReactNode } from 'react';
import type { ReactNode } from 'react';
import type { TextStyle } from 'react-native';

export interface UIKitTypography {
Expand Down Expand Up @@ -178,11 +178,11 @@ export interface UIKitColors {
};
}

export type HeaderElement = string | ReactElement | null;
export type HeaderElement = ReactNode;
export type HeaderPartProps = {
title?: HeaderElement;
right?: HeaderElement;
left?: HeaderElement;
title?: ReactNode;
right?: ReactNode;
left?: ReactNode;
onPressLeft?: (...params: any[]) => any;
onPressRight?: (...params: any[]) => any;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { ReactNode, useState } from 'react';
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';

import { conditionChaining } from '@sendbird/uikit-utils';
Expand All @@ -21,7 +21,7 @@ type Props = {
muted?: boolean;
containerStyle?: StyleProp<ViewStyle>;
};
const Avatar: ((props: Props) => JSX.Element) & SubComponents = ({
const Avatar: ((props: Props) => ReactNode) & SubComponents = ({
uri,
square,
muted = false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode } from 'react';
import { TouchableOpacity, useWindowDimensions } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

Expand All @@ -17,7 +17,7 @@ export type BottomSheetItem = {
disabled?: boolean;
onPress: () => void;
}[];
HeaderComponent?: (props: HeaderProps) => JSX.Element;
HeaderComponent?: (props: HeaderProps) => ReactNode;
};
type Props = {
visible: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode } from 'react';
import { StyleProp, View, ViewStyle } from 'react-native';

import Icon from '../../components/Icon';
Expand All @@ -9,7 +9,7 @@ import useUIKitTheme from '../../theme/useUIKitTheme';
type Props = React.PropsWithChildren<{
style?: StyleProp<ViewStyle>;
}>;
const DialogSheet: ((props: Props) => JSX.Element) & { Item: typeof SheetItem } = ({ style, children }) => {
const DialogSheet: ((props: Props) => ReactNode) & { Item: typeof SheetItem } = ({ style, children }) => {
const { colors } = useUIKitTheme();
return (
<View style={[styles.container, { backgroundColor: colors.ui.dialog.default.none.background }, style]}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import useUIKitTheme from '../../theme/useUIKitTheme';
import Badge from '../Badge';

type Props = {
customCover?: React.ReactElement;
customCover?: React.ReactNode;
coverUrl: string;

title: string;

titleCaption: string;
titleCaptionLeft?: React.ReactElement;
titleCaptionLeft?: React.ReactNode;

bodyIcon?: keyof typeof Icon.Assets;
body: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React from 'react';
import React, { ReactNode } from 'react';
import { TouchableOpacity, TouchableOpacityProps, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

import { conditionChaining } from '@sendbird/uikit-utils';

import Text, { TextProps } from '../../components/Text';
import type { BaseHeaderProps } from '../../index';
import type { BaseHeaderProps, HeaderElement } from '../../index';
import createStyleSheet from '../../styles/createStyleSheet';
import useHeaderStyle from '../../styles/useHeaderStyle';
import useUIKitTheme from '../../theme/useUIKitTheme';

type HeaderElement = string | React.ReactElement | null;
export type HeaderProps = BaseHeaderProps<
{
title?: HeaderElement;
Expand All @@ -27,7 +26,7 @@ export type HeaderProps = BaseHeaderProps<
>;

const AlignMapper = { left: 'flex-start', center: 'center', right: 'flex-end' } as const;
const Header: ((props: HeaderProps) => JSX.Element) & {
const Header: ((props: HeaderProps) => ReactNode) & {
Button: typeof HeaderButton;
Title: typeof HeaderTitle;
Subtitle: typeof HeaderSubtitle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const MessageContainer = ({
);
};

const SendingStatusContainer = ({ children }: { children: React.ReactElement }) => {
const SendingStatusContainer = ({ children }: { children: React.ReactNode }) => {
return (
<Box flexDirection={'row'}>
<Box marginTop={2}>{children}</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import createStyleSheet from '../../styles/createStyleSheet';
import useUIKitTheme from '../../theme/useUIKitTheme';

type Props = {
customCover?: React.ReactElement;
customCover?: React.ReactNode;
coverUrl: string;
title: string;
participantsCount?: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { ReactNode } from 'react';
import { StyleProp, View, ViewStyle } from 'react-native';

import Divider from '../../components/Divider';
Expand All @@ -11,7 +11,7 @@ type Props = {
uri: string;
username: string;

button?: JSX.Element;
button?: ReactNode;

bodyLabel: string;
body: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/uikit-react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"react-native-permissions": "^3.6.0",
"react-native-safe-area-context": "^3.3.2",
"react-native-video": "^5.2.0",
"typescript": "4.9.4"
"typescript": "5.2.2"
},
"peerDependencies": {
"@bam.tech/react-native-image-resizer": ">=3.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { MutableRefObject, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { KeyboardAvoidingView, Platform, TextInput, View } from 'react-native';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

Expand Down Expand Up @@ -61,10 +61,10 @@ export type ChannelInputProps = {
setMessageToReply?: (message?: undefined | SendbirdUserMessage | SendbirdFileMessage) => void;

// mention
SuggestedMentionList?: (props: SuggestedMentionListProps) => JSX.Element | null;
SuggestedMentionList?: (props: SuggestedMentionListProps) => React.ReactNode | null;

// sub-components
AttachmentsButton?: (props: AttachmentsButtonProps) => JSX.Element | null;
AttachmentsButton?: (props: AttachmentsButtonProps) => React.ReactNode | null;
};

const AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });
Expand Down Expand Up @@ -181,7 +181,7 @@ const useTextClearOnDisabled = (setText: (val: string) => void, chatDisabled: bo
};

const useAutoFocusOnEditMode = (
textInputRef: MutableRefObject<TextInput | undefined>,
textInputRef: React.MutableRefObject<TextInput | undefined>,
messageToEdit?: SendbirdBaseMessage,
) => {
useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import React, { ReactNode } from 'react';

type Props = {
loading?: boolean;
LoadingComponent?: JSX.Element;
LoadingComponent?: ReactNode;
error?: boolean;
ErrorComponent?: JSX.Element;
ErrorComponent?: ReactNode;
children: React.ReactNode;
};
const StatusComposition = ({ children, error, ErrorComponent, LoadingComponent, loading }: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DefaultErrorBoundaryComponent = (props: ErrorBoundaryProps) => {

class InternalErrorBoundaryContainer extends React.PureComponent<{
onError?: (props: ErrorBoundaryProps) => void;
ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;
ErrorInfoComponent?: (props: ErrorBoundaryProps) => React.ReactNode;
children?: React.ReactNode;
}> {
static defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
errorBoundary?: {
disabled?: boolean;
onError?: (props: ErrorBoundaryProps) => void;
ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;
ErrorInfoComponent?: (props: ErrorBoundaryProps) => React.ReactNode;
};
toast?: {
dismissTimeout?: number;
Expand Down
Loading

0 comments on commit 0c49d69

Please sign in to comment.