Skip to content

Commit 345f369

Browse files
Merge pull request #22 from miallo/fix-own-position-and-styles
Fix own position marker and forward styles
2 parents f92a48e + 2f195fe commit 345f369

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/LeafletView/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useCallback, useEffect, useRef, useState } from 'react';
2-
import { WebView } from 'react-native-webview';
2+
import { WebView, WebViewProps } from 'react-native-webview';
33
import {
44
MapMarker,
55
WebviewLeafletMessage,
@@ -49,6 +49,7 @@ export type LeafletViewProps = {
4949
zoom?: number;
5050
doDebug?: boolean;
5151
androidHardwareAccelerationDisabled?: boolean;
52+
webviewStyle?: WebViewProps;
5253
injectedJavaScript?: string;
5354
};
5455

@@ -66,6 +67,7 @@ const LeafletView: React.FC<LeafletViewProps> = ({
6667
zoom,
6768
doDebug,
6869
androidHardwareAccelerationDisabled,
70+
webviewStyle,
6971
injectedJavaScript
7072
}) => {
7173
const webViewRef = useRef<WebView>(null);
@@ -182,9 +184,8 @@ const LeafletView: React.FC<LeafletViewProps> = ({
182184
return;
183185
}
184186
sendMessage({
185-
...ownPositionMarker,
186-
id: OWN_POSTION_MARKER_ID
187-
});
187+
ownPositionMarker: { ...ownPositionMarker, id: OWN_POSTION_MARKER_ID },
188+
});
188189
}, [initialized, ownPositionMarker, sendMessage]);
189190

190191
//Handle mapCenterPosition update
@@ -221,6 +222,7 @@ const LeafletView: React.FC<LeafletViewProps> = ({
221222
allowUniversalAccessFromFileURLs={true}
222223
allowFileAccessFromFileURLs={true}
223224
androidHardwareAccelerationDisabled={androidHardwareAccelerationDisabled}
225+
style={webviewStyle}
224226
injectedJavaScript={injectedJavaScript}
225227
/>
226228
);

0 commit comments

Comments
 (0)