feat(follow-location): init
This commit is contained in:
parent
991b65d990
commit
ca3a2c8fcc
2 changed files with 41 additions and 2 deletions
|
@ -22,6 +22,7 @@ export default function FieldNotifySelector() {
|
|||
const callEmergency = watch("callEmergency");
|
||||
const notifyAround = watch("notifyAround");
|
||||
const notifyRelatives = watch("notifyRelatives");
|
||||
const followLocation = watch("followLocation");
|
||||
const level = watch("level");
|
||||
|
||||
const checkedColor = colors.primary;
|
||||
|
@ -106,6 +107,29 @@ export default function FieldNotifySelector() {
|
|||
}}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.followLocationContainer}>
|
||||
<CheckboxItem
|
||||
status={followLocation ? "checked" : "unchecked"}
|
||||
style={styles.checkboxItem}
|
||||
labelStyle={styles.checkboxLabel}
|
||||
size={styleOptions.checkboxItem.size}
|
||||
icon={() => (
|
||||
<MaterialCommunityIcons
|
||||
name="crosshairs-gps"
|
||||
style={styles.checkboxIcon}
|
||||
onPress={() => {
|
||||
setValue("followLocation", !followLocation);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
color={checkedColor}
|
||||
uncheckedColor={uncheckedColor}
|
||||
label="Suivre ma localisation"
|
||||
onPress={() => {
|
||||
setValue("followLocation", !followLocation);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
@ -122,6 +146,7 @@ const useStyles = createStyles(
|
|||
({ wp, hp, scaleText, fontSize, theme: { colors, textShadowForWhite } }) => ({
|
||||
container: {
|
||||
marginTop: hp(2),
|
||||
marginBottom: hp(3),
|
||||
},
|
||||
checkboxItemContainer: {
|
||||
borderRadius: 4,
|
||||
|
@ -130,6 +155,13 @@ const useStyles = createStyles(
|
|||
marginVertical: hp(0.2),
|
||||
backgroundColor: colors.surface,
|
||||
},
|
||||
followLocationContainer: {
|
||||
borderRadius: 4,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.outline,
|
||||
marginVertical: hp(4),
|
||||
backgroundColor: colors.surface,
|
||||
},
|
||||
checkboxItem: {
|
||||
paddingHorizontal: 6,
|
||||
},
|
||||
|
|
|
@ -33,8 +33,14 @@ async function onSubmit(args, context) {
|
|||
const [alertInput] = args;
|
||||
const { navigation } = context;
|
||||
|
||||
const { subject, level, callEmergency, notifyAround, notifyRelatives } =
|
||||
alertInput;
|
||||
const {
|
||||
subject,
|
||||
level,
|
||||
callEmergency,
|
||||
notifyAround,
|
||||
notifyRelatives,
|
||||
followLocation,
|
||||
} = alertInput;
|
||||
|
||||
const coords = await getCurrentLocation();
|
||||
|
||||
|
@ -62,6 +68,7 @@ async function onSubmit(args, context) {
|
|||
callEmergency,
|
||||
notifyAround,
|
||||
notifyRelatives,
|
||||
followLocation: !!followLocation,
|
||||
location,
|
||||
accuracy,
|
||||
altitude,
|
||||
|
|
Loading…
Add table
Reference in a new issue