Add AddItem page base

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2023-07-10 10:25:38 +03:00
parent ab6aa76fa2
commit f64588b17c
9 changed files with 888 additions and 129 deletions

View File

@@ -1,8 +1,9 @@
import * as React from 'react';
import { StyleSheet } from 'react-native';
import { FAB, Portal } from 'react-native-paper';
import { noOp } from '../constants';
import { verticalScale } from '../styles';
import { ParamListBase, useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
const styles = StyleSheet.create({
fab: {
@@ -10,40 +11,42 @@ const styles = StyleSheet.create({
},
});
const FloatingActionButton = () => {
const FloatingActionButton = ({ visible }: { visible?: boolean }) => {
const [state, setState] = React.useState(false);
const { navigate } =
useNavigation<NativeStackNavigationProp<ParamListBase>>();
return (
<Portal>
<FAB.Group
open={state}
visible
visible={visible ?? true}
icon={state ? 'image' : 'plus'}
actions={[
{
icon: 'tag',
label: 'Tag',
onPress: () => noOp,
onPress: () => navigate('Add Item'),
},
{
icon: 'note-text',
label: 'Text',
onPress: () => noOp,
onPress: () => navigate('Add Item'),
},
{
icon: 'microphone',
label: 'Audio',
onPress: () => noOp,
onPress: () => navigate('Add Item'),
},
{
icon: 'image-album',
label: 'Album',
onPress: () => noOp,
onPress: () => navigate('Add Item'),
},
]}
onStateChange={({ open }) => setState(open)}
onPress={() => {
if (state) noOp;
if (state) navigate('Add Item');
}}
style={styles.fab}
/>