Source Code - Setting screen in React native testing | Web Scripts | Crax

Welcome To Crax.Pro Forum!

Check our new Marketplace at Crax.Shop

   Login! SignUp Now!
  • We are in solidarity with our brothers and sisters in Palestine. Free Palestine. To learn more visit this Page

  • Crax.Pro domain has been taken down!

    Alternatives: Craxpro.io | Craxpro.com

Source Code Setting screen in React native testing

Source Code Setting screen in React native testing

LV
0
 

tempcp001

Member
Joined
Jan 7, 2024
Threads
12
Likes
0
Awards
2
Credits
1,153©
Cash
0$
import { Platform, ScrollView, StyleSheet, Text, View } from "react-native";
import React, { useRef, useState } from "react";
import TimeInput from "./timeInput";
import TimePicker from "../../components/timePicker";
import { Button, Switch } from "react-native-paper";
import { Colors } from "../../constants/colors";
export default function SettingScren() {
const dpRef = useRef(null);
const [adp, setAdp] = useState(false);
const [idp, setIdp] = useState(false);
const [time, setTime] = useState(new Date());
const [data, setData] = useState({
monday: { from: "", to: "", status: true },
tuesday: { from: "", to: "", status: true },
wednesday: { from: "", to: "", status: true },
thursday: { from: "", to: "", status: true },
friday: { from: "", to: "", status: true },
saturday: { from: "", to: "", status: false },
sunday: { from: "", to: "", status: false },
});
// const showDatePicker = () => {
// if (Platform.OS === 'ios') {
// setIdp(true)
// dpRef.current.snapTo(0)
// } else {
// setAdp(true)
// }
// }
return (
<>
<ScrollView>
{Object.keys(data).map((item, index) => {
return (
<View key={index}>
<View style={styles.row}>
<Text style={styles.title}>{item}</Text>
<Switch
color={Colors.primary}
value={data[item].status}
onValueChange={() => {
setData({
...data,
[item]: {
...data[item],
status: !data[item].status,
},
});
}}
/>
</View>
<TimeInput
dpRef={dpRef}
// showDatePicker={showDatePicker}
item={data[item]}
disabled={!data[item].status}
/>
</View>
);
})}
<Button
mode="contained"
onPress={() => console.log("Pressed")}
style={{ margin: 20 }}
buttonColor={Colors.primary}
theme={{ roundness: 2 }}
>
Save
</Button>
<View style={{ height: 300 }} />
</ScrollView>
{/* <TimePicker
dpRef={dpRef}
adp={adp}
idp={idp}
setIdp={setIdp}
setDate={(event, date) => {
console.log(date)
}}
time={time}
/> */}
</>
);
}
const styles = StyleSheet.create({
title: {
fontSize: 20,
fontWeight: "bold",
marginVertical: 10,
textTransform: "capitalize",
},
row: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
marginVertical: 10,
paddingHorizontal: 20,
},
});
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Tips
Tips
Top Bottom