mirror of
https://github.com/expo/react-native-maps.git
synced 2026-11-15 09:18:08 -10:00
17 lines
561 B
JavaScript
17 lines
561 B
JavaScript
import * as React from 'react';
|
|
|
|
import * as Maps from '../web';
|
|
import { StyleSheet } from 'react-native';
|
|
|
|
const Components = Maps.Leaflet;
|
|
|
|
export default function requireNativeComponent(name, Component, nativeProps) {
|
|
if (!(name in Components)) throw new Error(`Component ${name} is not registered on web.`);
|
|
const NativeComponent = Components[name];
|
|
return React.forwardRef(({ style, ...props }, ref) => {
|
|
const composed = StyleSheet.flatten(style);
|
|
|
|
return <NativeComponent style={composed} {...props} ref={ref} {...nativeProps} />;
|
|
});
|
|
}
|