import { useContext } from "react";
import { OverlayContext } from "stream-chat-react-native";
const { setOverlay } = useContext(OverlayContext);
OverlayContext
OverlayContext
is provided by OverlayProvider
component. If you are not familiar with React Context API, please read about it on React docs.
Basic Usage
OverlayContext
can be consumed by any of the child component of OverlayProvider
component as following:
Alternatively, you can also use useOverlayContext
hook provided by library to consume OverlayContext.
import { useOverlayContext } from "stream-chat-react-native";
const { setOverlay } = useOverlayContext();
Value
overlay
Current active overlay. Overlay gets rendered in following cases
- ‘alert’ - For delete message confirmation alert box
- ‘gallery’ - When image viewer/gallery is opened
- ‘none’ - Default value
Type |
---|
enum(‘alert’, ‘gallery’, ‘none’) |
setOverlay
Setter for overlay
. You can use this setter to show the overlay.
Type |
---|
(overlay) => void |
style
A theme
object to customize the styles of SDK components.
Detailed information on theming can be found in the customization documentation.
Themes are inherited from parent providers.
A theme provided to the OverlayProvider
will be the base theme style
is merged into.
Themes are not hoisted though, therefore a theme provided to Chat
will not change overlay components such as the attachment picker.
Type |
---|
Object |