38 lines
795 B
TypeScript
38 lines
795 B
TypeScript
import { StyleSheet, Text, View } from "react-native";
|
|
|
|
export type PriceDisplayProps = {
|
|
price: number,
|
|
currency?: {
|
|
symbol: string,
|
|
}
|
|
}
|
|
|
|
export default function PriceDisplay({ price }: PriceDisplayProps) {
|
|
|
|
|
|
|
|
return (
|
|
<View style={styles.bigPriceWrapper} aria-label="calculated price">
|
|
<Text style={styles.bigPrice}>$ {price.toLocaleString(
|
|
undefined, {
|
|
minimumFractionDigits: 2,
|
|
maximumFractionDigits: 2,
|
|
}
|
|
)}</Text>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
|
|
|
|
export const styles = StyleSheet.create({
|
|
bigPriceWrapper: {
|
|
alignContent: "center",
|
|
},
|
|
bigPrice: {
|
|
alignSelf: "center",
|
|
fontSize: 40,
|
|
marginTop: 50,
|
|
marginBottom: 50,
|
|
}
|
|
}); |