about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/App.native.tsx5
-rw-r--r--src/view/com/util/PostMeta.tsx19
-rw-r--r--src/view/shell/mobile/MainMenu.tsx10
-rw-r--r--src/view/shell/mobile/index.tsx5
4 files changed, 25 insertions, 14 deletions
diff --git a/src/App.native.tsx b/src/App.native.tsx
index e6be77225..3d3e5f1b0 100644
--- a/src/App.native.tsx
+++ b/src/App.native.tsx
@@ -3,6 +3,7 @@ import React, {useState, useEffect} from 'react'
 import {RootSiblingParent} from 'react-native-root-siblings'
 import {GestureHandlerRootView} from 'react-native-gesture-handler'
 import SplashScreen from 'react-native-splash-screen'
+import {SafeAreaProvider} from 'react-native-safe-area-context'
 import {whenWebCrypto} from './platform/polyfills.native'
 import * as view from './view/index'
 import {RootStoreModel, setupState, RootStoreProvider} from './state'
@@ -35,7 +36,9 @@ function App() {
     <GestureHandlerRootView style={{flex: 1}}>
       <RootSiblingParent>
         <RootStoreProvider value={rootStore}>
-          <MobileShell />
+          <SafeAreaProvider>
+            <MobileShell />
+          </SafeAreaProvider>
         </RootStoreProvider>
       </RootSiblingParent>
     </GestureHandlerRootView>
diff --git a/src/view/com/util/PostMeta.tsx b/src/view/com/util/PostMeta.tsx
index a9cf74e1c..95dfcbd64 100644
--- a/src/view/com/util/PostMeta.tsx
+++ b/src/view/com/util/PostMeta.tsx
@@ -1,5 +1,5 @@
-import React from 'react'
-import {StyleSheet, Text, View} from 'react-native'
+import React, {useMemo} from 'react'
+import {StyleSheet, useWindowDimensions, Text, View} from 'react-native'
 import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
 import {Link} from '../util/Link'
 import {PostDropdownBtn} from '../util/DropdownBtn'
@@ -16,11 +16,16 @@ interface PostMetaOpts {
 }
 
 export function PostMeta(opts: PostMetaOpts) {
+  const winDim = useWindowDimensions()
+  const maxWidth = useMemo(
+    () => ({maxWidth: ((winDim.width * 3) / 5) | 0}),
+    [winDim.width],
+  )
   return (
     <View style={styles.meta}>
-      <View style={styles.metaNames}>
+      <View style={[styles.metaNames, maxWidth]}>
         <Link
-          style={styles.metaItem}
+          style={[styles.metaItem, maxWidth]}
           href={opts.authorHref}
           title={opts.authorHandle}>
           <Text style={[s.f17, s.bold]} numberOfLines={1}>
@@ -28,7 +33,7 @@ export function PostMeta(opts: PostMetaOpts) {
           </Text>
         </Link>
         <Link
-          style={styles.metaItem}
+          style={[styles.metaItem, maxWidth]}
           href={opts.authorHref}
           title={opts.authorHandle}>
           <Text style={[s.f15, s.gray5]} numberOfLines={1}>
@@ -37,7 +42,7 @@ export function PostMeta(opts: PostMetaOpts) {
         </Link>
       </View>
       <Text style={[styles.metaItem, s.f15, s.gray5]}>
-        &middot; {ago(opts.timestamp)}
+        {ago(opts.timestamp)}
       </Text>
       <View style={s.flex1} />
       <PostDropdownBtn
@@ -61,11 +66,9 @@ const styles = StyleSheet.create({
     flexDirection: 'row',
     flexWrap: 'wrap',
     alignItems: 'center',
-    maxWidth: 240,
     overflow: 'hidden',
   },
   metaItem: {
-    maxWidth: 240,
     paddingRight: 5,
   },
 })
diff --git a/src/view/shell/mobile/MainMenu.tsx b/src/view/shell/mobile/MainMenu.tsx
index 874b8786f..d05e70a81 100644
--- a/src/view/shell/mobile/MainMenu.tsx
+++ b/src/view/shell/mobile/MainMenu.tsx
@@ -8,6 +8,7 @@ import {
   TouchableWithoutFeedback,
   View,
 } from 'react-native'
+import {useSafeAreaInsets} from 'react-native-safe-area-context'
 import Animated, {
   useSharedValue,
   useAnimatedStyle,
@@ -27,6 +28,7 @@ export const MainMenu = observer(
   ({active, onClose}: {active: boolean; onClose: () => void}) => {
     const store = useStores()
     const initInterp = useSharedValue<number>(0)
+    const insets = useSafeAreaInsets()
 
     useEffect(() => {
       if (active) {
@@ -167,7 +169,12 @@ export const MainMenu = observer(
         <TouchableWithoutFeedback onPress={onClose}>
           <View style={styles.bg} />
         </TouchableWithoutFeedback>
-        <Animated.View style={[styles.wrapper, wrapperAnimStyle]}>
+        <Animated.View
+          style={[
+            styles.wrapper,
+            {bottom: insets.bottom + 55},
+            wrapperAnimStyle,
+          ]}>
           <SafeAreaView>
             <View style={[styles.topSection]}>
               <TouchableOpacity
@@ -251,7 +258,6 @@ const styles = StyleSheet.create({
   wrapper: {
     position: 'absolute',
     top: 0,
-    bottom: 75,
     width: '100%',
     backgroundColor: '#fff',
   },
diff --git a/src/view/shell/mobile/index.tsx b/src/view/shell/mobile/index.tsx
index 96390e9b8..94407599f 100644
--- a/src/view/shell/mobile/index.tsx
+++ b/src/view/shell/mobile/index.tsx
@@ -220,7 +220,7 @@ export const MobileShell: React.FC = observer(() => {
           </ScreenContainer>
         </GestureDetector>
       </SafeAreaView>
-      <View style={styles.bottomBar}>
+      <SafeAreaView style={styles.bottomBar}>
         <Btn icon="house" onPress={onPressHome} />
         <Btn icon="search" onPress={onPressSearch} />
         <Btn icon="menu" onPress={onPressMenu} />
@@ -230,7 +230,7 @@ export const MobileShell: React.FC = observer(() => {
           notificationCount={store.me.notificationCount}
         />
         <Btn icon={['far', 'clone']} onPress={onPressTabs} />
-      </View>
+      </SafeAreaView>
       <MainMenu
         active={isMainMenuActive}
         onClose={() => setMainMenuActive(false)}
@@ -373,7 +373,6 @@ const styles = StyleSheet.create({
     borderTopColor: colors.gray2,
     paddingLeft: 5,
     paddingRight: 15,
-    paddingBottom: 20,
   },
   ctrl: {
     flex: 1,