検索削除機能を追加

This commit is contained in:
harukin-expo-dev-env 2025-07-18 15:34:00 +00:00
parent 0c10bcc339
commit acd5d0bb88

View File

@ -79,6 +79,9 @@ export const SearchUnitBox = ({
paddingRight: 10,
paddingLeft: 10,
flex: 1,
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
}}
>
<TextInput
@ -88,46 +91,68 @@ export const SearchUnitBox = ({
value={input}
style={{ flex: 1 }}
/>
{input && (
<TouchableOpacity
onPress={() => setInput("") }
style={{
padding: 3,
borderRadius: 15,
backgroundColor: "lightgray",
}}
>
<Ionicons
name="close"
size={20}
color="white"
/>
</TouchableOpacity>
)}
</View>
</View>
{!input &&<View style={{ flexDirection: "row", alignItems: "center" }}>
{Object.keys(lineList_LineWebID).map((d) => (
<TouchableOpacity
style={{
flex: 1,
backgroundColor:
lineColorList[stationIDPair[lineList_LineWebID[d]]],
padding: 5,
marginHorizontal: 2,
borderRadius: 10,
borderColor: "white",
borderWidth: 1,
borderStyle: "solid",
alignItems: "center",
opacity:
isSearchMode == stationIDPair[lineList_LineWebID[d]]
? 1
: !isSearchMode
? 1
: 0.5,
zIndex: 10,
}}
onPress={() => {
const id = stationIDPair[lineList_LineWebID[d]];
const s = isSearchMode == id ? undefined : id;
if (!s) return;
setisSearchMode(s);
}}
key={stationIDPair[lineList_LineWebID[d]]}
>
<Text
style={{ color: "white", fontWeight: "bold", fontSize: 20 }}
{!input && (
<View style={{ flexDirection: "row", alignItems: "center" }}>
{Object.keys(lineList_LineWebID).map((d) => (
<TouchableOpacity
style={{
flex: 1,
backgroundColor:
lineColorList[stationIDPair[lineList_LineWebID[d]]],
padding: 5,
marginHorizontal: 2,
borderRadius: 10,
borderColor: "white",
borderWidth: 1,
borderStyle: "solid",
alignItems: "center",
opacity:
isSearchMode == stationIDPair[lineList_LineWebID[d]]
? 1
: !isSearchMode
? 1
: 0.5,
zIndex: 10,
}}
onPress={() => {
const id = stationIDPair[lineList_LineWebID[d]];
const s = isSearchMode == id ? undefined : id;
if (!s) return;
setisSearchMode(s);
}}
key={stationIDPair[lineList_LineWebID[d]]}
>
{stationIDPair[lineList_LineWebID[d]]}
</Text>
</TouchableOpacity>
))}
</View>}
<Text
style={{
color: "white",
fontWeight: "bold",
fontSize: 20,
}}
>
{stationIDPair[lineList_LineWebID[d]]}
</Text>
</TouchableOpacity>
))}
</View>
)}
</View>
)}
</TouchableOpacity>