Skip to content

Commit 1223ef4

Browse files
author
K
committed
add note with long press, some style stuff and eslint doesnt know what it wants
1 parent 8213734 commit 1223ef4

File tree

3 files changed

+66
-20
lines changed

3 files changed

+66
-20
lines changed

nr-app/app/(tabs)/list.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ const styles = StyleSheet.create({
6868
gap: 8,
6969
},
7070
note: {
71-
color: "#008800"
72-
}
71+
color: "#008800",
72+
},
7373
});

nr-app/app/(tabs)/settings.tsx

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,13 @@ export default function TabThreeScreen() {
66
<View>
77
<Text style={styles.header}>Keys</Text>
88
<Text>npub</Text>
9-
<TextInput
10-
style={styles.input}
11-
value='npub'
12-
/>
9+
<TextInput style={styles.input} value="npub" />
1310
<Text>nsec</Text>
14-
<TextInput
15-
style={styles.input}
16-
value='nsec'
17-
/>
11+
<TextInput style={styles.input} value="nsec" />
1812
<Text>seed</Text>
19-
<TextInput
20-
style={styles.input}
21-
value='seed'
22-
/>
13+
<TextInput style={styles.input} value="seed" />
2314
<Text style={styles.header}>Relays</Text>
24-
<TextInput
25-
style={styles.input}
26-
value="['relay1', 'relay2']"
27-
/>
15+
<TextInput style={styles.input} value="['relay1', 'relay2']" />
2816
<Text style={styles.header}>Help</Text>
2917
<Text style={{ color: "#880088" }}>
3018
Copy and adapt some text from notes.trustroots.org
@@ -44,9 +32,9 @@ const styles = StyleSheet.create({
4432
borderBottomWidth: 1, // Optional: add a bottom border
4533
borderBottomColor: "#ddd", // Optional: color of the bottom border
4634
},
47-
input: {
35+
input: {
4836
height: 40,
49-
borderColor: 'gray',
37+
borderColor: "gray",
5038
borderWidth: 1,
5139
marginBottom: 20,
5240
paddingHorizontal: 10,

nr-app/src/components/Map.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import MapView, { Marker, Callout } from "react-native-maps";
99
import { eventsSelectors } from "@/redux/slices/events.slice";
1010
import { useAppSelector } from "@/redux/hooks";
1111

12+
import React, { useState } from "react";
13+
import { Modal, TextInput, Button } from "react-native";
14+
1215
const NoteMarker = ({ event }) => {
1316
if (Array.isArray(event.event.tags[1]) && event.event.tags[1][1]) {
1417
const coordinates = plusCodeToCoordinates(event.event.tags[1][1]);
@@ -31,12 +34,28 @@ const NoteMarker = ({ event }) => {
3134
export default function Map() {
3235
const events = useAppSelector(eventsSelectors.selectAll);
3336

37+
const handleAddNote = () => {
38+
// Logic to add the note to the event or state
39+
console.log("Note added:", note, "at", selectedCoordinate);
40+
setModalVisible(false);
41+
setNote("");
42+
};
43+
44+
const [modalVisible, setModalVisible] = useState(false);
45+
const [note, setNote] = useState("");
46+
const [selectedCoordinate, setSelectedCoordinate] = useState(null);
47+
const handleLongPress = (event) => {
48+
setSelectedCoordinate(event.nativeEvent.coordinate);
49+
setModalVisible(true);
50+
};
51+
3452
return (
3553
<View style={styles.mapContainer}>
3654
<MapView
3755
style={styles.map}
3856
rotateEnabled={false}
3957
pitchEnabled={false}
58+
onLongPress={handleLongPress}
4059
onRegionChangeComplete={(region, details) => {
4160
console.log("#rIMmxg Map move completed", region, details);
4261
const topRightCoordinates = {
@@ -62,6 +81,32 @@ export default function Map() {
6281
<NoteMarker event={event} />
6382
))}
6483
</MapView>
84+
85+
<Modal
86+
visible={modalVisible}
87+
transparent={true}
88+
animationType="slide"
89+
onRequestClose={() => setModalVisible(false)}
90+
>
91+
<View style={styles.modalContainer}>
92+
<TextInput
93+
style={styles.input}
94+
placeholder="Enter your note"
95+
value={note}
96+
onChangeText={setNote}
97+
/>
98+
<Button
99+
style={styles.button}
100+
title="Add Note"
101+
onPress={handleAddNote}
102+
/>
103+
<Button
104+
style={styles.button}
105+
title="Cancel"
106+
onPress={() => setModalVisible(false)}
107+
/>
108+
</View>
109+
</Modal>
65110
</View>
66111
);
67112
}
@@ -74,4 +119,17 @@ const styles = StyleSheet.create({
74119
width: "100%",
75120
height: "100%",
76121
},
122+
modalContainer: {
123+
flex: 1,
124+
justifyContent: "center",
125+
alignItems: "center",
126+
backgroundColor: "rgba(0, 0, 0, 0.7)",
127+
},
128+
input: {
129+
width: 200,
130+
padding: 10,
131+
backgroundColor: "white",
132+
marginBottom: 10,
133+
},
134+
button: {},
77135
});

0 commit comments

Comments
 (0)