-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Small changes following faster global search pr #1320
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import { View, StyleSheet } from 'react-native'; | |
import { createShimmerPlaceholder } from 'react-native-shimmer-placeholder'; | ||
import { LinearGradient } from 'expo-linear-gradient'; | ||
import { ThemeColors } from '@theme/types'; | ||
import getLoadingColors from '@utils/getLoadingColors'; | ||
import useLoadingColors from '@utils/useLoadingColors'; | ||
import { useAppSettings, useTheme } from '@hooks/persisted/index'; | ||
|
||
interface Props { | ||
|
@@ -22,7 +22,7 @@ const LoadingShimmer = memo( | |
}) => { | ||
const { disableLoadingAnimations } = useAppSettings(); | ||
const theme = useTheme(); | ||
const [highlightColor, backgroundColor] = getLoadingColors(theme); | ||
const [highlightColor, backgroundColor] = useLoadingColors(theme); | ||
const ShimmerPlaceHolder = createShimmerPlaceholder(LinearGradient); | ||
|
||
return ( | ||
|
@@ -68,7 +68,7 @@ const NovelInformation = memo(() => ( | |
</View> | ||
)); | ||
|
||
const ChapterItem = memo(({ index }: { index: number }) => ( | ||
const ChapterItem = memo(() => ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lint was mad at unused variable so i removed it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe lint gives problems because Traitor latest commit bypassed lint verification. |
||
<View style={styles.chapter}> | ||
<LoadingShimmer style={styles.text} height={20} width={350} /> | ||
<LoadingShimmer style={styles.text} height={16} width={350} /> | ||
|
@@ -83,12 +83,12 @@ const Chapters = memo(() => ( | |
width={350} | ||
/> | ||
{[...Array(7)].map((_, i) => ( | ||
<ChapterItem key={i} index={i} /> | ||
<ChapterItem key={i} /> | ||
))} | ||
</View> | ||
)); | ||
|
||
const NovelScreenLoading: React.FC<Props> = ({ theme }) => { | ||
const NovelScreenLoading: React.FC<Props> = () => { | ||
return ( | ||
<View style={styles.container}> | ||
<NovelTop /> | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ThemeColors } from '@theme/types'; | ||
import color from 'color'; | ||
import { useAppSettings } from '@hooks/persisted'; | ||
import { interpolateColor } from 'react-native-reanimated'; | ||
|
||
const useLoadingColors = (theme: ThemeColors) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. renamed to use cus of the useAppSettings inside |
||
const highlightColor = color(theme.primary).alpha(0.08).string(); | ||
const backgroundColor = color(theme.surface); | ||
|
||
let adjustedBackgroundColor; | ||
|
||
if (backgroundColor.isDark()) { | ||
adjustedBackgroundColor = | ||
backgroundColor.luminosity() !== 0 | ||
? backgroundColor.lighten(0.1).toString() | ||
: backgroundColor.negate().darken(0.98).toString(); | ||
} else { | ||
adjustedBackgroundColor = backgroundColor.darken(0.04).toString(); | ||
} | ||
|
||
const { disableLoadingAnimations } = useAppSettings(); | ||
|
||
if (disableLoadingAnimations) { | ||
//If loading animations is disabled highlight color is never shown so make background color more visible to compensate | ||
adjustedBackgroundColor = interpolateColor( | ||
0.01, //I have no idea why the interpolation amount has to be so small, I think its cus of the massive difference in alpha | ||
[0, 1], | ||
[adjustedBackgroundColor, highlightColor], | ||
); | ||
} | ||
|
||
return [highlightColor, adjustedBackgroundColor]; | ||
}; | ||
export default useLoadingColors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
most phones should be able to handle 3 and the first few concurrency increases makes a massive difference in loading time so may as well increase default