Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ When you (or another AI agent) are asked to implement a change, prefer working t

Every change — no matter how small — must follow this exact sequence:

0. **Pull the latest `master`** (`git checkout master && git pull`) before creating any branch — this ensures the version bump targets the correct base and avoids version conflicts in CI.
1. **Create a new branch** off `master` (never commit directly to `master`)
2. **Make your changes** and commit them to the branch
3. **Bump the version** (`npm run bump:patch/minor/major`) and commit the version files
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ android {
applicationId 'com.pgarr.simplenotepad'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 22
versionName "1.5.0"
versionCode 23
versionName "1.6.0"

buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class NoteListRemoteViewsFactory(
boundListId = -1
return
}
items = list.items
items = list.items.filter { !it.checked }
listTitle = list.title
boundListId = list.id
}
Expand Down Expand Up @@ -62,7 +62,7 @@ class NoteListRemoteViewsFactory(

// Fill-in intent carries position and listId to the broadcast receiver
val fillIntent = Intent().apply {
putExtra("item_index", position)
putExtra("item_index", item.originalIndex)
putExtra("list_id", boundListId)
}
rv.setOnClickFillInIntent(R.id.item_checkbox, fillIntent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.json.JSONArray
import java.io.File

// Mirrors your expo-sqlite DB schema exactly
data class WidgetListItem(val text: String, val checked: Boolean)
data class WidgetListItem(val text: String, val checked: Boolean, val originalIndex: Int = 0)
data class WidgetList(val id: Int, val title: String, val items: List<WidgetListItem>)

object WidgetDbHelper {
Expand Down Expand Up @@ -161,7 +161,7 @@ object WidgetDbHelper {
val obj = arr.optJSONObject(i) ?: return@mapNotNull null
val text = obj.optString("text", "")
val checked = obj.optBoolean("checked", false)
WidgetListItem(text = text, checked = checked)
WidgetListItem(text = text, checked = checked, originalIndex = i)
}
} catch (_: Exception) {
emptyList()
Expand Down
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "simple-notepad",
"slug": "simple-notepad",
"version": "1.5.0",
"version": "1.6.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "simple-notepad",
Expand All @@ -24,7 +24,7 @@
"backgroundColor": "#ffffff"
},
"package": "com.pgarr.simplenotepad",
"versionCode": 22
"versionCode": 23
},
"web": {
"bundler": "metro",
Expand All @@ -43,7 +43,7 @@
"projectId": "9e3820b7-558b-4bd2-a1b2-e49561e741e6"
}
},
"runtimeVersion": "1.5.0",
"runtimeVersion": "1.6.0",
"updates": {
"url": "https://u.expo.dev/9e3820b7-558b-4bd2-a1b2-e49561e741e6"
}
Expand Down
31 changes: 23 additions & 8 deletions components/ListForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Button } from '@/components/ui/button';
import { Icon } from '@/components/ui/icon';
import { Input } from '@/components/ui/input';
import { Text } from '@/components/ui/text';
import { useKeyboardOffset } from '@/hooks/useKeyboardOffset';
import { ListItem } from '@/lib/dataStorage';
import { Trash2Icon } from 'lucide-react-native';
import { useCallback, useState } from 'react';
import { KeyboardAvoidingView, Platform, ScrollView, View } from 'react-native';

Expand Down Expand Up @@ -35,6 +37,10 @@ export function ListForm({
);
}, []);

const handleDeleteRow = useCallback((index: number) => {
setItems((current) => current.filter((_, i) => i !== index));
}, []);

const handleSave = useCallback(async () => {
const trimmedTitle = title.trim();
if (!trimmedTitle) return;
Expand Down Expand Up @@ -70,14 +76,23 @@ export function ListForm({
showsVerticalScrollIndicator={false}>
<View className="flex-1 gap-3 px-4">
{items.map((item, index) => (
<Input
key={`row-${index}`}
className="w-full"
placeholder={`Item ${index + 1}`}
value={item.text}
onChangeText={(text) => handleUpdateRow(index, text)}
editable={!saving}
/>
<View key={`row-${index}`} className="flex-row items-center gap-2">
<Input
className="flex-1"
placeholder={`Item ${index + 1}`}
value={item.text}
onChangeText={(text) => handleUpdateRow(index, text)}
editable={!saving}
/>
<Button
variant="ghost"
size="icon"
onPress={() => handleDeleteRow(index)}
disabled={saving}
accessibilityLabel={`Delete item ${index + 1}`}>
<Icon as={Trash2Icon} className="size-5 text-destructive" />
</Button>
</View>
))}
<Button variant="outline" onPress={handleAddRow} disabled={saving}>
<Text>Add</Text>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "simple-notepad",
"main": "expo-router/entry",
"version": "1.5.0",
"version": "1.6.0",
"scripts": {
"prebuild": "expo prebuild",
"dev": "expo start",
Expand Down
Loading