使用这个有天赋的聊天库https://github.com/FaridSafi/react-native-gifted-chat
我已经尝试将ActionSheet添加到渲染功能,但它不会渲染天赋聊天,因为聊天屏幕只有在它是唯一的根视图控件时才有效。
此渲染功能无法使用外部封闭View
return (
<View>
<GiftedChat
messages={this.state.messages}
onSend={this.onSend}
onPressAvatar={this.pressProfile}
user={{
_id: user.id,
name: user.username,
avatar: user.thumbnail,
}}
/>
<ActionSheet
ref={o => this.ActionSheet = o}
title={title}
options={options}
cancelButtonIndex={CANCEL_INDEX}
destructiveButtonIndex={DESTRUCTIVE_INDEX}
onPress={this.handlePress}
/>
</View>
);
如果我必须将根视图设为GiftedChat
,我应该在哪里放置ActionSheet视图?
答案 0 :(得分:0)
你试过这个吗?
<GiftedChat
messages={this.state.messages}
onSend={this.onSend}
onPressAvatar={this.pressProfile}
user={{
_id: user.id,
name: user.username,
avatar: user.thumbnail,
}}
>
<ActionSheet
ref={o => this.ActionSheet = o}
title={title}
options={options}
cancelButtonIndex={CANCEL_INDEX}
destructiveButtonIndex={DESTRUCTIVE_INDEX}
onPress={this.handlePress}
/>
</GiftedChat>