Where to implement shouldRenderInput for a GroupChannel

Hi there, I’m really struggling for the fragment/module/context structure to make sense to me. I’d really appreciate some more examples of customization in the sample application.

Right now i’m trying to figure out what is the easiest method for setting the Input Module of a group channel to be disabled (or not rendered at all) - based on the custom channel type.

I know I could override the Input in createGroupChannelFragment, however i’m not sure that’s the developers intended way to handle this.

Would really appreciate anyones tips - Thank you!

Actually, I believe I figured it out… and it was very straightforward once it clicked in my brain.

Posting solution just incase others are curious…

const UseCustomInput: GroupChannelModule["Input"] = ({ shouldRenderInput, ...props }) => {
  const { sdk } = useSendbirdChat()
  const { params } = useRoute<any>()
  const { channel } = useGroupChannel(sdk, params.channelUrl)
  let willRenderInput = shouldRenderInput
  if (channel?.customType === "announcement") willRenderInput = false
  if (channel?.isFrozen) willRenderInput = false
  return <GroupChannelInput shouldRenderInput={willRenderInput} {...props} />
}

const GroupChannelFragment = createGroupChannelFragment({
  Input: UseCustomInput,
})
1 Like