Skip to content

Commit

Permalink
Merge pull request #254 from developmentseed/fix/map-overlay-list
Browse files Browse the repository at this point in the history
Fix map overlay list
  • Loading branch information
geohacker authored May 26, 2020
2 parents 4db91ce + 16c4647 commit 16346b6
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions app/components/MapOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,19 @@ const Grabber = styled.View`
class MapOverlay extends Component {
renderFeature (feature) {
const { navigation } = this.props
function onPress () {
navigation.navigate('ViewFeatureDetail', { feature })
}

const name = feature.properties.name || feature.properties['name:end'] || feature.properties.brand || undefined
let nameText
if (name) {
nameText = (
<NameText>{feature.properties.hasOwnProperty('name') ? feature.properties.name : ''}</NameText>
)
}
const name =
feature.properties.name ||
feature.properties['name:end'] ||
feature.properties.brand

return (
<Feature onPress={onPress}>
<Feature
onPress={() => navigation.navigate('ViewFeatureDetail', { feature })}
>
<FeatureText>
{nameText}
<BoldText>{ getTaginfo(feature) }</BoldText>
{name && <NameText>{name}</NameText>}
<BoldText>{getTaginfo(feature)}</BoldText>
<Text>{feature.id}</Text>
</FeatureText>
</Feature>
Expand Down Expand Up @@ -129,7 +125,7 @@ class MapOverlay extends Component {
render () {
const { features, selectedFeatures, selectedPhotos } = this.props
if ((selectedFeatures && selectedFeatures.length > 0) || (selectedPhotos && selectedPhotos.length > 0)) {
const featureSection = { 'title': 'Featues', 'data': selectedFeatures || features }
const featureSection = { 'title': 'Features', 'data': selectedFeatures || features }
const photoSection = { 'title': 'Photos', 'data': selectedPhotos }

return (
Expand All @@ -145,7 +141,7 @@ class MapOverlay extends Component {
<ItemList
sections={[featureSection, photoSection]}
renderItem={({ item }) => { return this.renderItem(item) }}
keyExtractor={(item, i) => `${item.properties.id}`}
keyExtractor={(item, i) => item.properties.id + i}
/>
</FeatureListWrapper>
</Drawer>
Expand Down

0 comments on commit 16346b6

Please sign in to comment.