Add meme-adding logic

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2023-07-21 09:46:13 +03:00
parent 1b2ce96c5e
commit 4b601872bc
40 changed files with 1037 additions and 324 deletions

View File

@@ -3,8 +3,10 @@ import { Keyboard } from 'react-native';
import { FAB } from 'react-native-paper';
import { ParamListBase, useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { pick } from 'react-native-document-picker';
import { useDimensions } from '../contexts';
import { ROUTE } from '../types';
import { allowedMimeTypes, noOp } from '../utilities';
const FloatingActionButton = ({ visible = true }: { visible?: boolean }) => {
const { navigate } =
@@ -39,22 +41,34 @@ const FloatingActionButton = ({ visible = true }: { visible?: boolean }) => {
{
icon: 'tag',
label: 'Tag',
onPress: () => navigate(ROUTE.EDIT_TAG),
onPress: () => navigate(ROUTE.ADD_TAG),
},
{
icon: 'note-text',
label: 'Text',
onPress: () => navigate(ROUTE.EDIT_MEME),
onPress: () => {
throw new Error('Not yet implemented');
},
},
{
icon: 'image-album',
label: 'Album',
onPress: () => navigate(ROUTE.EDIT_MEME),
onPress: async () => {
const res = await pick({
allowMultiSelection: true,
type: allowedMimeTypes,
}).catch(noOp);
if (!res) return;
navigate(ROUTE.ADD_MEME, { uri: res });
},
},
]}
onStateChange={({ open }) => setState(open)}
onPress={() => {
if (state) navigate(ROUTE.EDIT_MEME);
onPress={async () => {
if (!state) return;
const res = await pick({ type: allowedMimeTypes }).catch(noOp);
if (!res) return;
navigate(ROUTE.ADD_MEME, { uri: res });
}}
style={{
paddingBottom: responsive.verticalScale(75),