You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{useRef}from'react';import{MapView,ShapeSource,LineLayer,Camera,}from'@rnmapbox/maps';import{TouchableOpacity,Text,View}from'react-native';functionBugReportExample(){constcameraRef=useRef<Camera>(null);constlocateUser=()=>{// Logic to get user locationsconstcoords=// This line is working correctly so I am not providing it. console.log(options) shows accurate location etc.;cameraRef.current.flyTo(coords,10);}return(<View><TouchableOpacityonPress={locateUser}><Text> Locate </Text></TouchableOpacity><MapViewstyle={{flex: 1}}><Cameraref={cameraRef}zoomLevel={14}/></MapView></View>);}
Observed behavior and steps to reproduce
Nothing happens.
Also zoomTo, moveTo, setCamera methods are not working. No errors, no warnings. Just not working.
Expected behavior
Camera flies to given coordinates.
Notes / preliminary analysis
No response
Additional links and references
No response
The text was updated successfully, but these errors were encountered:
zju1
changed the title
[Bug]: all of the ref methods of Camera component is not working
[Bug]: all of the ref methods of Camera component are not working
Dec 4, 2024
So i have done some brief analysis regarding this issue - if you call cameraRef methods in callback using some button or just call them ~100 miliseconds after view is initialised it works fine.
Mapbox Implementation
Mapbox
Mapbox Version
default
React Native Version
0.76.3
Platform
Android
@rnmapbox/maps
version10.1.33
Standalone component to reproduce
Observed behavior and steps to reproduce
Nothing happens.
Also zoomTo, moveTo, setCamera methods are not working. No errors, no warnings. Just not working.
Expected behavior
Camera flies to given coordinates.
Notes / preliminary analysis
No response
Additional links and references
No response
The text was updated successfully, but these errors were encountered: