Monday, 24 April 2023

Google Auto Complete setBounds not a function error

I am using googles address autocomplete and in the console it is throwing an error.

caught TypeError: autocomplete.setBounds is not a function

the code is:

function geolocate() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      var geolocation = new google.maps.LatLng(
        position.coords.latitude, position.coords.longitude);
      var circle = new google.maps.Circle({
        center: geolocation,
        radius: position.coords.accuracy
      });
      autocomplete.setBounds(circle.getBounds());
    });
  }

Is there a reason why setBounds would not work anymore? It used to function properly without erroring.

http://jsfiddle.net/bobrierton/89nqv5v5/



from Google Auto Complete setBounds not a function error

A component mounted at two points

I'm new to React and am trying to implement an HTML structure like this

<div class="heads">
    <div class="head">head1</div>
    <div class="head">head2</div>
    <div class="head">head3</div>
</div>
<div class="bodies">
    <div class="body">body1</div>
    <div class="body">body2</div>
    <div class="body">body3</div>
</div>

Each head-body pair (like head1-body1) belongs to a single component. Without changing the structure, how would I write such a component?

From my understanding, it needs to be "mounted" at two different points (in "heads" and in "bodies").

A practical example of such structure would be a tabbed dialog which has tab headers within the "heads" div and their contents within "bodies".

What I'm looking for is some code that would be able to translate this:

<Tabs ...>
    <Tab head="head1">body1</Tab>
    <Tab head="head2">body2</Tab>
    <Tab head="head3">body3</Tab>
</Tabs>        

into the above HTML structure. Is that possible in React?



from A component mounted at two points

Can we have a NavigationBar instance per screen without functional disadvantages?

When using Jetpack Compose and Material Design, is it possible to use a new NavigationBar (aka BottomNavigationBar) on each screen? Or would this interrupt e.g. touch animations as a new NavigationBar gets instantiated when switching screens?

My idea behind this is that this would really make it easy to hide or show the NavigationBar on some screens and not on others (instead of communicating e.g. with a Scaffold higher up in the hierarchy)



from Can we have a NavigationBar instance per screen without functional disadvantages?