fix(mobile): adapt account forms and unfolded Duo player
This commit is contained in:
2 files changed
+26
-12
No files matched your search
@@ -74,11 +74,15 @@ const DISMISS_VELOCITY = 900
|
||||
const DISMISS_CORNER_RADIUS = 48
|
||||
|
||||
export default function PlayerScreen() {
|
||||
const isTablet = useTabletLayout()
|
||||
const tabletLayout = useTabletLayout()
|
||||
const router = useRouter()
|
||||
const hadSongRef = useRef(false)
|
||||
const insets = useSafeAreaInsets()
|
||||
const { width: windowWidth, height: windowHeight } = useWindowDimensions()
|
||||
// Unfolded iPhones retain the phone idiom but have room for the iPad player.
|
||||
const isTablet =
|
||||
tabletLayout ||
|
||||
(Platform.OS === "ios" && Math.min(windowWidth, windowHeight) >= 600)
|
||||
const { config } = useServerConfig()
|
||||
const {
|
||||
currentSong,
|
||||
|
||||
@@ -3,30 +3,40 @@ import {
|
||||
KeyboardAvoidingView,
|
||||
Platform,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
type StyleProp,
|
||||
type ViewStyle,
|
||||
} from "react-native"
|
||||
|
||||
/** Android resizes for the IME; scrolling keeps tall forms and actions reachable. */
|
||||
/** Center account forms on wide windows; scroll when the keyboard reduces height. */
|
||||
export function KeyboardForm({
|
||||
children,
|
||||
style,
|
||||
}: PropsWithChildren<{ style?: StyleProp<ViewStyle> }>) {
|
||||
if (Platform.OS === "android") {
|
||||
return (
|
||||
return (
|
||||
<KeyboardAvoidingView
|
||||
behavior={Platform.OS === "ios" ? "padding" : undefined}
|
||||
style={styles.fill}
|
||||
>
|
||||
<ScrollView
|
||||
style={{ flex: 1 }}
|
||||
contentContainerStyle={[style, { flex: undefined, flexGrow: 1 }]}
|
||||
style={styles.fill}
|
||||
contentContainerStyle={[style, styles.content]}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
keyboardDismissMode="on-drag"
|
||||
keyboardDismissMode={Platform.OS === "ios" ? "interactive" : "on-drag"}
|
||||
>
|
||||
{children}
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
return (
|
||||
<KeyboardAvoidingView behavior="padding" style={style}>
|
||||
{children}
|
||||
</KeyboardAvoidingView>
|
||||
)
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
fill: { flex: 1 },
|
||||
content: {
|
||||
flex: undefined,
|
||||
flexGrow: 1,
|
||||
width: "100%",
|
||||
maxWidth: 528,
|
||||
alignSelf: "center",
|
||||
},
|
||||
})
|
||||
Reference in new issue
Block a user