react-native-elements#Rating TypeScript Examples
The following examples show how to use
react-native-elements#Rating.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProductItem.component.tsx From RNWCShop with GNU General Public License v3.0 | 6 votes |
_renderBrowseDetail = ({ product, addToCart = noop }: Props): JSX.Element => ( <> <HTML html={product.description} textSelectable renderers={{ p: (_: never, children: Array<string>): JSX.Element => ( <Text numberOfLines={2}>{children}</Text> ) }} /> <View style={styles.actionView}> <Rating readonly imageSize={14} startingValue={Number(product.average_rating)} // @ts-ignore style={styles.rating} /> <Button icon={{ name: 'cart-plus', type: 'font-awesome-5', color: 'white', size: 16 }} onPress={(): void => addToCart(product)} /> </View> </> )
Example #2
Source File: ProductItem.component.tsx From react-native-woocommerce with MIT License | 6 votes |
_renderBrowseDetail = ({ product, addToCart }: Props): JSX.Element => ( <> <HTML html={product.description} textSelectable renderers={{ p: (_: never, children: Array<string>): JSX.Element => <Text numberOfLines={2}>{children}</Text> }} /> <View style={styles.actionView}> <Rating readonly imageSize={16} startingValue={Number(product.average_rating)} // @ts-ignore style={styles.rating} /> <Button icon={{ name: 'cart-plus', type: 'font-awesome-5', color: 'white', size: 16 }} onPress={(): void => addToCart(product)} /> {/* <Icon*/} {/* name='cart-plus'*/} {/* type='font-awesome-5'*/} {/* onPress={(): void => addToCart(product)}*/} {/* />*/} </View> </> )
Example #3
Source File: Detail.component.tsx From RNWCShop with GNU General Public License v3.0 | 5 votes |
render(): JSX.Element {
const {
product,
imagesShown,
handleShowImages,
addToCart = () => {}
} = this.props;
const {
name,
images,
description,
price,
average_rating: rating
} = product;
return (
<ScrollView style={styles.wrapper}>
<Carousel
ref={this._setCarousel}
sliderWidth={screenWidth}
sliderHeight={screenWidth}
itemWidth={screenWidth - 60}
data={this._mapImages(images)}
renderItem={this._renderImageItem(handleShowImages)}
hasParallaxImages
/>
<View style={styles.detail}>
<Text style={styles.textTitle}>{name}</Text>
<Text style={styles.textPrice}>{toAmount(price)}</Text>
<HTML html={description} textSelectable />
<View style={styles.rating}>
<Text style={styles.textSubHeading}>Rating:</Text>
<Text style={styles.textRating}>{rating}</Text>
<Rating readonly imageSize={20} startingValue={Number(rating)} />
</View>
<Button
icon={{
name: 'cart-plus',
type: 'font-awesome-5',
color: 'white',
size: 16
}}
title="Add to cart"
onPress={(): void => addToCart(product)}
/>
</View>
<Modal visible={imagesShown} transparent>
{this._renderImages(images, handleShowImages)}
</Modal>
</ScrollView>
);
}
Example #4
Source File: Product.component.tsx From react-native-woocommerce with MIT License | 5 votes |
render(): JSX.Element {
const {
product: { name, images, description, price, average_rating: rating },
imagesShown,
handleShowImages,
} = this.props;
return (
<View style={styles.wrapper}>
<Carousel
ref={this._setCarousel}
sliderWidth={screenWidth}
sliderHeight={screenWidth}
itemWidth={screenWidth - 60}
data={this._mapImages(images)}
renderItem={this._renderImageItem(handleShowImages)}
hasParallaxImages
/>
<View style={styles.detail}>
<Text style={styles.textTitle}>{name}</Text>
<Text style={styles.textPrice}>{toAmount(price)}</Text>
<HTML
html={description}
textSelectable
/>
<View style={styles.rating}>
<Text style={styles.textSubHeading}>Rating:</Text>
<Text style={styles.textRating}>{rating}</Text>
<Rating
readonly
imageSize={20}
startingValue={Number(rating)}
/>
</View>
</View>
<Modal visible={imagesShown} transparent>
{this._renderImages(images, handleShowImages)}
</Modal>
</View>
);
}