From 04c63859b486590d737f15bb8f2c87566786815d Mon Sep 17 00:00:00 2001 From: Geraint White Date: Thu, 22 Dec 2022 15:43:48 +0000 Subject: [PATCH] Add review text style prop --- src/TapRating.tsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/TapRating.tsx b/src/TapRating.tsx index a1a23f2..6ee6a18 100644 --- a/src/TapRating.tsx +++ b/src/TapRating.tsx @@ -2,7 +2,7 @@ import _ from "lodash"; import React, { useState, useEffect } from "react"; -import { StyleSheet, Text, View, StyleProp, ViewStyle } from "react-native"; +import { StyleSheet, Text, View, StyleProp, ViewStyle, TextStyle } from "react-native"; import Star from "./components/Star"; @@ -66,6 +66,13 @@ export type TapRatingProps = { */ ratingContainerStyle?: StyleProp; + /** + * Style for review text + * + * Default is none + */ + reviewTextStyle?: StyleProp; + /** * Callback method when the user finishes rating. Gives you the final rating value as a whole number */ @@ -141,6 +148,12 @@ const TapRating: React.FunctionComponent = props => { ratingContainerStyle.push( props.ratingContainerStyle ); } + const reviewTextStyle = [styles.reviewText, { fontSize: reviewSize, color: reviewColor }]; + + if ( props.reviewTextStyle ) { + reviewTextStyle.push( props.reviewTextStyle ); + } + _.times( count, index => { rating_array.push( = props => { return ( {showRating && - + {reviews[position - 1]} }