A custom WebView component for Expo applications that exposes a Livemap component and methods to interact with it.
npm install @wemap/expo-livemapimport React from 'react';
import { View } from 'react-native';
import { LivemapWebview } from '@wemap/expo-livemap';
function App() {
return (
<View style={{ flex: 1 }}>
<LivemapWebview
emmid={25414} />
</View>
);
}import React, { useRef } from 'react';
import { View, Button } from 'react-native';
import { LivemapWebview } from '@wemap/expo-livemap';
function App() {
const livemapWebviewRef = useRef(null);
const centerTo = () => {
livemapWebviewRef.current?.centerTo({ latitude: 43.856614, longitude: 2.352222 }, 15);
};
const getUserLocation = () => {
livemapWebviewRef.current?.getUserLocation().then((userLocation) => {
console.log(userLocation)
});
};
const onContentUpdated = (data) => {
console.log('onContentUpdated', data.items.length);
};
return (
<View style={{ flex: 1 }}>
<LivemapWebview
onContentUpdated={onContentUpdated}
ref={livemapWebviewRef}
emmid={25414} />
</View>
);
}The component accepts all standard React Native WebView props plus specific livemap event like:
onContentUpdated(data) => voidAll events are specified in the TypeScript definitions file
The ref component can be used to trigger specific map action like centerTo or getUserLocation.
All ref methods are specified in the TypeScript definitions file
The package includes TypeScript definitions. For TypeScript projects, you can import types:
import { LivemapWebviewProps, LivemapWebviewRef } from '@wemap/expo-livemap';- Expo SDK 51 or higher
- React Native WebView 11 or higher
MIT
Wemap