Skip to content

Commit 8dc384a

Browse files
committed
update demo
1 parent 111e7d3 commit 8dc384a

File tree

4 files changed

+35
-18
lines changed

4 files changed

+35
-18
lines changed

example/app/routes/Chat/index.js

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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, // 开始的消息下标。
@@ -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}

example/app/routes/Home/ConversationList/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ export default class ConversationList extends React.Component {
181181
}
182182

183183
_onPress() {
184-
Alert.alert("click", "fasdf")
185184
JMessage.createConversation({
186185
type: 'single',
187186
username: '0002'
@@ -197,7 +196,6 @@ export default class ConversationList extends React.Component {
197196
key: conv.target.id
198197
}
199198
item.conversationType = 'group'
200-
Alert.alert('conversaion', JSON.stringify(conv))
201199
}
202200
this.setState({})
203201
Alert.alert('the item', JSON.stringify(item))
@@ -223,7 +221,6 @@ export default class ConversationList extends React.Component {
223221
key: conv.target.id
224222
}
225223
item.conversationType = 'group'
226-
Alert.alert('conversaion', JSON.stringify(conv))
227224
}
228225
this.reloadConversationList()
229226
this.props.navigation.navigate('Chat', {

example/app/routes/Home/MyInfo/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ export default class MyNotificationsScreen extends React.Component {
7272
}
7373
componentWillMount() {
7474
JMessage.getMyInfo((user) => {
75-
Alert.alert("RNFS.MainBundlePath", RNFS.MainBundlePath)
76-
Alert.alert("user.avatarThumbPath", user.avatarThumbPath)
7775
this.setState({
7876
myInfo: user,
7977
})

example/app/routes/Login/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default class Login extends React.Component {
5151
Alert.alert('login success')
5252
navigate('Home')
5353
}, (error) => {
54-
Alert.alert('login success', JSON.stringify(error))
54+
Alert.alert('login fail', JSON.stringify(error))
5555
})
5656
}
5757

0 commit comments

Comments
 (0)