Skip to content

Flatlist continuous scroll heats IOS device #25775

Closed
@BasilJohn

Description

@BasilJohn

Flatlist scroll heats device on IOS

React Native version:
0.59.5

Steps To Reproduce

1.Created a flat list Component
2.Fetched data from api and rendered the list

Describe what you expected to happen:

The device should not get heated when scrolling up and down within the screen

class NotificationComponent extends Component {
constructor(props) {
super(props);
// All local states for read and write purposes has been declared here
this.state = {
// dashBoardData: null,
// activeSlide: 0,
notifications: [],
lazyNotifications: [],
notifcationReaded: [],
showLoader: true,
goToDetail: false,
disabledCardTap: false,
page: 0,
loading: true,
data: [],
page: 1,
seed: 1,
error: null,
refreshing: false
};
}

/* **************************
Function: componentDidMount()
Explanation:

Creator: Jose || Date: 2018-09-26
************************** */
componentDidMount() {

this.getNotification();

}

getNotification=()=>{

const { page, seed } = this.state;
const url = `https://randomuser.me/api/?seed=${seed}&page=${page}&results=20`;
this.setState({ loading: true });

fetch(url)
  .then(res => res.json())
  .then(res => {
    this.setState({
      data: page === 1 ? res.results : [...this.state.data, ...res.results],
      error: res.error || null,
      loading: false,
      refreshing: false
    });
  })
  .catch(error => {
    this.setState({ error, loading: false });
  });

}

handleEnd=()=>{

this.setState(
  {
    page: this.state.page + 1
  },
  () => {
    this.getNotification();
  }
);

}

getFlatList = () => {
// const styles = createStyle();
return (
<FlatList
data={this.state.data}
renderItem={({ item }) => (

)}
extraData={this.state}
keyExtractor={item => item.email}
onEndReached={this.handleEnd}
onEndReachedThreshold={50}
removeClippedSubviews
// ListFooterComponent={() => this.state.loading
// ?
// : null
// }
/>
)
}

render() {
// const styles = createStyle()
// const commonStyleVal = createCommonStyles()
return (

{this.getFlatList()}

);
}
}

--GLIST Item Code
import React, { PureComponent } from 'react';
import { I18nManager, Platform, View, ViewPropTypes } from 'react-native';
import PropTypes from 'prop-types';

export default class GListItem extends PureComponent {

constructor (props) {
    super(props);

   
}

render () {

    return (
        <View style={{height:100,width:"90%",backgroundColor:"grey",margin:10}}>
            
        </View>
    );
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: FlatListPlatform: iOSiOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions