Files
petfeed/mobile/src/components/PasswordField.tsx
T
adminandClaude Sonnet 5 e9bad092f2 feat: pet-suggestion notifications, story music overlay, auth UX fixes
Three pieces of work from this session:

- Pet-suggestion notifications: a weekly cron (species/breed affinity
  heuristic) suggests pets to follow, with an owner opt-out and web/mobile
  notification UI wiring.
- Story music overlay: admin-curated royalty-free track catalog
  (/p/[secret]/music), attachable to stories on web (StoryForm/StoryViewer),
  with mute-original support for video stories. Mobile UI is deferred to
  the next native build (needs an audio-playback module) — tracked in
  mobile/PENDING-NATIVE-BUILD.md.
- Auth UX fixes: sign-in/sign-up now use KeyboardAvoidingView + ScrollView
  and a shared PasswordField with a show/hide toggle (mobile). Web's
  ActivePetContext gained clearGactivePetId(), wired to sign-out via a new
  SignOutCleanup component, fixing a false "you do not have permission to
  access this pet" error after switching accounts on the same browser.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-14 21:02:49 +02:00

38 lines
1.3 KiB
TypeScript

import { useState } from "react";
import { View, Pressable, StyleSheet, type TextInputProps } from "react-native";
import { Eye, EyeOff } from "lucide-react-native";
import { TextField } from "./TextField";
import { useTheme } from "../context/ThemeContext";
/**
* TextField + a show/hide toggle, so a user typing on a phone keyboard has
* some way to verify what they entered (found.md: registration feedback —
* secureTextEntry alone gives no way to check the password before
* submitting). Kept as its own component since sign-in.tsx and sign-up.tsx
* both need the identical behavior.
*/
export function PasswordField(props: TextInputProps) {
const { colors } = useTheme();
const [visible, setVisible] = useState(false);
return (
<View style={styles.container}>
<TextField {...props} secureTextEntry={!visible} style={[styles.input, props.style]} />
<Pressable
onPress={() => setVisible((v) => !v)}
hitSlop={12}
style={styles.toggle}
accessibilityRole="button"
>
{visible ? <EyeOff color={colors.quietGray} size={18} /> : <Eye color={colors.quietGray} size={18} />}
</Pressable>
</View>
);
}
const styles = StyleSheet.create({
container: { justifyContent: "center" },
input: { paddingRight: 44 },
toggle: { position: "absolute", right: 14 },
});