Closed ciamalaeaskan closed 3 years ago
Are any error in you console?
FYI. Usually we use dialog_id
. Define a dialog by dialog_id
and pass it to navigation.
You may need to configure your navigation to open the "Chat" screen from any place (just a guess).
Are any error in you console?
FYI. Usually we use
dialog_id
. Define a dialog bydialog_id
and pass it to navigation. You may need to configure your navigation to open the "Chat" screen from any place (just a guess).
yes i'm receiving error on the below line store.getState().users[id]
Seams you lost users' state in redux before navigate. So, you have to fix this. Or try to comment a code where you have errors to test navigation to the Chat screen.
Error: Could not find "store" in the context of "Connect(Dialogs)". Either wrap the root component in a
I'm getting this error when navigate to chat page
Any update for me this is the only issue i'm facing now.
Error: Could not find "store" in the context of "Connect(Dialogs)". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(Dialogs) in connect options.
I'm getting this error when navigate to chat page
It is Redux. Please see the Redux docs and how to use it with the React Native.
Yeah! I check that. And also I like to let you know that I'm not using connectycube default notification process, I have separately create notification process and integrated with it. So can you please let me know what are the parameters to be passed to open particular chat.
I would be use a dialog's ID to obtain a dialog by ID (from redux, from DB or from server) and use it.
Can you please explain this with any example ?
In most cases it will be your own code realization.
How to get dialog by ID from server:
ConnectyCube.chat.dialog.list({ _id: someDialogId }).then(dialog => dialog)
Yes i have got the dialog id. But I'm asking what are required datas for this navigation. "this.props.navigation.navigate("Chat", {dialog});" I mean what are the datas should inside the {dialog} variable
You pass a data and you get the data, so you should know what exactly you are need :)
The {dialog}
is short code notation from an object {dialog: dialogObject}
.
Try this:
ConnectyCube.chat.dialog.list({ _id: dialogId})
.then(dialog => {
this.props.navigation.navigate("Chat", {dialog});
})
.catch(error => {
console.log(error)
});
Hi,
I have tried the above method like this,
ConnectyCube.chat.dialog.list({ _id: 1895242}) .then(dialog => { this.props.navigation.navigate("Chat", {dialog}); }) .catch(error => { console.log(error) });
I'm having the error like the first screenshot .
So i have tried another method
gotToChat = (receiverid) => { this.setState({ isLoader: true }) ChatService.createPrivateDialog(receiverid) .then((newDialog) => { console.log(newDialog, "newDialog response") }); }
That also having error like the second screenshot.
Can you please help me
Check with the console.log()
what you have in this.props.navigation
, then this.props.navigation.state
> this.props.navigation.state.dialog
> this.props.navigation.state.dialog.name
. You will find what is missing.
Now i have tried this
ConnectyCube.chat.dialog.list({ _id: "5f87d9beca8bf45d18b30ce6"}) .then(dialog => { console.log(dialog.items[0], "dialogdialognew") this.props.navigation.navigate("Chat", {dialog : dialog.items[0]}); }) .catch(error => { console.log(error) });
its redirect to chat page but did't show any previous messages like the below screenshot
I missed any thing ?
Check a log of Metro server or via Chrome console. Probably you would see some errors.
having TypeError: null is not an object (evaluating 'name.length') warning only.
I'm receiving this error by using above all three methods
What you have in the dialog object? (console.log(dialog)
)
{"_id": "5f87d9beca8bf45d18b30ce6", "admins_ids": [], "created_at": "2020-10-15T05:10:22Z", "description": null, "last_message": "Hiii", "last_message_date_sent": 1602769104, "last_message_id": "5f8850d00ed3a949ca00000c", "last_message_user_id": 1895242, "name": "Teststudent021020200328 Teststudent021020200328", "occupants_ids": [1895242, 2171558], "photo": null, "pinned_messages_ids": [], "type": 3, "unread_messages_count": 0, "updated_at": "2020-10-15T13:38:24Z", "user_id": 1895242, "xmpp_room_jid": null}
this is my dialog response
It is OK. And try to check the dialog on the Chat screen
above is the response of this code
ConnectyCube.chat.dialog.list({ _id: "5f87d9beca8bf45d18b30ce6"}) .then(dialog => { console.log(dialog.items[0]) this.props.navigation.navigate("Chat", {dialog : dialog.items[0]}); }) .catch(error => { console.log(error) });
On the "Chat" route. After this.props.navigation.navigate("Chat", {dialog : dialog.items[0]})
you go to the "Chat" route. There you need to check your params (dialog).
Yes, i check it on chat page componentDidMount function there also having same data, But on ChatService.getMessages(dialog) method go to catch part but did't show any error message, it shows like the below log only
[Thu Oct 15 2020 19:50:17.324] LOG Error.
componentDidMount() {
this.initAuthToken();
const { dialog } = this.props.navigation.state.params
console.log(dialog, "Chat page ")
ChatService.getMessages(dialog)
.catch(e =>
console.log(Error.\n\n${JSON.stringify(e)}
)
)
.then(amountMessages => {
amountMessages === 100 ? this.needToGetMoreMessage = true : this.needToGetMoreMessage = false
this.setState({ activIndicator: false })
})
}
Probably you need to find error inside the getMessages
to fix - https://github.com/ConnectyCube/connectycube-reactnative-samples/blob/master/RNChat/src/services/chat-service.js#L118
Thank You now its working
I'm using connectycube chat system in my react native application it works fine. But i have integrated Push notification separately it triggers every time when we send message . So when i click the notification it should open the respective chat. But i can't able to open that chat. Below is my code:
var dialog={"id": "5f5a21f0ca8b.........", "occupants_ids": [189..., 189...], "unread_messages_count": 0, "type":3,"user_id": 189...}; this.props.navigation.navigate("Chat", {dialog});
Please help me if i have missed anything.
Thanks.