-
Notifications
You must be signed in to change notification settings - Fork 905
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Release v0.3.1-beta.0 (#2515)
- Loading branch information
Showing
166 changed files
with
8,656 additions
and
1,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { atom } from "jotai" | ||
|
||
export const loadingVisibleAtom = atom(false) | ||
|
||
export const loadingAtom = atom<{ | ||
finish?: null | (() => any) | ||
cancel?: null | (() => any) | ||
error?: null | ((err: any) => any) | ||
done?: null | ((r: unknown) => any) | ||
thenable: null | Promise<any> | ||
}>({ | ||
finish: null, | ||
cancel: null, | ||
error: null, | ||
done: null, | ||
thenable: null, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { FullWindowOverlay } from "react-native-screens" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Fragment as FullWindowOverlay } from "react" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { cn } from "@follow/utils" | ||
import { useTheme } from "@react-navigation/native" | ||
import type { StyleProp, TextProps, TextStyle } from "react-native" | ||
import { Animated, Platform, StyleSheet, Text, View } from "react-native" | ||
|
||
type Props = Omit<TextProps, "style"> & { | ||
tintColor?: string | ||
children?: string | ||
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>> | ||
subText?: string | ||
subTextStyle?: StyleProp<TextStyle> | ||
subTextClassName?: string | ||
} | ||
|
||
export function HeaderTitleExtra({ | ||
tintColor, | ||
style, | ||
subText, | ||
subTextStyle, | ||
subTextClassName, | ||
...rest | ||
}: Props) { | ||
const { colors, fonts } = useTheme() | ||
|
||
return ( | ||
<View> | ||
<Animated.Text | ||
accessibilityRole="header" | ||
aria-level="1" | ||
numberOfLines={1} | ||
{...rest} | ||
style={[ | ||
{ color: tintColor === undefined ? colors.text : tintColor }, | ||
Platform.select({ ios: fonts.bold, default: fonts.medium }), | ||
styles.title, | ||
style, | ||
]} | ||
/> | ||
<Text | ||
className={cn("text-text/50 text-center text-xs", subTextClassName)} | ||
style={subTextStyle} | ||
> | ||
{subText} | ||
</Text> | ||
</View> | ||
) | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
title: Platform.select({ | ||
ios: { | ||
fontSize: 17, | ||
}, | ||
android: { | ||
fontSize: 20, | ||
}, | ||
default: { | ||
fontSize: 18, | ||
}, | ||
}), | ||
}) |
45 changes: 44 additions & 1 deletion
45
apps/mobile/src/components/common/ModalSharedComponents.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,61 @@ | ||
import { withOpacity } from "@follow/utils" | ||
import { router } from "expo-router" | ||
import { TouchableOpacity } from "react-native" | ||
|
||
import { useIsRouteOnlyOne } from "@/src/hooks/useIsRouteOnlyOne" | ||
import { CheckLineIcon } from "@/src/icons/check_line" | ||
import { CloseCuteReIcon } from "@/src/icons/close_cute_re" | ||
import { MingcuteLeftLineIcon } from "@/src/icons/mingcute_left_line" | ||
import { useColor } from "@/src/theme/colors" | ||
|
||
import { RotateableLoading } from "./RotateableLoading" | ||
|
||
export const ModalHeaderCloseButton = () => { | ||
return <ModalHeaderCloseButtonImpl /> | ||
} | ||
|
||
const ModalHeaderCloseButtonImpl = () => { | ||
const label = useColor("label") | ||
|
||
const routeOnlyOne = useIsRouteOnlyOne() | ||
|
||
return ( | ||
<TouchableOpacity onPress={() => router.dismiss()}> | ||
<CloseCuteReIcon color={label} /> | ||
{routeOnlyOne ? ( | ||
<CloseCuteReIcon height={20} width={20} color={label} /> | ||
) : ( | ||
<MingcuteLeftLineIcon height={20} width={20} color={label} /> | ||
)} | ||
</TouchableOpacity> | ||
) | ||
} | ||
|
||
export interface ModalHeaderShubmitButtonProps { | ||
isValid: boolean | ||
onPress: () => void | ||
isLoading?: boolean | ||
} | ||
export const ModalHeaderShubmitButton = ({ | ||
isValid, | ||
onPress, | ||
isLoading, | ||
}: ModalHeaderShubmitButtonProps) => { | ||
return <ModalHeaderShubmitButtonImpl isValid={isValid} onPress={onPress} isLoading={isLoading} /> | ||
} | ||
|
||
const ModalHeaderShubmitButtonImpl = ({ | ||
isValid, | ||
onPress, | ||
isLoading, | ||
}: ModalHeaderShubmitButtonProps) => { | ||
const label = useColor("label") | ||
return ( | ||
<TouchableOpacity onPress={onPress} disabled={!isValid || isLoading}> | ||
{isLoading ? ( | ||
<RotateableLoading size={20} color={withOpacity(label, 0.5)} /> | ||
) : ( | ||
<CheckLineIcon height={20} width={20} color={isValid ? label : withOpacity(label, 0.5)} /> | ||
)} | ||
</TouchableOpacity> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { FC } from "react" | ||
import { useEffect } from "react" | ||
import Animated, { | ||
Easing, | ||
useAnimatedStyle, | ||
useSharedValue, | ||
withRepeat, | ||
withTiming, | ||
} from "react-native-reanimated" | ||
|
||
import { Loading3CuteReIcon } from "@/src/icons/loading_3_cute_re" | ||
|
||
export interface RotateableLoadingProps { | ||
size?: number | ||
color?: string | ||
} | ||
export const RotateableLoading: FC<RotateableLoadingProps> = ({ size = 36, color = "#fff" }) => { | ||
const rotate = useSharedValue(0) | ||
useEffect(() => { | ||
rotate.value = withRepeat( | ||
withTiming(360, { duration: 1000, easing: Easing.linear }), | ||
Infinity, | ||
false, | ||
) | ||
return () => { | ||
rotate.value = 0 | ||
} | ||
}, [rotate]) | ||
|
||
const rotateStyle = useAnimatedStyle(() => ({ | ||
transform: [{ rotate: `${rotate.value}deg` }], | ||
})) | ||
|
||
return ( | ||
<Animated.View style={rotateStyle}> | ||
<Loading3CuteReIcon height={size} width={size} color={color} /> | ||
</Animated.View> | ||
) | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createContext, useContext } from "react" | ||
import type { FieldValues, UseFormReturn } from "react-hook-form" | ||
|
||
const FormContext = createContext<UseFormReturn<any> | null>(null) | ||
|
||
export function FormProvider<T extends FieldValues>(props: { | ||
form: UseFormReturn<T> | ||
children: React.ReactNode | ||
}) { | ||
return <FormContext.Provider value={props.form}>{props.children}</FormContext.Provider> | ||
} | ||
|
||
export function useFormContext<T extends FieldValues>() { | ||
const context = useContext(FormContext) | ||
if (!context) { | ||
throw new Error("useFormContext must be used within a FormProvider") | ||
} | ||
return context as UseFormReturn<T> | ||
} |
Oops, something went wrong.