File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ declare module "SendbirdUIKitGlobal" {
5151 customApiHost?: string,
5252 customWebSocketHost?: string,
5353 // not-ready yet
54- // breakpoint?: string | boolean,
54+ breakpoint?: string | boolean,
5555 theme?: 'light' | 'dark';
5656 userListQuery?(): UserListQuery;
5757 nickname?: string;
@@ -232,6 +232,7 @@ declare module "SendbirdUIKitGlobal" {
232232 configureSession?: (sdk: SendbirdChat | SendbirdGroupChat | SendbirdOpenChat) => SessionHandler;
233233 customApiHost?: string,
234234 customWebSocketHost?: string,
235+ breakpoint?: string | boolean,
235236 children?: React.ReactElement;
236237 theme?: 'light' | 'dark';
237238 replyType?: ReplyType;
Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ const DEFAULT_MOBILE = false;
55// const DEFAULT_MOBILE = '768px';
66const MOBILE_CLASSNAME = 'sendbird--mobile-mode' ;
77
8- const MediaQueryContext = React . createContext ( {
8+ export type useMediaQueryContextType = ( ) => ( {
9+ breakpoint : string | boolean ;
10+ isMobile : boolean ;
11+ } ) ;
12+
13+ const MediaQueryContext = React . createContext < ReturnType < useMediaQueryContextType > > ( {
914 breakpoint : DEFAULT_MOBILE ,
1015 isMobile : false ,
1116} ) ;
@@ -39,7 +44,7 @@ const MediaQueryProvider = (props: MediaQueryProviderProps): React.ReactElement
3944 children,
4045 logger,
4146 } = props ;
42- const breakpoint = props ?. breakpoint || DEFAULT_MOBILE ;
47+ const breakpoint = props ?. breakpoint || false ;
4348 const [ isMobile , setIsMobile ] = useState ( false ) ;
4449 useEffect ( ( ) => {
4550 const updateSize = ( ) => {
@@ -81,11 +86,6 @@ const MediaQueryProvider = (props: MediaQueryProviderProps): React.ReactElement
8186 ) ;
8287} ;
8388
84- export type useMediaQueryContextType = ( ) => ( {
85- breakpoint : string | boolean ;
86- isMobile : boolean ;
87- } ) ;
88-
8989const useMediaQueryContext : useMediaQueryContextType = ( ) => React . useContext ( MediaQueryContext ) ;
9090
9191export { MediaQueryProvider , useMediaQueryContext } ;
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ export interface SendbirdProviderProps extends CommonUIKitConfigProps {
8888 allowProfileEdit ?: boolean ;
8989 disableMarkAsDelivered ?: boolean ;
9090 showSearchIcon ?: boolean ;
91+ breakpoint ?: string | boolean ;
9192 renderUserProfile ?: ( ) => React . ReactElement ;
9293 onUserProfileMessage ?: ( ) => void ;
9394}
@@ -158,9 +159,8 @@ const SendbirdSDK = ({
158159 disableMarkAsDelivered = false ,
159160 renderUserProfile = null ,
160161 onUserProfileMessage = null ,
162+ breakpoint = false ,
161163} : SendbirdProviderProps ) : React . ReactElement => {
162- const breakpoint = false ;
163-
164164 const {
165165 logLevel = '' ,
166166 userMention = { } ,
Original file line number Diff line number Diff line change @@ -104,7 +104,10 @@ App.propTypes = {
104104 userListQuery : PropTypes . func ,
105105 nickname : PropTypes . string ,
106106 profileUrl : PropTypes . string ,
107- breakpoint : PropTypes . string ,
107+ breakpoint : PropTypes . oneOf ( [
108+ PropTypes . string ,
109+ PropTypes . bool ,
110+ ] ) ,
108111 allowProfileEdit : PropTypes . bool ,
109112 disableUserProfile : PropTypes . bool ,
110113 disableMarkAsDelivered : PropTypes . bool ,
You can’t perform that action at this time.
0 commit comments