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

bug: event?.preventDefault is not a function (hooks/useSubmitHandler) #2589

Open
jim-spr opened this issue Dec 21, 2024 · 0 comments
Open

bug: event?.preventDefault is not a function (hooks/useSubmitHandler) #2589

jim-spr opened this issue Dec 21, 2024 · 0 comments
Labels
bug Something isn't working status: unconfirmed

Comments

@jim-spr
Copy link

jim-spr commented Dec 21, 2024

Describe the bug
Scherm­afbeelding 2024-12-21 om 22 05 17

`import React from 'react';

import {Channel, ChannelHeader, MessageInput, MessageList, useChatContext, Window} from "stream-chat-react";
import {motion} from 'framer-motion';
import {SendButton} from "@components/ui/chat/components/SendButton";

export function ChatView() {

const {client, setActiveChannel, channel} = useChatContext();
// console.log('CC', {channel})
return (
    <motion.div className="@lg:min-w-[450px] grow flex-1 widget-chat-view ">
        <Channel
            SendButton={SendButton}
        >
            <Window>
                <div className='window h-full min-h-0'>
                    <div className='header'>
                        <ChannelHeader/>
                    </div>
                    <div className='list'>
                        <MessageList/>
                    </div>
                    <div className='footer'>
                        <MessageInput focus/>
                    </div>
                </div>
            </Window>
        </Channel>
        
    </motion.div>
);

}`

`import {Button} from "@nextui-org/button";

export const SendButton = ({disabled, sendMessage} : {
disabled: boolean;
sendMessage: () => void;
}) => {
return

    <Button
        type={'button'}
        isDisabled={disabled}
        onPress={sendMessage}
        color={'primary'}
        isIconOnly
    >
        <i className="fa-regular fa-paper-plane"></i>
    </Button>
</div>

}

`

Expected behavior

A clear and concise description of what you expected to happen.

onPress is not compatible with because the callback expects a syn event in the handler. I think?!
It's all javascript so im unable to trace the root cause or type mistmatches.

Screenshots

If applicable, add screenshots to help explain your problem.

Package version

Desktop (please complete the following information):

  • OS: [e.g. iOS] mac osx Apple sillicon
  • Browser [e.g. chrome, safari] @latest
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

Add any other context about the problem here.

@jim-spr jim-spr added bug Something isn't working status: unconfirmed labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working status: unconfirmed
Projects
None yet
Development

No branches or pull requests

1 participant