File tree Expand file tree Collapse file tree
pages/musicDetail/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,13 +3,13 @@ import { StyleSheet, View } from "react-native";
33import Image from "./image" ;
44import useColors from "@/hooks/useColors" ;
55import Theme from "@/core/theme" ;
6- import { useSafeAreaInsets } from "react-native-safe-area-context " ;
6+ import useBackgroundInsets from "@/hooks/useBackgroundInsets " ;
77
88function PageBackground ( ) {
99 const theme = Theme . useTheme ( ) ;
1010 const background = Theme . useBackground ( ) ;
1111 const colors = useColors ( ) ;
12- const insets = useSafeAreaInsets ( ) ;
12+ const backgroundInsets = useBackgroundInsets ( ) ;
1313
1414 return (
1515 < >
@@ -19,10 +19,7 @@ function PageBackground() {
1919 {
2020 backgroundColor :
2121 colors ?. pageBackground ?? colors . background ,
22- top : - insets . top ,
23- bottom : - insets . bottom ,
24- left : - insets . left ,
25- right : - insets . right ,
22+ ...backgroundInsets ,
2623 } ,
2724 ] }
2825 />
@@ -33,10 +30,7 @@ function PageBackground() {
3330 style . wrapper ,
3431 {
3532 opacity : background ?. opacity ?? 0.6 ,
36- top : - insets . top ,
37- bottom : - insets . bottom ,
38- left : - insets . left ,
39- right : - insets . right ,
33+ ...backgroundInsets ,
4034 } ,
4135 ] }
4236 blurRadius = { background ?. blur ?? 20 }
Original file line number Diff line number Diff line change 1+ import { useSafeAreaInsets } from "react-native-safe-area-context" ;
2+
3+ /**
4+ * Hook that returns negative safe area insets for extending backgrounds
5+ * beyond safe area boundaries to cover the entire screen.
6+ */
7+ export default function useBackgroundInsets ( ) {
8+ const insets = useSafeAreaInsets ( ) ;
9+
10+ return {
11+ top : - insets . top ,
12+ bottom : - insets . bottom ,
13+ left : - insets . left ,
14+ right : - insets . right ,
15+ } ;
16+ }
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ import React, { useMemo } from "react";
22import { Image , StyleSheet , View } from "react-native" ;
33import { ImgAsset } from "@/constants/assetsConst" ;
44import { useCurrentMusic } from "@/core/trackPlayer" ;
5- import { useSafeAreaInsets } from "react-native-safe-area-context " ;
5+ import useBackgroundInsets from "@/hooks/useBackgroundInsets " ;
66
77export default function Background ( ) {
88 const musicItem = useCurrentMusic ( ) ;
9- const insets = useSafeAreaInsets ( ) ;
9+ const backgroundInsets = useBackgroundInsets ( ) ;
1010
1111 const artworkSource = useMemo ( ( ) => {
1212 if ( ! musicItem ?. artwork ) {
@@ -26,22 +26,12 @@ export default function Background() {
2626 < >
2727 < View style = { [
2828 style . background ,
29- {
30- top : - insets . top ,
31- bottom : - insets . bottom ,
32- left : - insets . left ,
33- right : - insets . right ,
34- }
29+ backgroundInsets
3530 ] } />
3631 < Image
3732 style = { [
3833 style . blur ,
39- {
40- top : - insets . top ,
41- bottom : - insets . bottom ,
42- left : - insets . left ,
43- right : - insets . right ,
44- }
34+ backgroundInsets
4535 ] }
4636 blurRadius = { 50 }
4737 source = { artworkSource }
You can’t perform that action at this time.
0 commit comments