@@ -43,12 +43,16 @@ export default class Chat extends Component {
4343 constructor ( props ) {
4444 super ( props ) ;
4545 this . state = {
46- inputViewLayout : { width : window . width , height : 200 , } ,
4746 menuContainerHeight : 1000 ,
4847 isDismissMenuContainer : false ,
4948 shouldExpandMenuContainer : false ,
5049 } ;
51-
50+ if ( Platform . OS == 'ios' ) {
51+ this . state . inputViewLayout = { width : window . width , height : 86 , }
52+ } else {
53+ this . state . inputViewLayout = { width : window . width , height : 200 , }
54+ }
55+
5256 this . updateLayout = this . updateLayout . bind ( this ) ;
5357 this . onTouchMsgList = this . onTouchMsgList . bind ( this ) ;
5458 this . conversation = this . props . navigation . state . params . conversation
@@ -138,7 +142,7 @@ export default class Chat extends Component {
138142 message . isOutgoing = true
139143 message . content = '<body bgcolor="#ff3399"><h5>This is a custom message. </h5>\
140144 <img src="/storage/emulated/0/XhsEmoticonsKeyboard/Emoticons/wxemoticons/icon_040_cover.png"></img></body>'
141- message . contentSize = { 'height' : 400 , 'width' : 400 }
145+ message . contentSize = { 'height' : 200 , 'width' : 200 }
142146 message . extras = { "extras" : "fdfsf" }
143147 var user = {
144148 userId : "1" ,
@@ -156,6 +160,7 @@ export default class Chat extends Component {
156160 }
157161
158162 componentDidMount ( ) {
163+ this . resetMenu ( )
159164 var parames = {
160165
161166 'from' : 0 , // 开始的消息下标。
@@ -211,10 +216,10 @@ export default class Chat extends Component {
211216 JMessage . addReceiveMessageListener ( this . receiveMessageCallBack )
212217 }
213218 AuroraIController . addMessageListDidLoadListener ( this . messageListDidLoadCallback )
214- // this.timer = setTimeout(() => {
215- // console.log("Sending custom message")
216- // this.sendCustomMessage();
217- // }, 2000)
219+ this . timer = setTimeout ( ( ) => {
220+ console . log ( "Sending custom message" )
221+ this . sendCustomMessage ( ) ;
222+ } , 2000 )
218223 }
219224
220225 componentWillUnmount ( ) {
@@ -227,6 +232,31 @@ export default class Chat extends Component {
227232
228233 }
229234
235+ resetMenu ( ) {
236+ if ( Platform . OS === "android" ) {
237+ console . log ( "reset menu, count: " + this . state . lineCount )
238+ if ( this . lineCount == 1 ) {
239+ this . setState ( {
240+ inputHeight : 120 ,
241+ inputViewLayout : { width : window . width , height : 200 }
242+ } )
243+ } else {
244+ this . setState ( {
245+ inputHeight : 80 + this . state . lineCount * 40 ,
246+ inputViewLayout : { width : window . width , height : 160 + 40 * this . state . lineCount }
247+ } )
248+ }
249+ this . setState ( {
250+ shouldExpandMenuContainer : false ,
251+ } )
252+ } else {
253+ this . setState ( {
254+ inputViewLayout : { width : window . width , height : 86 }
255+ } )
256+ AuroraIController . hidenFeatureView ( true )
257+ }
258+ }
259+
230260 updateLayout ( layout ) {
231261 this . setState ( { inputViewLayout : layout } )
232262 }
@@ -237,14 +267,7 @@ export default class Chat extends Component {
237267
238268 onTouchMsgList ( ) {
239269 console . log ( "Touch msg list, hidding soft input and dismiss menu" ) ;
240- this . setState ( {
241- isDismissMenuContainer : true ,
242- inputViewLayout : {
243- width : Dimensions . get ( 'window' ) . width ,
244- height : 200
245- } ,
246- shouldExpandMenuContainer : false ,
247- } ) ;
270+ this . resetMenu ( )
248271 }
249272
250273 onTouchEditText = ( ) => {
@@ -560,7 +583,6 @@ export default class Chat extends Component {
560583 sendBubbleTextColor = { "#000000" }
561584 sendBubblePadding = { { left : 10 , top : 10 , right : 15 , bottom : 10 } }
562585 />
563- }
564586 < InputView style = { this . state . inputViewLayout }
565587 menuContainerHeight = { this . state . menuContainerHeight }
566588 isDismissMenuContainer = { this . state . isDismissMenuContainer }
0 commit comments