App.tsx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import React, {useState} from 'react';
  2. import {
  3. NativeModules,
  4. StyleSheet,
  5. View,
  6. StatusBar,
  7. Text,
  8. TouchableOpacity,
  9. ActionSheetIOS,
  10. Platform,
  11. Button,
  12. } from 'react-native';
  13. import Icon from 'react-native-vector-icons/Ionicons';
  14. const App = () => {
  15. const {CallNative} = NativeModules;
  16. if (Platform.OS === 'ios') {
  17. CallNative.connect();
  18. }
  19. Icon.loadFont();
  20. const IconButton = ({onPress, iconName, iconSize, iconColor}: any) => {
  21. return (
  22. <TouchableOpacity onPress={onPress}>
  23. <Icon
  24. name={iconName}
  25. size={iconSize}
  26. color={iconColor}
  27. style={styles.iconButton}
  28. />
  29. </TouchableOpacity>
  30. );
  31. };
  32. const [isActionSheetVisible, setActionSheetVisible] = useState(false);
  33. const handlePress = () => {
  34. showActionMenu();
  35. };
  36. const showActionMenu = () => {
  37. if (Platform.OS === 'ios') {
  38. } else {
  39. // Android implementation
  40. setActionSheetVisible(true);
  41. }
  42. };
  43. const handleActionSheetPress = async (buttonIndex: any) => {
  44. setActionSheetVisible(false);
  45. //FEATURES2
  46. };
  47. return (
  48. <View style={styles.container}>
  49. <StatusBar animated={true} barStyle="default" showHideTransition="fade" />
  50. <View style={styles.viewAppBar}>
  51. <Text style={styles.textTitle}>NexilisSampleCode</Text>
  52. <IconButton
  53. onPress={handlePress}
  54. iconName="ellipsis-horizontal"
  55. iconSize={30}
  56. iconColor="white"
  57. />
  58. </View>
  59. {isActionSheetVisible && (
  60. <View>
  61. //FEATURES3
  62. <Button title="Cancel" onPress={() => setActionSheetVisible(false)} />
  63. </View>
  64. )}
  65. </View>
  66. );
  67. };
  68. const styles = StyleSheet.create({
  69. loginButtonSection: {
  70. width: '100%',
  71. height: '100%',
  72. justifyContent: 'center',
  73. alignItems: 'center',
  74. },
  75. container: {
  76. flex: 1,
  77. },
  78. viewAppBar: {
  79. width: '100%',
  80. height: '10%',
  81. backgroundColor: '#3669ad',
  82. justifyContent: 'center',
  83. position: 'relative',
  84. },
  85. textTitle: {
  86. position: 'absolute',
  87. left: '30%',
  88. color: 'white',
  89. fontSize: 18,
  90. top: '50%',
  91. },
  92. iconButton: {
  93. position: 'absolute',
  94. right: '5%',
  95. top: -8,
  96. color: 'white',
  97. },
  98. });
  99. export default App;
  100. function setActionSheetVisible(arg0: boolean) {
  101. throw new Error('Function not implemented.');
  102. }