diff --git a/example/src/App.tsx b/example/src/App.tsx index b6f6aff..b940c83 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -6,6 +6,7 @@ import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { HomeScreen } from './screens/HomeScreen'; import { TestScreen } from './screens/Test01Screen'; +import { Test02Screen } from './screens/Test02Screen'; import { SHARED_ENV } from './constants/SharedEnv'; @@ -50,6 +51,7 @@ export default function App() { + ); diff --git a/example/src/examples/DebugControls.tsx b/example/src/examples/DebugControls.tsx index dc6f2af..84e37c5 100644 --- a/example/src/examples/DebugControls.tsx +++ b/example/src/examples/DebugControls.tsx @@ -30,13 +30,21 @@ export function DebugControls(props: ContextMenuExampleProps) { }} /> { // @ts-ignore navigation.push('Test'); }} /> + { + // @ts-ignore + navigation.push('Test02'); + }} + /> ); }; \ No newline at end of file diff --git a/example/src/screens/Test02Screen.tsx b/example/src/screens/Test02Screen.tsx new file mode 100644 index 0000000..ec844b3 --- /dev/null +++ b/example/src/screens/Test02Screen.tsx @@ -0,0 +1,79 @@ +import * as React from 'react'; +import { useState } from 'react'; +import { View, Image, StyleSheet, Text } from 'react-native'; + +import { ContextMenuView } from 'react-native-ios-context-menu'; + + +export const Test02Screen = (props) => { + const [isMessageLiked, setIsMessageLiked] = useState(false); + + return ( + + + { + switch(nativeEvent.actionKey) { + case "action-like": + setIsMessageLiked((value) => !value); + break; + }; + }} + > + + + {isMessageLiked && ( + + {'❤️'} + + )} + + + ); +}; + +const styles = StyleSheet.create({ + rootContainer: { + flex: 1, + alignItems: 'flex-end', + justifyContent: 'flex-end', + paddingHorizontal: 15, + paddingVertical: 10, + paddingBottom: 20 + }, + messageContainer: { + }, + messageMenuContainer: { + flex: 0, + backgroundColor: 'red', + borderRadius: 10, + overflow: 'hidden', + }, + messageImage: { + width: 200, + height: 100, + }, +}); \ No newline at end of file