Darkmode fixes (#301) (#327)

* Fix dark mode rendering of 'follows you' pill

* Fix the darkmode coloring of the PTR

* Fix dark mode styles in dns instructions

* Only lint the src dir
zio/stable
Paul Frazee 2023-03-20 14:53:59 -05:00 committed by GitHub
parent d9ed13ea90
commit 4f9e9e609e
11 changed files with 90 additions and 28 deletions

View File

@ -14,7 +14,7 @@
"test-watch": "jest --watchAll", "test-watch": "jest --watchAll",
"test-ci": "jest --ci --forceExit --reporters=default --reporters=jest-junit", "test-ci": "jest --ci --forceExit --reporters=default --reporters=jest-junit",
"test-coverage": "jest --coverage", "test-coverage": "jest --coverage",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx", "lint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
"e2e": "detox test --configuration ios.sim.debug --take-screenshots all" "e2e": "detox test --configuration ios.sim.debug --take-screenshots all"
}, },
"dependencies": { "dependencies": {

View File

@ -363,7 +363,7 @@ function CustomHandleForm({
Add the following record to your domain: Add the following record to your domain:
</Text> </Text>
<View style={[styles.dnsTable, pal.btn]}> <View style={[styles.dnsTable, pal.btn]}>
<Text type="md-medium" style={styles.dnsLabel}> <Text type="md-medium" style={[styles.dnsLabel, pal.text]}>
Domain: Domain:
</Text> </Text>
<View style={[styles.dnsValue]}> <View style={[styles.dnsValue]}>
@ -371,7 +371,7 @@ function CustomHandleForm({
_atproto.{handle} _atproto.{handle}
</Text> </Text>
</View> </View>
<Text type="md-medium" style={styles.dnsLabel}> <Text type="md-medium" style={[styles.dnsLabel, pal.text]}>
Type: Type:
</Text> </Text>
<View style={[styles.dnsValue]}> <View style={[styles.dnsValue]}>
@ -379,7 +379,7 @@ function CustomHandleForm({
TXT TXT
</Text> </Text>
</View> </View>
<Text type="md-medium" style={styles.dnsLabel}> <Text type="md-medium" style={[styles.dnsLabel, pal.text]}>
Value: Value:
</Text> </Text>
<View style={[styles.dnsValue]}> <View style={[styles.dnsValue]}>
@ -415,7 +415,7 @@ function CustomHandleForm({
{isVerifying ? ( {isVerifying ? (
<ActivityIndicator color="white" /> <ActivityIndicator color="white" />
) : ( ) : (
<Text type="xl-medium" style={[pal.textInverted, s.textCenter]}> <Text type="xl-medium" style={[s.white, s.textCenter]}>
{canSave ? `Update to ${handle}` : 'Verify DNS Record'} {canSave ? `Update to ${handle}` : 'Verify DNS Record'}
</Text> </Text>
)} )}

View File

@ -1,7 +1,7 @@
import React, {MutableRefObject} from 'react' import React, {MutableRefObject} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {CenteredView, FlatList} from '../util/Views' import {CenteredView, FlatList} from '../util/Views'
import {ActivityIndicator, StyleSheet, View} from 'react-native' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native'
import {NotificationsViewModel} from 'state/models/notifications-view' import {NotificationsViewModel} from 'state/models/notifications-view'
import {FeedItem} from './FeedItem' import {FeedItem} from './FeedItem'
import {NotificationFeedLoadingPlaceholder} from '../util/LoadingPlaceholder' import {NotificationFeedLoadingPlaceholder} from '../util/LoadingPlaceholder'
@ -9,6 +9,7 @@ import {ErrorMessage} from '../util/error/ErrorMessage'
import {EmptyState} from '../util/EmptyState' import {EmptyState} from '../util/EmptyState'
import {OnScrollCb} from 'lib/hooks/useOnMainScroll' import {OnScrollCb} from 'lib/hooks/useOnMainScroll'
import {s} from 'lib/styles' import {s} from 'lib/styles'
import {usePalette} from 'lib/hooks/usePalette'
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'} const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
@ -23,6 +24,7 @@ export const Feed = observer(function Feed({
onPressTryAgain?: () => void onPressTryAgain?: () => void
onScroll?: OnScrollCb onScroll?: OnScrollCb
}) { }) {
const pal = usePalette('default')
const data = React.useMemo(() => { const data = React.useMemo(() => {
let feedItems let feedItems
if (view.hasLoaded) { if (view.hasLoaded) {
@ -98,8 +100,14 @@ export const Feed = observer(function Feed({
keyExtractor={item => item._reactKey} keyExtractor={item => item._reactKey}
renderItem={renderItem} renderItem={renderItem}
ListFooterComponent={FeedFooter} ListFooterComponent={FeedFooter}
refreshing={view.isRefreshing} refreshControl={
onRefresh={onRefresh} <RefreshControl
refreshing={view.isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
onEndReached={onEndReached} onEndReached={onEndReached}
onEndReachedThreshold={0.6} onEndReachedThreshold={0.6}
onScroll={onScroll} onScroll={onScroll}

View File

@ -1,6 +1,6 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, StyleSheet, View} from 'react-native' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views' import {CenteredView, FlatList} from '../util/Views'
import { import {
RepostedByViewModel, RepostedByViewModel,
@ -9,12 +9,14 @@ import {
import {ProfileCardWithFollowBtn} from '../profile/ProfileCard' import {ProfileCardWithFollowBtn} from '../profile/ProfileCard'
import {ErrorMessage} from '../util/error/ErrorMessage' import {ErrorMessage} from '../util/error/ErrorMessage'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {usePalette} from 'lib/hooks/usePalette'
export const PostRepostedBy = observer(function PostRepostedBy({ export const PostRepostedBy = observer(function PostRepostedBy({
uri, uri,
}: { }: {
uri: string uri: string
}) { }) {
const pal = usePalette('default')
const store = useStores() const store = useStores()
const view = React.useMemo( const view = React.useMemo(
() => new RepostedByViewModel(store, {uri}), () => new RepostedByViewModel(store, {uri}),
@ -73,8 +75,14 @@ export const PostRepostedBy = observer(function PostRepostedBy({
<FlatList <FlatList
data={view.repostedBy} data={view.repostedBy}
keyExtractor={item => item.did} keyExtractor={item => item.did}
refreshing={view.isRefreshing} refreshControl={
onRefresh={onRefresh} <RefreshControl
refreshing={view.isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
onEndReached={onEndReached} onEndReached={onEndReached}
renderItem={renderItem} renderItem={renderItem}
initialNumToRender={15} initialNumToRender={15}

View File

@ -1,6 +1,6 @@
import React, {useRef} from 'react' import React, {useRef} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, StyleSheet, View} from 'react-native' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views' import {CenteredView, FlatList} from '../util/Views'
import { import {
PostThreadViewModel, PostThreadViewModel,
@ -120,8 +120,14 @@ export const PostThread = observer(function PostThread({
initialNumToRender={posts.length} initialNumToRender={posts.length}
keyExtractor={item => item._reactKey} keyExtractor={item => item._reactKey}
renderItem={renderItem} renderItem={renderItem}
refreshing={isRefreshing} refreshControl={
onRefresh={onRefresh} <RefreshControl
refreshing={isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
onLayout={onLayout} onLayout={onLayout}
onScrollToIndexFailed={onScrollToIndexFailed} onScrollToIndexFailed={onScrollToIndexFailed}
style={s.hContentRegion} style={s.hContentRegion}

View File

@ -1,11 +1,12 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, StyleSheet, View} from 'react-native' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views' import {CenteredView, FlatList} from '../util/Views'
import {VotesViewModel, VoteItem} from 'state/models/votes-view' import {VotesViewModel, VoteItem} from 'state/models/votes-view'
import {ErrorMessage} from '../util/error/ErrorMessage' import {ErrorMessage} from '../util/error/ErrorMessage'
import {ProfileCardWithFollowBtn} from '../profile/ProfileCard' import {ProfileCardWithFollowBtn} from '../profile/ProfileCard'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {usePalette} from 'lib/hooks/usePalette'
export const PostVotedBy = observer(function PostVotedBy({ export const PostVotedBy = observer(function PostVotedBy({
uri, uri,
@ -14,6 +15,7 @@ export const PostVotedBy = observer(function PostVotedBy({
uri: string uri: string
direction: 'up' | 'down' direction: 'up' | 'down'
}) { }) {
const pal = usePalette('default')
const store = useStores() const store = useStores()
const view = React.useMemo( const view = React.useMemo(
() => new VotesViewModel(store, {uri, direction}), () => new VotesViewModel(store, {uri, direction}),
@ -68,8 +70,14 @@ export const PostVotedBy = observer(function PostVotedBy({
<FlatList <FlatList
data={view.votes} data={view.votes}
keyExtractor={item => item.actor.did} keyExtractor={item => item.actor.did}
refreshing={view.isRefreshing} refreshControl={
onRefresh={onRefresh} <RefreshControl
refreshing={view.isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
onEndReached={onEndReached} onEndReached={onEndReached}
renderItem={renderItem} renderItem={renderItem}
initialNumToRender={15} initialNumToRender={15}

View File

@ -2,9 +2,10 @@ import React, {MutableRefObject} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import { import {
ActivityIndicator, ActivityIndicator,
View, RefreshControl,
StyleProp, StyleProp,
StyleSheet, StyleSheet,
View,
ViewStyle, ViewStyle,
} from 'react-native' } from 'react-native'
import {CenteredView, FlatList} from '../util/Views' import {CenteredView, FlatList} from '../util/Views'
@ -16,6 +17,7 @@ import {FeedSlice} from './FeedSlice'
import {OnScrollCb} from 'lib/hooks/useOnMainScroll' import {OnScrollCb} from 'lib/hooks/useOnMainScroll'
import {s} from 'lib/styles' import {s} from 'lib/styles'
import {useAnalytics} from 'lib/analytics' import {useAnalytics} from 'lib/analytics'
import {usePalette} from 'lib/hooks/usePalette'
const HEADER_ITEM = {_reactKey: '__header__'} const HEADER_ITEM = {_reactKey: '__header__'}
const EMPTY_FEED_ITEM = {_reactKey: '__empty__'} const EMPTY_FEED_ITEM = {_reactKey: '__empty__'}
@ -42,6 +44,7 @@ export const Feed = observer(function Feed({
testID?: string testID?: string
headerOffset?: number headerOffset?: number
}) { }) {
const pal = usePalette('default')
const {track} = useAnalytics() const {track} = useAnalytics()
const [isRefreshing, setIsRefreshing] = React.useState(false) const [isRefreshing, setIsRefreshing] = React.useState(false)
@ -134,10 +137,16 @@ export const Feed = observer(function Feed({
keyExtractor={item => item._reactKey} keyExtractor={item => item._reactKey}
renderItem={renderItem} renderItem={renderItem}
ListFooterComponent={FeedFooter} ListFooterComponent={FeedFooter}
refreshing={isRefreshing} refreshControl={
<RefreshControl
refreshing={isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
contentContainerStyle={s.contentContainer} contentContainerStyle={s.contentContainer}
onScroll={onScroll} onScroll={onScroll}
onRefresh={onRefresh}
onEndReached={onEndReached} onEndReached={onEndReached}
onEndReachedThreshold={0.6} onEndReachedThreshold={0.6}
removeClippedSubviews={true} removeClippedSubviews={true}

View File

@ -62,7 +62,9 @@ export function ProfileCard({
{isFollowedBy && ( {isFollowedBy && (
<View style={s.flexRow}> <View style={s.flexRow}>
<View style={[s.mt5, pal.btn, styles.pill]}> <View style={[s.mt5, pal.btn, styles.pill]}>
<Text type="xs">Follows You</Text> <Text type="xs" style={pal.text}>
Follows You
</Text>
</View> </View>
</View> </View>
)} )}

View File

@ -1,6 +1,6 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, StyleSheet, View} from 'react-native' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native'
import { import {
UserFollowersViewModel, UserFollowersViewModel,
FollowerItem, FollowerItem,
@ -9,12 +9,14 @@ import {CenteredView, FlatList} from '../util/Views'
import {ErrorMessage} from '../util/error/ErrorMessage' import {ErrorMessage} from '../util/error/ErrorMessage'
import {ProfileCardWithFollowBtn} from './ProfileCard' import {ProfileCardWithFollowBtn} from './ProfileCard'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {usePalette} from 'lib/hooks/usePalette'
export const ProfileFollowers = observer(function ProfileFollowers({ export const ProfileFollowers = observer(function ProfileFollowers({
name, name,
}: { }: {
name: string name: string
}) { }) {
const pal = usePalette('default')
const store = useStores() const store = useStores()
const view = React.useMemo( const view = React.useMemo(
() => new UserFollowersViewModel(store, {user: name}), () => new UserFollowersViewModel(store, {user: name}),
@ -73,8 +75,14 @@ export const ProfileFollowers = observer(function ProfileFollowers({
<FlatList <FlatList
data={view.followers} data={view.followers}
keyExtractor={item => item.did} keyExtractor={item => item.did}
refreshing={view.isRefreshing} refreshControl={
onRefresh={onRefresh} <RefreshControl
refreshing={view.isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
onEndReached={onEndReached} onEndReached={onEndReached}
renderItem={renderItem} renderItem={renderItem}
initialNumToRender={15} initialNumToRender={15}

View File

@ -1,17 +1,19 @@
import React, {useEffect} from 'react' import React, {useEffect} from 'react'
import {observer} from 'mobx-react-lite' import {observer} from 'mobx-react-lite'
import {ActivityIndicator, StyleSheet, View} from 'react-native' import {ActivityIndicator, RefreshControl, StyleSheet, View} from 'react-native'
import {CenteredView, FlatList} from '../util/Views' import {CenteredView, FlatList} from '../util/Views'
import {UserFollowsViewModel, FollowItem} from 'state/models/user-follows-view' import {UserFollowsViewModel, FollowItem} from 'state/models/user-follows-view'
import {ErrorMessage} from '../util/error/ErrorMessage' import {ErrorMessage} from '../util/error/ErrorMessage'
import {ProfileCardWithFollowBtn} from './ProfileCard' import {ProfileCardWithFollowBtn} from './ProfileCard'
import {useStores} from 'state/index' import {useStores} from 'state/index'
import {usePalette} from 'lib/hooks/usePalette'
export const ProfileFollows = observer(function ProfileFollows({ export const ProfileFollows = observer(function ProfileFollows({
name, name,
}: { }: {
name: string name: string
}) { }) {
const pal = usePalette('default')
const store = useStores() const store = useStores()
const view = React.useMemo( const view = React.useMemo(
() => new UserFollowsViewModel(store, {user: name}), () => new UserFollowsViewModel(store, {user: name}),
@ -70,8 +72,14 @@ export const ProfileFollows = observer(function ProfileFollows({
<FlatList <FlatList
data={view.follows} data={view.follows}
keyExtractor={item => item.did} keyExtractor={item => item.did}
refreshing={view.isRefreshing} refreshControl={
onRefresh={onRefresh} <RefreshControl
refreshing={view.isRefreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}
onEndReached={onEndReached} onEndReached={onEndReached}
renderItem={renderItem} renderItem={renderItem}
initialNumToRender={15} initialNumToRender={15}

View File

@ -201,7 +201,12 @@ export const SearchScreen = withAuthRequired(
onScroll={onMainScroll} onScroll={onMainScroll}
scrollEventThrottle={100} scrollEventThrottle={100}
refreshControl={ refreshControl={
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} /> <RefreshControl
refreshing={refreshing}
onRefresh={onRefresh}
tintColor={pal.colors.text}
titleColor={pal.colors.text}
/>
}> }>
{foafsView.isLoading ? ( {foafsView.isLoading ? (
<ProfileCardFeedLoadingPlaceholder /> <ProfileCardFeedLoadingPlaceholder />