2017-09-06 11 views
0

この才能豊かなチャットライブラリ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> 
); 

を囲む外では動作しませんレンダリング

は、私がActionSheetビューを置くべきGiftedChatを見ますか?

答えて

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> 
+0

私は...これは言っています.ActionSheetはnullです – MonkeyBonkey

+0

多分それをバインドする必要があります。 'this.ActionSheet.bind(this)'を試してください。または、おそらく 'this.ActionSheet.bind(ActionSheet) 'でもどちらもうまくいきません。 –

+0

私は持っています - まだヌル – MonkeyBonkey