Hi, I want to make a button to center the map on the user, but it doesn't work, it gives me this error
`import React, {useState} from 'react';
import {View, Text, Button, StyleSheet, StatusBar} from 'react-native';
import {useTheme} from '@react-navigation/native';
import Mapbox, {Logger} from '@react-native-mapbox-gl/maps';
import Geolocation from 'react-native-geolocation-service';
Mapbox.setAccessToken(
'mykey',
);
Logger.setLogCallback(log => {
const {message} = log;
return !!(
message.match('Request failed due to a permanent error: Canceled') ||
message.match('Request failed due to a permanent error: Socket Closed')
);
});
Hi, I want to make a button to center the map on the user, but it doesn't work, it gives me this error
`import React, {useState} from 'react'; import {View, Text, Button, StyleSheet, StatusBar} from 'react-native'; import {useTheme} from '@react-navigation/native'; import Mapbox, {Logger} from '@react-native-mapbox-gl/maps'; import Geolocation from 'react-native-geolocation-service';
Mapbox.setAccessToken( 'mykey', );
Logger.setLogCallback(log => { const {message} = log; return !!( message.match('Request failed due to a permanent error: Canceled') || message.match('Request failed due to a permanent error: Socket Closed') ); });
const HomeScreen = ({navigation}) => {
const [state, setState] = useState({ Position: {}, coordonateLat: '', coordonateLong: '', userCoordonate: [], });
const centerCamera = () => { this.map.setCamera({ centerCoordinate: [2.2976, 48.7712], }) };
const {colors} = useTheme();
const theme = useTheme();
return (
); };
const styles = StyleSheet.create({ page: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, container: { height: '100%', width: '100%', backgroundColor: 'tomato', }, map: { flex: 1, }, });
export default HomeScreen;`