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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -