Enable button once waku is ready

This commit is contained in:
Franck Royer 2021-04-22 17:05:19 +10:00
parent fae5959d2f
commit f0cd4064cb
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,6 @@
import React, { ChangeEvent, KeyboardEvent, useState } from 'react';
import { Button, Grid, TextField } from '@material-ui/core';
import { useWaku } from './WakuContext';
interface Props {
messageHandler: (msg: string) => void;
@ -8,6 +9,7 @@ interface Props {
export default function MessageInput(props: Props) {
const [inputText, setInputText] = useState<string>('');
const { waku } = useWaku();
const sendMessage = () => {
props.sendMessage();
@ -40,6 +42,7 @@ export default function MessageInput(props: Props) {
}}
onChange={messageHandler}
onKeyPress={keyPressHandler}
disabled={!waku}
/>
</Grid>
<Grid item xs={1}>
@ -48,6 +51,7 @@ export default function MessageInput(props: Props) {
color="primary"
size="large"
onClick={sendMessage}
disabled={!waku}
>
Send
</Button>