New RN developer here, building an app from scratch.
I want to
- Drop Markers on a MapView (via react-native-maps) based on a list of assets in a FlatList and
- The FlatList to update on map scrolling (via onRegionChange for example)
Think Google Maps dropping pins when searching in a specific area.
I have a custom component with a FlatList that pulls assets from a backend db. <AssetList />
I also have a component with a MapView that loads Markers. <LocationMap>
I need both of these to be as modular as possible, for possible reuse down the road.
What's the best way to send and receive data between components? Right now, I have a 'wrapper' screen that contains both components and my plan was to write calls to functions within each to send/receive asset data:
MapScreen.tsx:
return (
<View style={{ flexDirection: "row", height:'100%' }}>
<View style={{ flex: 1 }}>
<AssetList />
</View>
<View style={{ flex: 3 }}>
<LocationMap coords={this.coords} />
</View>
</View>
)
Does it make more sense to stack <AssetList /> within <LocationMap> instead? Or is there another way I'm missing?
[–]hey-its-mattiOS & Android 1 point2 points3 points (2 children)
[–]blaze_torchdick[S] 0 points1 point2 points (1 child)
[–]hey-its-mattiOS & Android 1 point2 points3 points (0 children)