Skip to content

Commit ce47cb3

Browse files
committed
fix custom avatar to custom step when rendered with asMessage prop
1 parent ad89e2c commit ce47cb3

File tree

7 files changed

+30
-27
lines changed

7 files changed

+30
-27
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"no-confusing-arrow": ["off"],
1515
"class-methods-use-this": ["off"],
1616
"jsx-a11y/no-static-element-interactions": ["off"],
17+
"jsx-a11y/img-has-alt": ["off"],
1718
"react/no-will-update-set-state": ["off"],
1819
"react/jsx-boolean-value": ["off"],
1920
"react/react-in-jsx-scope": ["off"],

dist/react-simple-chatbot.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ChatBot.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ class ChatBot extends Component {
6060
const step = this.props.steps[i];
6161
let settings = {};
6262

63-
if (step.user || step.asMessage) {
63+
if (step.user) {
6464
settings = defaultUserSettings;
65-
} else if (step.message) {
65+
} else if (step.message || step.asMessage) {
6666
settings = defaultBotSettings;
6767
} else if (step.component) {
6868
settings = defaultCustomSettings;

lib/schemas/customSchema.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export default [
99
types: ['any'],
1010
required: true,
1111
},
12+
{
13+
key: 'avatar',
14+
types: ['string'],
15+
required: false,
16+
},
1217
{
1318
key: 'replace',
1419
types: ['boolean'],

package-lock.json

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-simple-chatbot",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "React Simple Chatbot",
55
"main": "dist/react-simple-chatbot.js",
66
"scripts": {

src/components/Example.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@ const steps = [
2121
},
2222
];
2323

24-
const Example = () =>
25-
<ChatBot steps={steps} />;
26-
2724
const ThemedExample = () => (
2825
<ThemeProvider theme={otherFontTheme}>
29-
<Example />
26+
<ChatBot steps={steps} />
3027
</ThemeProvider>
3128
);
3229

0 commit comments

Comments
 (0)