Skip to content

Commit 1b11d02

Browse files
committed
Fix imports in GridView and GridListItem components
1 parent f33c42d commit 1b11d02

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

src/components/GridListItem/index.tsx renamed to src/components/gridListItem_/index.tsx

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1-
import React from 'react';
1+
import React, {Component} from 'react';
22
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';
133
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';
149
import Image, {ImageProps} from '../image';
1510

1611
export interface GridItemProps {
@@ -109,16 +104,15 @@ interface RenderContentType {
109104
typography?: string;
110105
color?: string;
111106
numberOfLines?: number;
112-
style?: StyleProp<ViewStyle>,
113-
testID?: string
107+
style?: StyleProp<ViewStyle>;
108+
testID?: string;
114109
}
115110

116111
/**
117112
* @description: A single grid view/list item component
118113
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/GridViewScreen.tsx
119114
*/
120-
class GridListItem extends BaseComponent<GridItemProps> {
121-
115+
class GridListItem extends Component<GridItemProps> {
122116
static displayName = 'GridListItem';
123117

124118
static defaultProps = {
@@ -195,15 +189,14 @@ class GridListItem extends BaseComponent<GridItemProps> {
195189
style={[styles.container, alignToStart && styles.containerAlignedToStart, {width}, containerStyle]}
196190
onPress={hasPress ? this.onItemPress : undefined}
197191
accessible={renderCustomItem ? true : undefined}
198-
{...this.extractAccessibilityProps()}
192+
{...Modifiers.extractAccessibilityProps(this.props)}
199193
>
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+
)}
207200
{!_.isNil(renderCustomItem) && <View style={{width}}>{renderCustomItem()}</View>}
208201
{hasOverlay && <View style={[styles.overlay, this.getItemSizeObj()]}>{renderOverlay?.()}</View>}
209202
<TextContainer {...textContainerStyle}>

src/components/GridView/index.tsx renamed to src/components/gridView_/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
import _ from 'lodash';
22
import React from 'react';
33
import {StyleSheet} from 'react-native';
4-
import {Colors, Constants, Spacings, Text, UIComponent, View} from 'react-native-ui-lib';
4+
// TODO: we should use asBaseComponent here instead of using UIComponent directly
5+
import {UIComponent} from 'react-native-ui-lib';
6+
import {Colors, Spacings} from 'style';
7+
import View from '../view';
8+
import Text from '../text';
9+
import {Constants} from 'helpers';
510
import GridListItem, {GridItemProps} from '../GridListItem';
611
import {formatLastItemLabel} from '../../helpers/FormattingPresenter';
712

0 commit comments

Comments
 (0)