mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 15:02:42 +01:00
minor reorg/cleanup
This commit is contained in:
@@ -4,18 +4,18 @@ import colors from '@app/styles/colors'
|
||||
import GradientBackground, { GradientBackgroundProps } from '@app/components/GradientBackground'
|
||||
import { useLayout } from '@react-native-community/hooks'
|
||||
import NothingHere from './NothingHere'
|
||||
import ImageGradientBackground, { ImageGradientBackgroundProps } from './ImageGradientBackground'
|
||||
import GradientImageBackground, { GradientImageBackgroundProps } from './GradientImageBackground'
|
||||
|
||||
export type BackgroundHeaderFlatListPropsBase<ItemT> = FlatListProps<ItemT> & {
|
||||
export type GradientBackgroundHeaderFlatListPropsBase<ItemT> = FlatListProps<ItemT> & {
|
||||
contentMarginTop?: number
|
||||
}
|
||||
|
||||
export type BackgroundHeaderFlatListProp<ItemT> = BackgroundHeaderFlatListPropsBase<ItemT> & {
|
||||
BackgroundComponent: typeof ImageGradientBackground | typeof GradientBackground
|
||||
backgroundProps?: ImageGradientBackgroundProps | GradientBackgroundProps
|
||||
export type GradientBackgroundHeaderFlatListProp<ItemT> = GradientBackgroundHeaderFlatListPropsBase<ItemT> & {
|
||||
BackgroundComponent: typeof GradientImageBackground | typeof GradientBackground
|
||||
backgroundProps?: GradientImageBackgroundProps | GradientBackgroundProps
|
||||
}
|
||||
|
||||
function BackgroundHeaderFlatList<ItemT>(props: BackgroundHeaderFlatListProp<ItemT>) {
|
||||
function GradientBackgroundHeaderFlatList<ItemT>(props: GradientBackgroundHeaderFlatListProp<ItemT>) {
|
||||
const window = useWindowDimensions()
|
||||
const headerLayout = useLayout()
|
||||
|
||||
@@ -51,4 +51,4 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
})
|
||||
|
||||
export default BackgroundHeaderFlatList
|
||||
export default GradientBackgroundHeaderFlatList
|
||||
@@ -1,13 +1,15 @@
|
||||
import GradientBackground, { GradientBackgroundProps } from '@app/components/GradientBackground'
|
||||
import React from 'react'
|
||||
import BackgroundHeaderFlatList, { BackgroundHeaderFlatListPropsBase } from './BackgroundHeaderFlatList'
|
||||
import GradientBackgroundHeaderFlatList, {
|
||||
GradientBackgroundHeaderFlatListPropsBase,
|
||||
} from './GradientBackgroundHeaderFlatList'
|
||||
|
||||
export type GradientFlatListProps<ItemT> = BackgroundHeaderFlatListPropsBase<ItemT> & {
|
||||
export type GradientFlatListProps<ItemT> = GradientBackgroundHeaderFlatListPropsBase<ItemT> & {
|
||||
backgroundProps?: GradientBackgroundProps
|
||||
}
|
||||
|
||||
function GradientFlatList<ItemT>(props: GradientFlatListProps<ItemT>) {
|
||||
return <BackgroundHeaderFlatList BackgroundComponent={GradientBackground} {...props} />
|
||||
return <GradientBackgroundHeaderFlatList BackgroundComponent={GradientBackground} {...props} />
|
||||
}
|
||||
|
||||
export default GradientFlatList
|
||||
|
||||
@@ -5,12 +5,12 @@ import { AndroidImageColors } from 'react-native-image-colors/lib/typescript/typ
|
||||
import colors from '@app/styles/colors'
|
||||
import GradientBackground, { GradientBackgroundPropsBase } from '@app/components/GradientBackground'
|
||||
|
||||
export type ImageGradientBackgroundProps = GradientBackgroundPropsBase & {
|
||||
export type GradientImageBackgroundProps = GradientBackgroundPropsBase & {
|
||||
imagePath?: string
|
||||
onGetColor?: (color: string) => void
|
||||
}
|
||||
|
||||
const ImageGradientBackground: React.FC<ImageGradientBackgroundProps> = ({
|
||||
const GradientImageBackground: React.FC<GradientImageBackgroundProps> = ({
|
||||
height,
|
||||
width,
|
||||
position,
|
||||
@@ -83,4 +83,4 @@ const ImageGradientBackground: React.FC<ImageGradientBackgroundProps> = ({
|
||||
)
|
||||
}
|
||||
|
||||
export default ImageGradientBackground
|
||||
export default GradientImageBackground
|
||||
15
app/components/GradientImageFlatList.tsx
Normal file
15
app/components/GradientImageFlatList.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import React from 'react'
|
||||
import GradientBackgroundHeaderFlatList, {
|
||||
GradientBackgroundHeaderFlatListPropsBase,
|
||||
} from './GradientBackgroundHeaderFlatList'
|
||||
import GradientImageBackground, { GradientImageBackgroundProps } from './GradientImageBackground'
|
||||
|
||||
export type GradientImageFlatListProps<ItemT> = GradientBackgroundHeaderFlatListPropsBase<ItemT> & {
|
||||
backgroundProps?: GradientImageBackgroundProps
|
||||
}
|
||||
|
||||
function GradientImageFlatList<ItemT>(props: GradientImageFlatListProps<ItemT>) {
|
||||
return <GradientBackgroundHeaderFlatList BackgroundComponent={GradientImageBackground} {...props} />
|
||||
}
|
||||
|
||||
export default GradientImageFlatList
|
||||
@@ -1,11 +1,11 @@
|
||||
import ImageGradientBackground, { ImageGradientBackgroundProps } from '@app/components/ImageGradientBackground'
|
||||
import GradientImageBackground, { GradientImageBackgroundProps } from '@app/components/GradientImageBackground'
|
||||
import colors from '@app/styles/colors'
|
||||
import dimensions from '@app/styles/dimensions'
|
||||
import React from 'react'
|
||||
import { ScrollView, ScrollViewProps, useWindowDimensions } from 'react-native'
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
||||
|
||||
const ImageGradientScrollView: React.FC<ScrollViewProps & ImageGradientBackgroundProps> = props => {
|
||||
const GradientImageScrollView: React.FC<ScrollViewProps & GradientImageBackgroundProps> = props => {
|
||||
const layout = useWindowDimensions()
|
||||
const paddingTop = useSafeAreaInsets().top
|
||||
|
||||
@@ -22,10 +22,10 @@ const ImageGradientScrollView: React.FC<ScrollViewProps & ImageGradientBackgroun
|
||||
},
|
||||
]}
|
||||
contentContainerStyle={[{ minHeight }, props.contentContainerStyle]}>
|
||||
<ImageGradientBackground height={minHeight} imagePath={props.imagePath} onGetColor={props.onGetColor} />
|
||||
<GradientImageBackground height={minHeight} imagePath={props.imagePath} onGetColor={props.onGetColor} />
|
||||
{props.children}
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
|
||||
export default ImageGradientScrollView
|
||||
export default GradientImageScrollView
|
||||
@@ -1,13 +0,0 @@
|
||||
import React from 'react'
|
||||
import BackgroundHeaderFlatList, { BackgroundHeaderFlatListPropsBase } from './BackgroundHeaderFlatList'
|
||||
import ImageGradientBackground, { ImageGradientBackgroundProps } from './ImageGradientBackground'
|
||||
|
||||
export type ImageGradientFlatListProps<ItemT> = BackgroundHeaderFlatListPropsBase<ItemT> & {
|
||||
backgroundProps?: ImageGradientBackgroundProps
|
||||
}
|
||||
|
||||
function ImageGradientFlatList<ItemT>(props: ImageGradientFlatListProps<ItemT>) {
|
||||
return <BackgroundHeaderFlatList BackgroundComponent={ImageGradientBackground} {...props} />
|
||||
}
|
||||
|
||||
export default ImageGradientFlatList
|
||||
Reference in New Issue
Block a user