Skip to content

Commit

Permalink
Merge pull request #2538 from pnthach95/isStatusBarTranslucentAndroid
Browse files Browse the repository at this point in the history
Add `isStatusBarTranslucentAndroid` to prevent status bar from changing color
  • Loading branch information
kesha-antonov authored Sep 24, 2024
2 parents 57b9da3 + 3acc8e8 commit f03bfa9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ interface QuickReplies {
* **`renderQuickReplySend`** _(Function)_ - Custom quick reply **send** view
* **`shouldUpdateMessage`** _(Function)_ - Lets the message component know when to update outside of normal cases.
* **`infiniteScroll`** _(Bool)_ - infinite scroll up when reach the top of messages container, automatically call onLoadEarlier function if exist (not yet supported for the web). You need to add `loadEarlier` prop too.
* **`isStatusBarTranslucentAndroid`** _(Bool)_ - If you use translucent status bar on Android, set this option to true. Ignored on iOS.

## Notes for [Redux](https://github.com/reactjs/redux)

Expand Down
5 changes: 4 additions & 1 deletion src/GiftedChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
/* infinite scroll up when reach the top of messages container, automatically call onLoadEarlier function if exist */
infiniteScroll?: boolean
timeTextStyle?: LeftRightStyle<TextStyle>
/** If you use translucent status bar on Android, set this option to true. Ignored on iOS. */
isStatusBarTranslucentAndroid?: boolean
/* Custom action sheet */
actionSheet?(): {
showActionSheetWithOptions: (
Expand Down Expand Up @@ -259,6 +261,7 @@ function GiftedChat<TMessage extends IMessage = IMessage> (
inverted = true,
minComposerHeight = MIN_COMPOSER_HEIGHT,
maxComposerHeight = MAX_COMPOSER_HEIGHT,
isStatusBarTranslucentAndroid,
} = props

const actionSheetRef = useRef<ActionSheetProviderRef>(null)
Expand All @@ -282,7 +285,7 @@ function GiftedChat<TMessage extends IMessage = IMessage> (
const [text, setText] = useState<string | undefined>(() => props.text || '')
const [isTypingDisabled, setIsTypingDisabled] = useState<boolean>(false)

const keyboard = useAnimatedKeyboard()
const keyboard = useAnimatedKeyboard({ isStatusBarTranslucentAndroid })
const trackingKeyboardMovement = useSharedValue(false)
const debounceEnableTypingTimeoutId = useRef<ReturnType<typeof setTimeout>>()
const insets = useSafeAreaInsets()
Expand Down

0 comments on commit f03bfa9

Please sign in to comment.