From b6d2e43d3d0f4e102add25bd4114b08e662be50f Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Wed, 27 Oct 2021 07:34:47 +0530 Subject: [PATCH] Add bottom inset padding --- App.js | 11 +- src/components/Common.js | 27 +- src/screens/browse/SettingsBrowseScreen.js | 5 +- .../library/components/LibraryBottomSheet.js | 9 +- src/screens/more/MoreScreen.js | 230 +++++++++--------- .../novel/components/NovelBottomSheet.js | 9 +- .../novel/components/Tracker/TrackSheet.js | 9 +- .../ReaderBottomSheet/ReaderBottomSheet.js | 5 +- .../reader/components/ReaderSeekBar.js | 6 +- 9 files changed, 174 insertions(+), 137 deletions(-) diff --git a/App.js b/App.js index 5957b8f1..e31f4ef4 100644 --- a/App.js +++ b/App.js @@ -12,6 +12,7 @@ import Main from './src/navigators/Main'; import {createDB} from './src/database/DBHelper'; import {fonts} from './src/theme/fonts'; +import {SafeAreaProvider} from 'react-native-safe-area-context'; const App = () => { const [loaded] = useFonts(fonts); @@ -28,10 +29,12 @@ const App = () => { return ( - - -
- + + + +
+ + ); diff --git a/src/components/Common.js b/src/components/Common.js index 78a81378..24841745 100644 --- a/src/components/Common.js +++ b/src/components/Common.js @@ -1,17 +1,22 @@ import React from 'react'; import {View, StyleSheet} from 'react-native'; +import {useSafeAreaInsets} from 'react-native-safe-area-context'; -const ScreenContainer = ({children, theme}) => ( - - {children} - -); +const ScreenContainer = ({children, theme}) => { + const {bottom} = useSafeAreaInsets(); + + return ( + + {children} + + ); +}; const Row = ({children, style}) => ( {children} diff --git a/src/screens/browse/SettingsBrowseScreen.js b/src/screens/browse/SettingsBrowseScreen.js index cfca3fc6..b69174f7 100644 --- a/src/screens/browse/SettingsBrowseScreen.js +++ b/src/screens/browse/SettingsBrowseScreen.js @@ -2,6 +2,7 @@ import React from 'react'; import {FlatList, Pressable, StyleSheet, Text, View} from 'react-native'; import {Switch} from 'react-native-paper'; +import {useSafeAreaInsets} from 'react-native-safe-area-context'; import {useDispatch, useSelector} from 'react-redux'; import {Appbar} from '../../components/Appbar'; @@ -18,6 +19,8 @@ const BrowseSettings = ({navigation}) => { const theme = useTheme(); const dispatch = useDispatch(); + const {bottom} = useSafeAreaInsets(); + const {filters = [], showMyAnimeList = true} = useSelector( state => state.sourceReducer, ); @@ -59,7 +62,7 @@ const BrowseSettings = ({navigation}) => { item} renderItem={renderItem} diff --git a/src/screens/library/components/LibraryBottomSheet.js b/src/screens/library/components/LibraryBottomSheet.js index aec746b9..0c1e6b7a 100644 --- a/src/screens/library/components/LibraryBottomSheet.js +++ b/src/screens/library/components/LibraryBottomSheet.js @@ -15,6 +15,7 @@ import {useSettings} from '../../../hooks/reduxHooks'; import {setAppSettings} from '../../../redux/settings/settings.actions'; import {Checkbox, SortItem} from '../../../components/Checkbox/Checkbox'; import {RadioButton} from '../../../components/RadioButton/RadioButton'; +import {useSafeAreaInsets} from 'react-native-safe-area-context'; const LibrarySheet = ({ bottomSheetRef, @@ -26,6 +27,10 @@ const LibrarySheet = ({ }) => { const [animatedValue] = useState(new Animated.Value(0)); + const {bottom} = useSafeAreaInsets(); + + const bottomSheetHeight = 460 + bottom; + const FirstRoute = () => ( { return ( - - - - - - - Downloaded only - - - Filters all novels in your library - + + + + + + + + Downloaded only + + + Filters all novels in your library + + - - - - - - - - - Incognito mode - - - Pauses reading history - + + + + + + + + Incognito mode + + + Pauses reading history + + - - + + + 0 && downloadQueue.length + ' remaining' + } + icon="progress-download" + onPress={() => + navigation.navigate('MoreStack', { + screen: 'DownloadQueue', + }) + } + theme={theme} /> - - - 0 && downloadQueue.length + ' remaining' - } - icon="progress-download" - onPress={() => - navigation.navigate('MoreStack', { - screen: 'DownloadQueue', - }) - } - theme={theme} - /> - - navigation.navigate('MoreStack', { - screen: 'Downloads', - }) - } - theme={theme} - /> - - - navigation.navigate('MoreStack', { - screen: 'SettingsStack', - }) - } - theme={theme} - /> - - - navigation.navigate('MoreStack', { - screen: 'About', - }) - } - theme={theme} - /> - + + navigation.navigate('MoreStack', { + screen: 'Downloads', + }) + } + theme={theme} + /> + + + navigation.navigate('MoreStack', { + screen: 'SettingsStack', + }) + } + theme={theme} + /> + + navigation.navigate('MoreStack', { + screen: 'About', + }) + } + theme={theme} + /> + + ); }; diff --git a/src/screens/novel/components/NovelBottomSheet.js b/src/screens/novel/components/NovelBottomSheet.js index dc56d090..df1cdb9e 100644 --- a/src/screens/novel/components/NovelBottomSheet.js +++ b/src/screens/novel/components/NovelBottomSheet.js @@ -6,6 +6,7 @@ import { Animated, useWindowDimensions, } from 'react-native'; +import {useSafeAreaInsets} from 'react-native-safe-area-context'; import {TabView, SceneMap, TabBar} from 'react-native-tab-view'; import Bottomsheet from 'rn-sliding-up-panel'; @@ -24,6 +25,10 @@ const ChaptersSettingsSheet = ({ theme, showChapterTitles, }) => { + const {bottom} = useSafeAreaInsets(); + + const bottomSheetHeight = 220 + bottom; + const sortChapters = val => dispatch(sortAndFilterChapters(novelId, val, filter)); @@ -145,8 +150,8 @@ const ChaptersSettingsSheet = ({ { const tracker = useSelector(state => state.trackerReducer.tracker); @@ -19,6 +20,8 @@ const TrackSheet = ({bottomSheetRef, novelId, novelName, theme}) => { ); const dispatch = useDispatch(); + const {bottom} = useSafeAreaInsets(); + const [trackItem, setTrackItem] = useState(); useEffect(() => { @@ -103,12 +106,14 @@ const TrackSheet = ({bottomSheetRef, novelId, novelName, theme}) => { setTrackScoreDialog(false); }; + const bottomSheetHeight = 120 + bottom; + return ( <> { + const {bottom} = useSafeAreaInsets(); + const [animatedValue] = useState(new Animated.Value(0)); const presetThemes = [ @@ -73,7 +76,7 @@ const ReaderSheet = ({ ]} > - + { + const {bottom} = useSafeAreaInsets(); + const onSlidingComplete = value => { setLoading(true); scrollViewRef.current.scrollTo({ @@ -76,7 +79,7 @@ const VerticalScrollbar = ({