Memory startup when using hundreds of identical images

Description

I am using responsive maps to draw about 750 markers on the map. Each marker uses the same image

Reproduction Steps and Sample Code

const markerImage = <Image source={images.marker} />;
export default class Main extends Component {
  render() {
    return (
      <MapView style={StyleSheet.absoluteFill}>
        { coordinates.map(coordinate => {
          return (
            <Marker
              key={coordinate.id}
              coordinate={coordinate}
              children={markerImage}
            />
          );
        })}
      </MapView>
    )
  }
}

      

Possible Solution

Reuse UIImage Optimize custom marker performance with Google Maps SDK for iOS

However, I don't know how to do this in React Native, since React abstracts from the presentation layer.

Additional Information

  • React Native version: ["0.41.2"]
  • react-native-maps: ["^ 0.13.0"]
  • Platform: [both]
  • Development operating system: [MacOS]
  • Developer tools: [Xcode: 8.3, iPhone 7 (10.3), GalaxyS6 (6.0.1)]

image

image

+3


source to share





All Articles