React-native Airbnb-Maps: How do I render a button inside the airbnb maps pop-up box?

DaveTheAl

I am trying to render a button which I can use to redirect to another page within the description page (the pop-up-box if you select a marker) using AirBnb maps (using MapView.Markers). I am not sure how to achieve this.

Currently my markers look as follow:

const markers = [{
  longitude: 8.545592,
  latitude: 47.366465,
  description: "Bike 1",
  title: "Bike 1"
},
{
  longitude: 8.545892,
  latitude: 47.366365,
  description: "Bike 2",
  title: "Bike 2"
}
];

Whenever I try to input JSX into a text, I get a NSMutableDictionary cannot be converted to NSString error. (When I do this:

const markers = [{
  longitude: 8.545592,
  latitude: 47.366465,
  description: <Text>Bike1</Text>, //"Bike 1", //<Text> Bike1 </Text>
  title: "Bike 1"
},
{
  longitude: 8.545892,
  latitude: 47.366365,
  description: "Bike 2",
  title: "Bike 2"
}
];
Michael Cheng

For more than just text, what you should do is define a custom Callout instead of using description prop. For example:

<MapView.Marker
  coordinate={{longitude: marker.longitude, latitude: marker.latitude}}
  title={marker.title}
>
  <MapView.Callout>
    <View style={styles.callout}>
      <Button title='Click Me!' onPress={() => console.log('Clicked')} />
    </View>
  </MapView.Callout>
</MapView.Marker>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Setting up Airbnb ESLint with React and Webpack

From Dev

How do I render a component when a button is clicked in React Native

From Dev

React Native Map (Airbnb) + Markers animation

From Dev

react-native-maps inside Tab not working

From Dev

How do I add a button in my Activity Maps?

From Dev

AccountManager getAccounts() anomaly in Airbnb for the Marshmallow permission model, how do they do it?

From Dev

can't render <MapView/> from react-native-maps

From Dev

How do I render a function which contain a view in react native?

From Dev

How do I render section headers with ListView in react native?

From Dev

GCM How do I detect if app is open and if so pop up an alert box, instead of normal notification flow?

From Dev

Bootstrap 5 airbnb clone : Search bar as button

From Dev

How do I create a box to hold text below Google maps within android?

From Dev

How to use modal pop up extender, inside the gridview image button?

From Dev

How to use modal pop up extender, inside the gridview image button?

From Dev

How do I show pop up on clicking anywhere inside body using AngularJS?

From Dev

How to do styling on buttons on a message box pop-up

From Dev

AppleScript - how do I select a menu item in a pop up button that has no title?

From Dev

How do I make a menu pop up when the user clicks the menu button?

From Dev

Intellij plugin: AirBnB ESLint w/ React

From Dev

Does react-virtualized work with airbnb/enzyme?

From Dev

how do i implement google maps infobox

From Dev

How do I disable source maps in Safari?

From Dev

How do I create a margins on Google maps?

From Dev

How do I get a google-maps InfoWindow to resize to fit the content that is placed inside of it?

From Dev

How to render custom street maps

From Dev

React native maps with conditional markers

From Dev

React native maps with conditional markers

From Dev

React Native Maps followUserLocation coordinates

From Dev

How do I add a right button to NavigatorIOS in React Native?

Related Related

  1. 1

    Setting up Airbnb ESLint with React and Webpack

  2. 2

    How do I render a component when a button is clicked in React Native

  3. 3

    React Native Map (Airbnb) + Markers animation

  4. 4

    react-native-maps inside Tab not working

  5. 5

    How do I add a button in my Activity Maps?

  6. 6

    AccountManager getAccounts() anomaly in Airbnb for the Marshmallow permission model, how do they do it?

  7. 7

    can't render <MapView/> from react-native-maps

  8. 8

    How do I render a function which contain a view in react native?

  9. 9

    How do I render section headers with ListView in react native?

  10. 10

    GCM How do I detect if app is open and if so pop up an alert box, instead of normal notification flow?

  11. 11

    Bootstrap 5 airbnb clone : Search bar as button

  12. 12

    How do I create a box to hold text below Google maps within android?

  13. 13

    How to use modal pop up extender, inside the gridview image button?

  14. 14

    How to use modal pop up extender, inside the gridview image button?

  15. 15

    How do I show pop up on clicking anywhere inside body using AngularJS?

  16. 16

    How to do styling on buttons on a message box pop-up

  17. 17

    AppleScript - how do I select a menu item in a pop up button that has no title?

  18. 18

    How do I make a menu pop up when the user clicks the menu button?

  19. 19

    Intellij plugin: AirBnB ESLint w/ React

  20. 20

    Does react-virtualized work with airbnb/enzyme?

  21. 21

    how do i implement google maps infobox

  22. 22

    How do I disable source maps in Safari?

  23. 23

    How do I create a margins on Google maps?

  24. 24

    How do I get a google-maps InfoWindow to resize to fit the content that is placed inside of it?

  25. 25

    How to render custom street maps

  26. 26

    React native maps with conditional markers

  27. 27

    React native maps with conditional markers

  28. 28

    React Native Maps followUserLocation coordinates

  29. 29

    How do I add a right button to NavigatorIOS in React Native?

HotTag

Archive