This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAY-1319] Fix emoji keyboard overlapping chat text input
- Loading branch information
1 parent
54e3e34
commit 01953ef
Showing
6 changed files
with
88 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { CommonState } from 'store/commonStore' | ||
|
||
export const getBottomTabBarHeight = (state: CommonState) => | ||
state.ui.bottomTabBar.bottomTabBarHeight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { createSlice, PayloadAction } from '@reduxjs/toolkit' | ||
|
||
export type BottomTabBarState = { | ||
bottomTabBarHeight: number | ||
} | ||
|
||
const initialState: BottomTabBarState = { | ||
bottomTabBarHeight: 0 | ||
} | ||
|
||
const slice = createSlice({ | ||
name: 'ui/bottom-tab-bar', | ||
initialState, | ||
reducers: { | ||
setBottomTabBarHeight: ( | ||
state, | ||
action: PayloadAction<{ | ||
height: number | ||
}> | ||
) => { | ||
const { height } = action.payload | ||
state.bottomTabBarHeight = height | ||
} | ||
} | ||
}) | ||
|
||
export const { setBottomTabBarHeight } = slice.actions | ||
export const actions = slice.actions | ||
export default slice.reducer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,60 @@ | ||
import { useRef } from 'react' | ||
import { useCallback, useRef } from 'react' | ||
|
||
import { bottomTabBarUIActions } from '@audius/common' | ||
import type { BottomTabBarProps } from '@react-navigation/bottom-tabs' | ||
import { Animated } from 'react-native' | ||
import { Animated, Dimensions, View } from 'react-native' | ||
import { useDispatch } from 'react-redux' | ||
|
||
import { BottomTabBar } from 'app/components/bottom-tab-bar' | ||
import { FULL_DRAWER_HEIGHT } from 'app/components/drawer' | ||
import { NowPlayingDrawer } from 'app/components/now-playing-drawer' | ||
import { makeStyles } from 'app/styles' | ||
|
||
const { setBottomTabBarHeight } = bottomTabBarUIActions | ||
|
||
const useStyles = makeStyles(({ palette }) => ({ | ||
bottomBarContainer: { | ||
zIndex: 4, | ||
elevation: 4 | ||
} | ||
})) | ||
|
||
type TabBarProps = BottomTabBarProps | ||
|
||
const screenHeight = Dimensions.get('screen').height | ||
|
||
export const AppTabBar = (props: TabBarProps) => { | ||
const { navigation, state } = props | ||
const styles = useStyles() | ||
const dispatch = useDispatch() | ||
// Set handlers for the NowPlayingDrawer and BottomTabBar | ||
// When the drawer is open, the bottom bar should hide (animated away). | ||
// When the drawer is closed, the bottom bar should reappear (animated in). | ||
const translationAnim = useRef(new Animated.Value(FULL_DRAWER_HEIGHT)).current | ||
|
||
const viewRef = useRef<View | null>(null) | ||
const handleOnLayout = useCallback(() => { | ||
if (viewRef.current) { | ||
viewRef.current.measure((x, y, width, height, pageX, pageY) => { | ||
dispatch(setBottomTabBarHeight({ height: screenHeight - pageY })) | ||
}) | ||
} | ||
}, [dispatch]) | ||
|
||
return ( | ||
<> | ||
<NowPlayingDrawer translationAnim={translationAnim} /> | ||
<BottomTabBar | ||
translationAnim={translationAnim} | ||
navigation={navigation} | ||
state={state} | ||
/> | ||
<View | ||
style={styles.bottomBarContainer} | ||
onLayout={handleOnLayout} | ||
ref={viewRef} | ||
> | ||
<BottomTabBar | ||
translationAnim={translationAnim} | ||
navigation={navigation} | ||
state={state} | ||
/> | ||
</View> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters