map-ir/mapir-react-native-sdk

Mapir onLongPress and onPress not work

mohamadbadrian opened this issue · 6 comments

any suggestion?!
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"


"mapir-react-native-sdk": "^1.7.1",
"react": "16.6.3",
"react-native": "0.57.8"

Other event handler did not work too !
how can i fix this?

i found that in first run of project the events work fine but when i reload app in emulator all event did not work

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Image} from 'react-native';
import Mapir from 'mapir-react-native-sdk'

type Props = {};
export default class App extends Component<{}> {
    constructor(props) {
        super(props);
        this.state = {
            markers: [
                { latitude: 51.422548, longitude: 35.732573},
            ],
        };
    }

    addMarker(coordinates) {
        this.setState({
            markers: [...this.state.markers ,{ latitude: coordinates[0], longitude: coordinates[1]}]
        });
    }

    render() {
        return (
            <View style={styles.container}>
                <Mapir
                    accessToken={'YOUR ACCESS TOKEN'}
                    zoomLevel={13}
                    centerCoordinate={[51.422548, 35.732573]}
                    onLongPress={e => this.addMarker(e.geometry.coordinates)}
                    style={styles.container}>
                    <Mapir.Marker
                        id={'1'}
                        coordinate={[51.422548, 35.732573]}
                    />
                    {this.state.markers.map(markers =>
                        (<Mapir.Marker
                            id={'2'}
                            key={markers.latitude}
                            coordinate={[markers.latitude, markers.longitude ]}
                        />)
                    )}
                </Mapir>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    }
});

this code works fine without any problem!
Can you explain more about your question please?!

yes code work well, i think problem is for emulator ! i see some people have this issue with Mapbox Maps SDK library too,
I'll check with real device and announce you

Same problem in real Device , when app start for first time all map events work fine but when reload app ,events of map not work but other events in screen work fine !
do you have any idea @ReyhaneMasumi ?!

Sorry, i test it many times! there is no problem. Maybe it depends on your application and its not about our SDK!