Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29452

fetch is sending the request success but responsing an error and feeze the screen React Native

$
0
0

Right now i'm working on the chat Application which sends the post Request to the server and the updates the messages Json data but its now sending the post data successfully and also responding an anonymous error without tracking

packages I'm using

fetch from native-JsReact-Native-Gifted-Chat  onSend(messages= []) {          console.log('message Send button clicked');          const newSendMessage = messages[0]['text'];          var data = new FormData();          data.append('groupId', this.state.groupIdNew);          data.append('memberId[]', this.state.members);          data.append('message', newSendMessage);          data.append('userId', ApiUserId);          fetch(API_HOST +'imApi/sendMessage', {            method: 'POST',            headers: {              Accept : 'Application/json','content-type': 'multipart/form-data',            },            body: data,          }).then((json) => json.text()).then(text => {            this.setState((previousState) => ({              messages: GiftedChat.append(previousState.messages, messages),            }));          }).catch((e) => console.error(JSON.stringify(e)));

the return render of the following is

<GiftedChat            onInputTextChanged={(text) => changeText(text)}            messages={_.orderBy(ml, ['createdAt'], ['desc'])}            scrollToBottom={true}            renderMessageVideo={() => console.log(ml)}            onSend={(messages) => this.onSend(messages)}            renderSend={(props) => (<View                style={{                  flexDirection: 'row',                  alignItems: 'center',                  height: 50,                }}><Icon                  raised                  name="attachment"                  reverse={this.state.modalVisible == false ? false : true}                  color="#08CAF9"                  onPress={() => {                    this.setModalVisible(true);                  }}                /><Send {...props}><View style={styles.btnSend}><Icon raised name="send" size={24} color="#08CAF9" /></View></Send></View>            )}            multiline={true}            alwaysShowSend={true}            user={{              _id: ApiUserId,            }}          />

After running the above code i've got the following error

{ "line": 27764, column:31, sourceUrl: "https://localhost:8081/index.bundle?platform=androud&dev=true&minify }

this error cause screen freeze and many for couple minutes

can someOne help me what is this about and how to solve this issue


Viewing all articles
Browse latest Browse all 29452

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>