|
1 |
| -import React from 'react'; |
| 1 | +import React, {Component} from 'react'; |
2 | 2 | import {StyleProp, StyleSheet, ViewStyle} from 'react-native';
|
3 |
| -import { |
4 |
| - BaseComponent, |
5 |
| - Colors, |
6 |
| - Spacings, |
7 |
| - Text, |
8 |
| - TouchableOpacity, |
9 |
| - TouchableOpacityProps, |
10 |
| - Typography, |
11 |
| - View |
12 |
| -} from 'react-native-ui-lib'; |
13 | 3 | import _ from 'lodash';
|
| 4 | +import * as Modifiers from '../../commons/modifiers'; |
| 5 | +import {Colors, Spacings, Typography} from 'style'; |
| 6 | +import View from '../view'; |
| 7 | +import Text from '../text'; |
| 8 | +import TouchableOpacity, {TouchableOpacityProps} from '../touchableOpacity'; |
14 | 9 | import Image, {ImageProps} from '../image';
|
15 | 10 |
|
16 | 11 | export interface GridItemProps {
|
@@ -109,16 +104,15 @@ interface RenderContentType {
|
109 | 104 | typography?: string;
|
110 | 105 | color?: string;
|
111 | 106 | numberOfLines?: number;
|
112 |
| - style?: StyleProp<ViewStyle>, |
113 |
| - testID?: string |
| 107 | + style?: StyleProp<ViewStyle>; |
| 108 | + testID?: string; |
114 | 109 | }
|
115 | 110 |
|
116 | 111 | /**
|
117 | 112 | * @description: A single grid view/list item component
|
118 | 113 | * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx
|
119 | 114 | */
|
120 |
| -class GridListItem extends BaseComponent<GridItemProps> { |
121 |
| - |
| 115 | +class GridListItem extends Component<GridItemProps> { |
122 | 116 | static displayName = 'GridListItem';
|
123 | 117 |
|
124 | 118 | static defaultProps = {
|
@@ -195,15 +189,14 @@ class GridListItem extends BaseComponent<GridItemProps> {
|
195 | 189 | style={[styles.container, alignToStart && styles.containerAlignedToStart, {width}, containerStyle]}
|
196 | 190 | onPress={hasPress ? this.onItemPress : undefined}
|
197 | 191 | accessible={renderCustomItem ? true : undefined}
|
198 |
| - {...this.extractAccessibilityProps()} |
| 192 | + {...Modifiers.extractAccessibilityProps(this.props)} |
199 | 193 | >
|
200 |
| - {imageProps && |
201 |
| - <View |
202 |
| - style={[{borderRadius: imageBorderRadius}, imageStyle]} |
203 |
| - > |
204 |
| - <Image style={imageStyle} {...imageProps}/> |
205 |
| - {children} |
206 |
| - </View>} |
| 194 | + {imageProps && ( |
| 195 | + <View style={[{borderRadius: imageBorderRadius}, imageStyle]}> |
| 196 | + <Image style={imageStyle} {...imageProps}/> |
| 197 | + {children} |
| 198 | + </View> |
| 199 | + )} |
207 | 200 | {!_.isNil(renderCustomItem) && <View style={{width}}>{renderCustomItem()}</View>}
|
208 | 201 | {hasOverlay && <View style={[styles.overlay, this.getItemSizeObj()]}>{renderOverlay?.()}</View>}
|
209 | 202 | <TextContainer {...textContainerStyle}>
|
|
0 commit comments