React-native-maps: Change MapView.Marker child component MapView Image on Select -




i'm working on implementation of react-native-maps.

there mapscreen component , on component mapview of react-native-maps there many mapview.marker rendered out mapping through list of items in props. each mapview.marker have custom child component mapmarker of current item of list of items in props passed.

essentially, each item have both current image default , selected image when mapmarker selected.

i change image of mapmarker when mapmarker selected , when mapmarker selected should changed default image. default, map markers rendered on mapview default images.

mapscreen component

                this.props.items                     .map(i =>                         <mapview.marker                             key={i.id}                             onpress={() => this.handlelocationpush(i)}                             coordinate={i.location}                         >                             <mapmarker                                 item={i}                                 size={this.state.markersize}                                 active={i === this.state.selecteditem}                             />                         </mapview.marker>                     ) 

mapmarker component

import {iconsdefault, iconsselected} "../../utils/icons";  rendericon() {         return (             <image                 source={this.props.active ? iconsselected[this.props.item] : iconsdefault[this.props.item]}                 style={styles.mapmarker.itemimage}             />         ) } 

the above implementation works default image rendered , on default when selected icon i.e. focusing on item icon doesn't change of selectedimage.

how cause component rerender / update on change of such please?

thanks much!





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -