diff --git a/App.tsx b/App.tsx deleted file mode 100644 index 58b8b0a..0000000 --- a/App.tsx +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Sample React Native App - * https://github.com/facebook/react-native - * - * @format - */ - -import React, { useRef, useState } from 'react'; -import {PERMISSIONS, request} from 'react-native-permissions'; -import { Button, NativeModules, PermissionsAndroid, StatusBar, SafeAreaView, ScrollView, StyleSheet, Text, View } from 'react-native'; -interface ILog { - command: string; - result: any; -} -/** const requestPhoneStatePermission = async () => { -* try { -* const granted = await PermissionsAndroid.request( -* PermissionsAndroid.READ_PHONE_STATE, -* { -* title: 'Phone State Permission', -* message: -* 'LPA App needs acces to your phone state ' + -* 'Grant permission for accessing eid', -* buttonNeutral: 'Ask Me Later', -* buttonNegative: 'Cancel', -* buttonPositive: 'OK', -* }, -* ); -* if (granted === PermissionsAndroid.RESULTS.GRANTED) { -* console.log('Phone State Access Granted'); -* } else { -* console.log('Permission denied'); -* } -* } catch (err) { -* console.log(err); -* } -* }; -*/ - -export default function App() { - const [logs, setLogs] = useState>([]); - - const scrollViewRef = useRef(); - - const getEIDs = async () => { - try { - //await requestPhoneStatePermission(); - //console.log("NativeModules.EuiccManager: ", NativeModules.EuiccManager); - const eid = await NativeModules.EuiccManager.getEID(); - console.log("EID: ", eid); - } catch(e) { - console.log("error occurred: ", e); - } - }; - - return ( - - - - RN eSIM Manager - - scrollViewRef?.current?.scrollToEnd({ animated: true })} - > - {logs.map((log, index) => ( - <> - - {log.command} : - - - {`${log.result}`} - - - ))} - - - - - - - ); -} - -const styles = StyleSheet.create({ - header: { - paddingVertical: 20, - alignItems: 'center', - }, - headerText: { - fontSize: 24, - fontWeight: '600', - }, - button: { - paddingVertical: 10, - }, - activateEsimContainer: { - paddingVertical: 10, - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - }, - mainView: { - paddingHorizontal: 18, - }, - logsContainer: { - height: 300, - backgroundColor: 'black', - borderRadius: 5, - }, - logText: { - color: 'lightgrey', - }, - logTextResult: { - color: 'lightgrey', - marginLeft: 20, - marginBottom: 5, - }, -}); diff --git a/__tests__/App.test.tsx b/__tests__/App.test.tsx index 9eac6fb..7361e91 100644 --- a/__tests__/App.test.tsx +++ b/__tests__/App.test.tsx @@ -4,7 +4,7 @@ import 'react-native'; import React from 'react'; -import App from '../App'; +import App from '../android/src/App'; // Note: import explicitly to use the types shipped with jest. import {it} from '@jest/globals'; diff --git a/android/src/App.tsx b/android/src/App.tsx new file mode 100644 index 0000000..0b7bbeb --- /dev/null +++ b/android/src/App.tsx @@ -0,0 +1,84 @@ +/** + * Sample React Native App + * https://github.com/facebook/react-native + * + * @format + */ + +import React, { useRef, useState } from 'react'; +import { + Button, + NativeModules, + SafeAreaView, + ScrollView, + StyleSheet, + Text, + View, + TouchableOpacity +} from 'react-native'; +import Modal from "react-native-modal"; + +interface ILog { + command: string; + result: any; +} + +export default function App() { + const [mapping, setMapping] = useState(null); + const [isModalVisible, setIsModalVisible] = React.useState(false); + + const toggleModalVisibility = () => { + setIsModalVisible(visible => !visible); + } + + // Function to handle button click and display the mapping values + const handleButtonClick = async () => { + const newMapping = await NativeModules.SimData.getSimCardsNative(); + setMapping(newMapping); + }; + + const getEIDs = async () => { + try { + const eid = await NativeModules.EuiccManager.getEID(); + console.log("EID: ", eid); + } catch(e) { + console.log("error occurred: ", e); + } + }; + + return ( + + Tab One + +