javascript - How to reduce image size from URL obtained from server? (React-native) -
i have implemented fetch() request call api carries large number of images server. want images load in application , when implemented swiper due large size of image, application crashed. can resize image url because have imageurl obtained result. can view code as:`
render(){ var pages = []; (var = 0; < this.props.items.length; i++) { const imageurl = 'http://photoos.boondrive.com/'+ this.props.items[i].large_file_path + this.props.items[i].display_name; pages.push( <view style={{flex:1, backgroundcolor:'black', justifycontent:'center', alignitems:'center'}} key={i}> <view> <image style={{width:width,height:height}} source={{uri:imageurl}}> </image> </view> </view> ); } return( <view style={{flex:1}}> <view> <androidtoolbar title={'photos'} navicon={jresource.back} flowicon={jresource.expandarrow} onpress={()=>this.props.navigator.pop()}/> </view> <swiper style={{flex:1}} index={this.props.items.indexof(this.props.item)} loop={false}> {pages} </swiper> </view> ); }
}
i have guessed when feed images array large size of array made, when gets rendered, application allocates large memory 255mb, therefore cannot swipe images. application gets hanged , gets crashed. how can obtain expected output , how can optimize memory in current problem. suggestion helpful.
Comments
Post a Comment