feature & fix
deskripsi: feature: - floating button - Forum create fix: - Base box - Avatar : penambahan onPres & href - Text custom : penambahan warna props green - Text Area : penambhaan hight - ViewWrapper : penambahan props floating # No Issue "
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { MainColor } from "@/constants/color-palet";
|
||||
import DUMMY_IMAGE from "@/constants/dummy-image-value";
|
||||
import { Image, ImageSourcePropType, StyleSheet } from "react-native";
|
||||
import { Href, router } from "expo-router";
|
||||
import {
|
||||
Image,
|
||||
ImageSourcePropType,
|
||||
StyleSheet,
|
||||
TouchableOpacity,
|
||||
} from "react-native";
|
||||
|
||||
type Size = "base" | "sm" | "md" | "lg" | "xl";
|
||||
|
||||
interface AvatarCustomProps {
|
||||
source?: ImageSourcePropType;
|
||||
size?: Size;
|
||||
onPress?: () => void;
|
||||
href?: Href | undefined;
|
||||
}
|
||||
|
||||
const sizeMap = {
|
||||
@@ -20,24 +29,42 @@ const sizeMap = {
|
||||
export default function AvatarCustom({
|
||||
source = DUMMY_IMAGE.avatar,
|
||||
size = "base",
|
||||
onPress,
|
||||
href,
|
||||
}: AvatarCustomProps) {
|
||||
const dimension = sizeMap[size];
|
||||
|
||||
const ImageView = ({source}: {source: ImageSourcePropType}) => {
|
||||
return (
|
||||
<Image
|
||||
source={source}
|
||||
style={[
|
||||
// styles.overlappingAvatar,
|
||||
{
|
||||
width: dimension,
|
||||
height: dimension,
|
||||
borderRadius: dimension / 2,
|
||||
},
|
||||
]}
|
||||
resizeMode="cover"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Image
|
||||
source={source}
|
||||
style={[
|
||||
styles.overlappingAvatar,
|
||||
{
|
||||
width: dimension,
|
||||
height: dimension,
|
||||
borderRadius: dimension / 2,
|
||||
},
|
||||
]}
|
||||
resizeMode="cover"
|
||||
/>
|
||||
<>
|
||||
{onPress || href ? (
|
||||
<TouchableOpacity
|
||||
onPress={href ? () => router.navigate(href as any) : onPress}
|
||||
>
|
||||
<ImageView source={source} />
|
||||
</TouchableOpacity>
|
||||
) : (
|
||||
<ImageView source={source} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
|
||||
Reference in New Issue
Block a user