File tree 4 files changed +15
-11
lines changed
4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ declare module "SendbirdUIKitGlobal" {
51
51
customApiHost?: string,
52
52
customWebSocketHost?: string,
53
53
// not-ready yet
54
- // breakpoint?: string | boolean,
54
+ breakpoint?: string | boolean,
55
55
theme?: 'light' | 'dark';
56
56
userListQuery?(): UserListQuery;
57
57
nickname?: string;
@@ -232,6 +232,7 @@ declare module "SendbirdUIKitGlobal" {
232
232
configureSession?: (sdk: SendbirdChat | SendbirdGroupChat | SendbirdOpenChat) => SessionHandler;
233
233
customApiHost?: string,
234
234
customWebSocketHost?: string,
235
+ breakpoint?: string | boolean,
235
236
children?: React.ReactElement;
236
237
theme?: 'light' | 'dark';
237
238
replyType?: ReplyType;
Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ const DEFAULT_MOBILE = false;
5
5
// const DEFAULT_MOBILE = '768px';
6
6
const MOBILE_CLASSNAME = 'sendbird--mobile-mode' ;
7
7
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 > > ( {
9
14
breakpoint : DEFAULT_MOBILE ,
10
15
isMobile : false ,
11
16
} ) ;
@@ -39,7 +44,7 @@ const MediaQueryProvider = (props: MediaQueryProviderProps): React.ReactElement
39
44
children,
40
45
logger,
41
46
} = props ;
42
- const breakpoint = props ?. breakpoint || DEFAULT_MOBILE ;
47
+ const breakpoint = props ?. breakpoint || false ;
43
48
const [ isMobile , setIsMobile ] = useState ( false ) ;
44
49
useEffect ( ( ) => {
45
50
const updateSize = ( ) => {
@@ -81,11 +86,6 @@ const MediaQueryProvider = (props: MediaQueryProviderProps): React.ReactElement
81
86
) ;
82
87
} ;
83
88
84
- export type useMediaQueryContextType = ( ) => ( {
85
- breakpoint : string | boolean ;
86
- isMobile : boolean ;
87
- } ) ;
88
-
89
89
const useMediaQueryContext : useMediaQueryContextType = ( ) => React . useContext ( MediaQueryContext ) ;
90
90
91
91
export { MediaQueryProvider , useMediaQueryContext } ;
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ export interface SendbirdProviderProps extends CommonUIKitConfigProps {
88
88
allowProfileEdit ?: boolean ;
89
89
disableMarkAsDelivered ?: boolean ;
90
90
showSearchIcon ?: boolean ;
91
+ breakpoint ?: string | boolean ;
91
92
renderUserProfile ?: ( ) => React . ReactElement ;
92
93
onUserProfileMessage ?: ( ) => void ;
93
94
}
@@ -158,9 +159,8 @@ const SendbirdSDK = ({
158
159
disableMarkAsDelivered = false ,
159
160
renderUserProfile = null ,
160
161
onUserProfileMessage = null ,
162
+ breakpoint = false ,
161
163
} : SendbirdProviderProps ) : React . ReactElement => {
162
- const breakpoint = false ;
163
-
164
164
const {
165
165
logLevel = '' ,
166
166
userMention = { } ,
Original file line number Diff line number Diff line change @@ -104,7 +104,10 @@ App.propTypes = {
104
104
userListQuery : PropTypes . func ,
105
105
nickname : PropTypes . string ,
106
106
profileUrl : PropTypes . string ,
107
- breakpoint : PropTypes . string ,
107
+ breakpoint : PropTypes . oneOf ( [
108
+ PropTypes . string ,
109
+ PropTypes . bool ,
110
+ ] ) ,
108
111
allowProfileEdit : PropTypes . bool ,
109
112
disableUserProfile : PropTypes . bool ,
110
113
disableMarkAsDelivered : PropTypes . bool ,
You can’t perform that action at this time.
0 commit comments