You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
After creating a step with a custom component (id 3) and then display a message after it (id 4), the trigger for this step with the message is not triggering, which is currently set to five. I have tried changing the trigger and still getting the same issue.
importReact,{Component}from'react';importChatBotfrom'react-native-chatbot';importMedicalConditionfrom'./medical_condition';constDOCTOR_NAME='Dr Costa';exportdefaultclassSymptomsBotextendsComponent{constructor(props){super(props);letsteps=[{id: '0',message: `Hello, ${DOCTOR_NAME} here, what seems to be the problem?`,trigger: '1',},{id: '1',user: true,inputAttributes: {keyboardType: 'default',},trigger: '2',validator: value=>{if(!value)return'Please try again!';else{returntrue;}},},{id: '2',trigger: '3',message: `Thanks, let me take a look for you...`,},{id: '3',component: <MedicalConditionstepIndex={1}/>,replace: true,waitAction: true,asMessage: true,trigger: '4'},{id: '4',message: ({steps})=>`It seems like you may have ${steps[3].value}. Would like to inform your doctor?`,trigger: '5',},{id: '5',options: [{value: 1,label: 'Yes',trigger: '6'},{value: 2,label: 'No',trigger: '6'},{value: 3,label: 'Try again',trigger: '6'},],},{id: '6',message: `Thanks, let me take a look for you...`,end: true},];this.state={steps: steps,};}render(){return<ChatBotsteps={this.state.steps}/>;}}
importReact,{Component}from'react';importPropTypesfrom'prop-types';import{getSymptom}from'_services';exportdefaultclassMedicalConditionextendsComponent{constructor(props){super(props);this.state={stepIndex: this.props.stepIndex,loading: true,value: '',trigger: false,steps: this.props.steps,waitAction: this.props.step.waitAction};}componentDidMount(){getSymptom(this.props.steps[this.state.stepIndex].value).then(response=>{this.setState({loading: false,value: response.data.condition,trigger: this.props.step.trigger},()=>{this.props.triggerNextStep(this.state);});}).catch(err=>{this.setState({loading: false,value: 'We seems to be experiencing an issue.',});console.log(err);});}render(){returnnull;}}MedicalCondition.propTypes={steps: PropTypes.object,triggerNextStep: PropTypes.func,step: PropTypes.object,previousStep: PropTypes.object,}MedicalCondition.defaultProps={steps: undefined,triggerNextStep: undefined,step: undefined,previousStep: undefined,}
Screenshots
The text was updated successfully, but these errors were encountered:
hello @Divyesh26 looking at this issue, the next component would not be called because the trigger props is set to boolean in your state. ie in the medical condition component. try passing in the next step you want to be called and that should resolve your issue. ie
Description
After creating a step with a custom component (id 3) and then display a message after it (id 4), the trigger for this step with the message is not triggering, which is currently set to five. I have tried changing the trigger and still getting the same issue.
Screenshots
The text was updated successfully, but these errors were encountered: