///我从不同的屏幕获取价值,并在此处传递了docketNumber号,即referenceNumber。我在日志中看到了参考编号数据。但是我想数据不会在dicketNumber中进行。因为数据即将为空。 请看一下我的代码,帮助我发现错误。
import React, { Component } from 'react';
import { Text, View } from 'react-native';
import { Query } from 'react-apollo';
import gql from 'graphql-tag';
import LoadingSpinner from '../ui/spinner';
import { handleErrors } from '../../services';
import TroubleTicketHistory from '../../components/troubleTicketHistory/TroubleTicketHistory';
const TROUBLE_TICKET_CONTAINER = gql`
query troubleTicketDetails($docketNumber: String!){
troubleTicketDetails(docketNumber: $docketNumber){
ticketNumber
ticketSubCategory
question
responseMedium
respondedBy
resolvedBy
loggedBy
ticketType
source
ticketResponseDate
answer
responseAddress
ticketCategory
ticketStatus
msisdn
tickerCreationDate
reopenCount
}
}
`;
export default class TroubleTicketDetailContainer extends Component {
constructor(props) {
super(props);
console.log("ggggggggggggggggggg",props);
}
render() {
console.log("ggggggggggggggggggg",this.props);
//const { docketNumber, navigation } = this.state;
const { referenceNumber } = this.props.navigation.state.params;
console.log("referenceNumber",referenceNumber); // RefrerenceNumber is coming this no I have to pass in docketNumber below .
return (
<Query query={TROUBLE_TICKET_CONTAINER} variables={{ docketNumber: referenceNumber }}>
{(data, loading, error) => {
if (loading) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<LoadingSpinner color="#00678F"/>
</View>
);
}
if (error) {
handleErrors(error, navigation);
return null;
}
if (data) {
console.log("data222222222222222222222",data);
return (
<View>
<TroubleTicketHistory data={data}/>
</View>
);
}
}}
</Query>
);
}
}