Started a new project with expo (react native) but i've encountered a problem with leaflet, apparently i need some loader to use react leaflet but i don't even know where to start
App.js
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import Map from './components/Map';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Map />
<StatusBar style="auto" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Map.js
import { MapContainer, TileLayer, Marker, Popup } from "react-leaflet";
function Map() {
const position = [51.505, -0.09];
render(
<MapContainer center={position} zoom={13} scrollWheelZoom={false}>
<TileLayer
attribution='© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<Marker position={position}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker>
</MapContainer>
);
}
export default Map;
Error given is:
./node_modules/react-leaflet/esm/Pane.js 25:37
Module parse failed: Unexpected token (25:37)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
|
> const parentPaneName = props.pane ?? context.pane;
| const parentPane = parentPaneName ? context.map.getPane(parentPaneName) : undefined;
| const element = context.map.createPane(name, parentPane);
What should i do now? How do i set up a loader? Thank you in advance