Summary: * Fix autolayout + margin issues for aux. preview., * Temp. modify examples to test aux. preview.,
71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
import * as React from 'react';
|
|
import { Alert, View, Text } from 'react-native';
|
|
|
|
import { ContextMenuView } from 'react-native-ios-context-menu';
|
|
|
|
import type { ContextMenuExampleProps } from './SharedExampleTypes';
|
|
import { ContextMenuCard } from '../components/ContextMenuCard';
|
|
|
|
|
|
export function ContextMenuViewExample02(props: ContextMenuExampleProps) {
|
|
return (
|
|
<ContextMenuView
|
|
style={props.style}
|
|
menuConfig={{
|
|
menuTitle: 'ContextMenuViewExample02',
|
|
menuItems: [{
|
|
actionKey : 'key-01',
|
|
actionTitle: 'Action #1',
|
|
icon: {
|
|
type: 'IMAGE_SYSTEM',
|
|
imageValue: {
|
|
systemName: 'folder',
|
|
},
|
|
}
|
|
}, {
|
|
actionKey : 'key-02' ,
|
|
actionTitle: 'Action #2',
|
|
icon: {
|
|
type: 'IMAGE_SYSTEM',
|
|
imageValue: {
|
|
systemName: 'dial.fill',
|
|
},
|
|
}
|
|
}, {
|
|
actionKey : 'key-03' ,
|
|
actionTitle: 'Action #3',
|
|
icon: {
|
|
type: 'IMAGE_SYSTEM',
|
|
imageValue: {
|
|
systemName: 'archivebox.fill',
|
|
},
|
|
}
|
|
}],
|
|
}}
|
|
onPressMenuItem={({nativeEvent}) => {
|
|
Alert.alert(
|
|
'onPressMenuItem Event',
|
|
`actionKey: ${nativeEvent.actionKey} - actionTitle: ${nativeEvent.actionTitle}`
|
|
);
|
|
}}
|
|
renderAuxillaryPreview={() => (
|
|
<View
|
|
style={{backgroundColor: 'red'}}
|
|
>
|
|
<Text>
|
|
Hello
|
|
</Text>
|
|
</View>
|
|
)}
|
|
>
|
|
<ContextMenuCard
|
|
index={props.index}
|
|
title={'ContextMenuViewExample02'}
|
|
subtitle={'actions w/ icons'}
|
|
description={[
|
|
`Context menu with 3 actions (text w/ system icon)`
|
|
]}
|
|
/>
|
|
</ContextMenuView>
|
|
);
|
|
}; |