File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 11import {
22 Image ,
3+ KeyboardAvoidingView ,
34 Platform ,
45 ScrollView ,
56 type ScrollViewProps ,
@@ -22,7 +23,10 @@ export function Chat({
2223} : Partial < ScrollViewProps & { bottom : boolean } > ) {
2324 console . log ( Platform . OS , ' Rendering Chat' ) ;
2425 return (
25- < View style = { styles . container } >
26+ < KeyboardAvoidingView
27+ behavior = { Platform . OS === 'ios' ? 'padding' : 'height' }
28+ style = { styles . container }
29+ >
2630 < ScrollView
2731 style = { styles . inverted }
2832 contentContainerStyle = { styles . content }
@@ -64,10 +68,10 @@ export function Chat({
6468 />
6569 { bottom ? (
6670 < View
67- style = { [ styles . spacer , Platform . OS !== 'android' && { height : 80 } ] }
71+ style = { [ styles . spacer , Platform . OS !== 'android' && { height : 90 } ] }
6872 />
6973 ) : null }
70- </ View >
74+ </ KeyboardAvoidingView >
7175 ) ;
7276}
7377
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ struct TabData: Codable {
108108 }
109109 guard let image else { return }
110110 DispatchQueue . main. async {
111- self . props. icons [ index] = image
111+ self . props. icons [ index] = image. resizeImageTo ( size : self . iconSize )
112112 }
113113 } )
114114 }
@@ -139,11 +139,21 @@ struct TabData: Codable {
139139 guard let configDict = dict as? [ String : Any ] else { return nil }
140140 let sidebarAdaptable = configDict [ " sidebarAdaptable " ] as? Bool ?? false
141141 let labeled = configDict [ " labeled " ] as? Bool ?? nil
142-
142+
143143 return TabViewConfig (
144144 sidebarAdaptable: sidebarAdaptable,
145145 labeled: labeled
146146 )
147147 }
148148
149149}
150+
151+ extension UIImage {
152+ func resizeImageTo( size: CGSize ) -> UIImage ? {
153+ UIGraphicsBeginImageContextWithOptions ( size, false , 0.0 )
154+ self . draw ( in: CGRect ( origin: CGPoint . zero, size: size) )
155+ let resizedImage = UIGraphicsGetImageFromCurrentImageContext ( ) !
156+ UIGraphicsEndImageContext ( )
157+ return resizedImage
158+ }
159+ }
You can’t perform that action at this time.
0 commit comments