Answer the question
In order to leave comments, you need to log in
How to prevent re-rendering?
Hello, I am facing the following problem:
VirtualizedList: You have a large list that is slow to update
Everything in PureComponent
<Carousel
scrollInterpolator={ scrollInterpolators[`scrollInterpolator${4}`]} <- Анимация
slideInterpolatedStyle={animatedStyles[`animatedStyles${4}`]} <- Анимация
windowSize={1}
firstItem={this.state.activeSlide} <- Текущий номер элемента
sliderWidth={screenWidth} <- Ширина слайдера
itemWidth={screenWidth} <- Ширина объекта внутри
data={this.state.dataObject} <- Массив
renderItem={this._renderItem} <- Объект который рендерится в карусели
onSnapToItem={index => this.setState({ activeSlide: index })} <- Пагинация
/>
return (
<View
style={{
paddingBottom: 14,
paddingTop: 8,
flex: 1,
paddingHorizontal: 8,
width: w
}}
>
<ItemCard
data={item}
StatusObj={
item.status === "C" ? (
<Ionicons name="ios-lock" size={28} color="#4B1E70" />
) : item.status === "O" ? (
<Ionicons name="ios-unlock" size={28} color="red" />
) : item.status === "N" ? (
<Ionicons
name="ios-help-circle-outline"
size={28}
color="#4B1E70"
/>
) : null
}
onLock={() =>
_showModal(
this.setState({
idSideObj: item.idSite,
visibleModal: false
})
)
}
CurrentName={_CurrentSet(
(itemCard = _dataObject[_ActiveSlide].name),
(aliasName = _dataObject[_ActiveSlide].aliasName)
)}
WidthProps={w}
GoCamera={() => this.props.navigation.navigate(CAMERAVIEW)}
nameItem={item.aliasName === "" ? item.name : item.aliasName}
TimeStatus={item.timeOfStatus}
imageRender={_CheckIconSetting(
(CurrentSiteID = _dataObject[_ActiveSlide].address),
(itemCard = _dataObject[_ActiveSlide].name),
(aliasName = _dataObject[_ActiveSlide].aliasName)
)}
onClick={() =>
this.props.navigation.navigate(EDITPAGE, {
ObjectName: item.aliasName === "" ? item.name : item.aliasName,
ImageName: item.user,
CurrentAddress: item.address,
CurrentSiteObj: item.idSite,
CurrentImageSite: this.state[item.address],
ObjectImage:
item.type === 2
? MiniimageHomeObject
: item.type === 3
? MiniimageWorkObject
: item.type === 4
? MiniimageCarObject
: item.type === 1
? MiniimageFlatObject
: item.type === 5
? MiniimageTruckObject
: null,
onGoBack: this.onGoBack
})
}
ImageItem={this.state[item.address]}
ImageItemReq={
item.type === 2
? imageHomeObject
: item.type === 3
? imageWorkObject
: item.type === 4
? imageCarObject
: item.type === 1
? imageFlatObject
: item.type === 5
? imageTruckObject
: null
}
CurrentItem={item.type}
/>
</View>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question