diff --git a/App.tsx b/App.tsx index be28910..eec2037 100644 --- a/App.tsx +++ b/App.tsx @@ -6,7 +6,13 @@ */ import React, {useEffect, useState} from 'react'; -import {SafeAreaView, ScrollView, StatusBar, StyleSheet} from 'react-native'; +import { + SafeAreaView, + ScrollView, + StatusBar, + StyleSheet, + Text, +} from 'react-native'; import {Colors} from 'react-native/Libraries/NewAppScreen'; import {PrescriptionCreator} from './components/PrescriptionCreator'; @@ -15,22 +21,15 @@ import PolyfillCrypto from 'react-native-webview-crypto'; function App(): React.JSX.Element { const backgroundStyle = { - backgroundColor: Colors.darker, + backgroundColor: 'black', + color: 'white', }; const [form, setForm] = useState<{} | null>(null); useEffect(() => { console.log('inside useeffect'); - const fetchForm = async () => { - if (!form) { - // let form = await getFormTemplate( - // 'eb3df1f89653475f0bcbd22da35f8d2f126db8a68a88a7abedc53535c76c39b4', - // ); - } - }; - fetchForm(); - }, [form, setForm]); + }, []); return ( diff --git a/components/PharmacyPicker/AddPharmacy.tsx b/components/PharmacyPicker/AddPharmacy.tsx new file mode 100644 index 0000000..0641257 --- /dev/null +++ b/components/PharmacyPicker/AddPharmacy.tsx @@ -0,0 +1,112 @@ +import {useState} from 'react'; +import {Alert, Button, Modal, Text, TextInput, View} from 'react-native'; +import {Section} from '../common/Section'; + +export const AddPharmacy = ({ + isVisible, + onClose, + onAdd, +}: { + isVisible: boolean; + onClose: () => void; + onAdd: (npub: string, relay: string, name: string) => void; +}) => { + const [npub, setNpub] = useState(''); + const [relay, setRelay] = useState(''); + const [name, setName] = useState(''); + + const handleNpub = (value: string) => { + setNpub(value); + }; + const handleRelay = (value: string) => { + setRelay(value); + }; + const handleName = (value: string) => { + setName(value); + }; + return ( + { + console.log('closing....'); + onClose(); + return true; + }} + onDismiss={() => { + onClose(); + }} + transparent={true} + style={{backgroundColor: 'black', margin: 0, padding: 0, height: '80%'}} + animationType="slide"> + +
+ + Add Pharmacy Name + + + Add Pharmacy Npub + + + Add Pharmacy Relay + + + + + + + + + + +
+
+
+ ); +}; diff --git a/components/PharmacyPicker/index.tsx b/components/PharmacyPicker/index.tsx new file mode 100644 index 0000000..83ff525 --- /dev/null +++ b/components/PharmacyPicker/index.tsx @@ -0,0 +1,93 @@ +import {Dropdown} from 'react-native-element-dropdown'; +import {Section} from '../common/Section'; +import {Button, Dimensions, Text, View} from 'react-native'; +import React, {useState} from 'react'; +import {AddPharmacy} from './AddPharmacy'; + +export const pharmacyData = [ + { + label: 'Pharmacy A', + value: 'A', + npub: 'npub1tea09rtjeuzgk4gjajzry37wuyv7h02d4zw38cpadcrkg5yt0qhqncr7km', + relays: ['wss://relay.damus.io'], + }, + { + label: ' + Add Pharmacy', + value: 'custom', + }, +]; + +let width = Dimensions.get('window').width; + +interface PharmacyPickerProps { + handleLocationChange: (item: any) => void; +} + +export const PharmacyPicker: React.FC = ({ + handleLocationChange, +}) => { + const [showAddPharmacyModal, setShowAddPharmacyModal] = useState(false); + + const renderItem = (item: any) => { + if (item.value === 'custom') { + return ( + +