Files
iNaturalistReactNative/src/components/SharedComponents/KebabMenu.js
Amanda Bullington fa94ab5b42 ObsEdit - bottom sheets (#570)
* Add KebabMenu to shared components index

* Separate EvidenceList from PhotoCarousel component

* Remove unneeded props from PhotoCarousel

* Create notes bottom sheet

* Fix tests for delete obs sheet

* Add wild status sheet

* Show date from observations uploaded via website

* Move media viewer modal into evidence section

* Fix mock

* Move location fetching into its own hook

* Refactor ObsEdit header; move code into Header component

* Add discard changes sheet

* Styling updates and save changes button

* Add classes to buttons based on evidence/id missing

* Add imprecise location sheet

* Add jest.fn from provider to ObsEdit tests

* Remove fakeTimers from ObsEditWithoutProvider.test.js; minor cleanup

* Show discard obs sheet anytime a user tries to navigate back

* Fixes to bottom sheet backdrop, evidence, add discard changes sheet

* Switch to paper radio buttons instead of checkmarks

* Fix bottom sheet backdrop in android by wrapping with GestureHandlerRootView

* Update bottom sheet for add comment & notes

* Fix test

* Remove fake timer from ObsEdit test to get tests passing

* Force update github actions cache

---------

Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
2023-04-20 17:02:19 -07:00

43 lines
847 B
JavaScript

// @flow
import type { Node } from "react";
import React from "react";
import { IconButton, Menu } from "react-native-paper";
import viewStyles from "styles/sharedComponents/kebabMenu";
type Props = {
children: any,
visible: boolean,
setVisible: Function,
large?: boolean
}
const KebabMenu = ( {
children, visible, setVisible, large
}: Props ): Node => {
const openMenu = ( ) => setVisible( true );
const closeMenu = ( ) => setVisible( false );
const anchorButton = (
<IconButton
onPress={openMenu}
icon="kebab-menu"
testID="KebabMenu.Button"
size={large ? 26 : 15}
/>
);
return (
<Menu
visible={visible}
onDismiss={closeMenu}
contentStyle={viewStyles.menuContentStyle}
anchor={anchorButton}
>
{children}
</Menu>
);
};
export default KebabMenu;