Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Unhandled Promise Rejection (id: 0): TypeError: this.props is undefined #23102

Closed
onkar-dange opened this issue Jan 22, 2019 · 1 comment
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.

Comments

@onkar-dange
Copy link

I have a class component as PatientQueue in PatientQueue.js file and Another class component of PatientDetailView in PatientDetailView.js file.
And I am calling function Getdetails() which is in PatientQueue class from PatientDetailView class.By creating its object. but when I am calling Getdetails I get the error of Possible Unhandled Promise Rejection (id: 0): TypeError: this.props is undefined.

and my code is like this

  1. PatientQueue file
    import React from 'react';
    import { FlatList,BackHandler, ListView,ToastAndroid, ScrollView, ActivityIndicator,AppState, TouchableOpacity, Alert, StyleSheet, Image, Text, View, Button, AsyncStorage, SafeAreaView, RefreshControl } from 'react-native';
    import { createStackNavigator, createAppContainer, DrawerItems } from 'react-navigation';
    import { SearchBar, Icon } from 'react-native-elements';
    import MultiSelect from 'react-native-multiple-select';
    import { PatientDetailView } from './PatientDetailView';
    import { connect } from "react-redux";
    import { fetchQueue } from '../common/actions/patientQueue';
    import { filterQueue } from '../common/actions/filters';
    import { clearAllFilters } from '../common/actions/filters';
    class PatientQueue extends React.Component {
    constructor(props) {
    super(props);
    ......
    }

ForTesting(){
console.log("function called")
}

async Getdetails() {
console.log("fetch detailssss")

const retrievedItem = await AsyncStorage.getItem("StorageData");
const getretrievedItem = JSON.parse(retrievedItem);
var loginToken = getretrievedItem.token;

	await this.props.dispatch(fetchQueue(loginToken));
   console.log("fetch details comleted") 

}

render() {
..............
}
}
export default connect(mapStateToProps)(PatientQueue);
const RefreshList=new PatientQueue();
export{RefreshList}

  1. And in PatientDetailView file

import React from 'react';
import { FlatList,Modal, ListView,TextInput, Linking,Picker, TouchableOpacity, ActivityIndicator, Alert, StyleSheet, Text, View, Button, AsyncStorage } from 'react-native';
import { createStackNavigator, createAppContainer } from 'react-navigation';
import { Header, Left, Right, Icon, Container, Body, Title } from 'native-base';
import {RefreshList} from './PatientQueue';
import PatientQueue from './PatientQueue';

class PatientDetailView extends React.Component {
constructor(props) {
super(props);
this.state = {
modalVisible: false,
TransferModalVisible:false,
......
}
}
async OpenUhs(BtnStatus,PatientId) {
RefreshList.Getdetails();
this.props.navigation.navigate("Queue")
}

render() {

.....
}

export { PatientDetailView };

@onkar-dange onkar-dange added the Type: Question Issues that are actually questions and not bug reports. label Jan 22, 2019
@react-native-bot
Copy link
Collaborator

We are automatically closing this issue because it does not appear to follow any of the provided issue templates.

Please make use of the bug report template to let us know about a reproducible bug or regression in the core React Native library.

If you'd like to propose a change or discuss a feature request, there is a repository dedicated to Discussions and Proposals you may use for this purpose.

@react-native-bot react-native-bot added Ran Commands One of our bots successfully processed a command. 📋No Template labels Jan 22, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Jan 22, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jan 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot. Type: Question Issues that are actually questions and not bug reports.
Projects
None yet
Development

No branches or pull requests

2 participants