forked from mpiannucci/react-native-context-menu-view
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (26 loc) · 835 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from "react";
import { requireNativeComponent, View, Platform, StyleSheet, processColor } from "react-native";
const NativeContextMenu = requireNativeComponent("ContextMenu", null);
const ContextMenu = (props) => {
const iconColor = props?.iconColor
? Platform.OS === 'ios'
? processColor(props.iconColor)
: props.iconColor
: undefined;
return (
<NativeContextMenu {...props} iconColor={iconColor}>
{props.children}
{props.preview != null && Platform.OS === 'ios' ? (
<View style={styles.preview} nativeID="ContextMenuPreview">{props.preview}</View>
) : null}
</NativeContextMenu>
);
};
const styles = StyleSheet.create({
preview: {
position: 'absolute',
overflow: 'visible',
backgroundColor: 'transparent'
}
});
export default ContextMenu;