Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix map overlay list #254

Merged
merged 3 commits into from
May 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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