Files
iNaturalistReactNative/src/components/Match/SaveDiscardButtons.js
Amanda Bullington 4652929056 UI for Match Screen after AICamera (#2598)
* Save TaxonPhoto to realm; display taxon on match screen

* Code tweaks

* Add match screen to navigation after AI camera in debug/default mode

* Fix test and refactor

* Fix issue with infinite renders in useLayoutPrefs
2025-01-08 14:28:16 -08:00

58 lines
1.2 KiB
JavaScript

import {
ButtonBar
} from "components/SharedComponents";
import { View } from "components/styledComponents";
import type { Node } from "react";
import React from "react";
import { useTranslation } from "sharedHooks";
import { getShadow } from "styles/global";
const DROP_SHADOW = getShadow( {
offsetHeight: -3,
shadowOpacity: 0.2
} );
type Props = {
handlePress: Function
}
const SaveDiscardButtons = ( {
handlePress
}: Props ): Node => {
const { t } = useTranslation( );
const saveButton = {
title: t( "SAVE" ),
onPress: ( ) => handlePress( "save" ),
isPrimary: true,
testID: "MatchScreen.saveButton",
level: "focus",
className: "ml-3 grow"
};
const discardButton = {
title: t( "DISCARD" ),
onPress: ( ) => handlePress( "discard" ),
isPrimary: false,
testID: "MatchScreen.discardButton",
level: "neutral",
className: "px-[15px]"
};
const buttonConfiguration = [discardButton, saveButton];
return (
<View
className="bg-white"
style={DROP_SHADOW}
>
<ButtonBar
buttonConfiguration={buttonConfiguration}
containerClass="p-[20px]"
/>
</View>
);
};
export default SaveDiscardButtons;