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

[Bug]: all of the ref methods of Camera component are not working #3704

Open
zju1 opened this issue Nov 29, 2024 · 1 comment
Open

[Bug]: all of the ref methods of Camera component are not working #3704

zju1 opened this issue Nov 29, 2024 · 1 comment
Labels
bug 🪲 Something isn't working

Comments

@zju1
Copy link

zju1 commented Nov 29, 2024

Mapbox Implementation

Mapbox

Mapbox Version

default

React Native Version

0.76.3

Platform

Android

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import React, {useRef} from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';
import {TouchableOpacity ,Text,View} from 'react-native';


function BugReportExample() {
   const cameraRef = useRef<Camera>(null);
   const locateUser = () => {
    // Logic to get user locations
    const coords = // 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>
        <TouchableOpacity onPress={locateUser}>
          <Text> Locate </Text>
        </TouchableOpacity >
        <MapView style={{flex: 1}}>
          <Camera ref={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

@zju1 zju1 added the bug 🪲 Something isn't working label Nov 29, 2024
@github-actions github-actions bot reopened this Nov 29, 2024
@zju1 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
@draggie
Copy link

draggie commented Dec 18, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants