Skip to content

Commit 72d9056

Browse files
committed
Custom button Dock
1 parent 02cf681 commit 72d9056

File tree

7 files changed

+96
-88
lines changed

7 files changed

+96
-88
lines changed

src/components/common/ComponentCard.js

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from 'react';
2+
import { Modal, View, StyleSheet, Platform } from 'react-native';
3+
4+
const CustomButtonDock = ({
5+
direction = "vertical", // "vertical" oder "horizontal"
6+
firstButton,
7+
secondButton,
8+
}) => {
9+
return (
10+
<Modal transparent={true} animationType="none" visible={true}>
11+
{/* Der umgebende Container sorgt dafür, dass der Dock unten angeordnet wird */}
12+
<View style={styles.modalContainer} pointerEvents="box-none">
13+
<View style={[styles.container, direction === "horizontal" ? styles.horizontal : styles.vertical]}>
14+
{firstButton && <View style={styles.button}>{firstButton}</View>}
15+
{secondButton && <View style={styles.button}>{secondButton}</View>}
16+
</View>
17+
</View>
18+
</Modal>
19+
);
20+
};
21+
22+
const styles = StyleSheet.create({
23+
modalContainer: {
24+
flex: 1, // Dieses Element wird über alle anderen Elemente sichtbar
25+
justifyContent: 'flex-end', // Dadurch wird der Inhalt am unteren Rand positioniert
26+
},
27+
container: {
28+
width: '100%',
29+
backgroundColor: '#3434',
30+
padding: 10,
31+
paddingBottom: Platform.OS === 'ios' ? 20 : 10,
32+
},
33+
vertical: {
34+
flexDirection: 'column',
35+
},
36+
horizontal: {
37+
flexDirection: 'row',
38+
justifyContent: 'space-around',
39+
},
40+
button: {
41+
margin: 5,
42+
},
43+
});
44+
45+
export default CustomButtonDock;
File renamed without changes.

src/navigation/AppNavigator.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import HomeIcon from '../../assets/icons/Navigation/homeIcon';
2222
import TemplatesIcon from '../../assets/icons/Navigation/templateIcon';
2323
import SettingsIcon from '../../assets/icons/Navigation/settingsIcon';
2424
import BackIcon from '../../assets/icons/svg_js/backIcon';
25+
import ButtonDockScreen from '../screens/PreviewScreens/buttonDockScreen';
2526

2627

2728
const MainStack = createNativeStackNavigator();
@@ -62,6 +63,7 @@ function MainStackScreen() {
6263
<MainStack.Screen name="TopNavigationScreen" component={TopNavigationScreen} options={{ title: "Top Navigation" }} />
6364
<MainStack.Screen name="NotificationBadgeScreen" component={NotificationBadgeScreen} options={{ title: "Notification badge" }} />
6465
<MainStack.Screen name='CustomCardScreen' component={CustomCardScreen} options={{ title: 'Custom Card' }} />
66+
<MainStack.Screen name='CustomButtonDockScreen' component={ButtonDockScreen} options={{ title: 'Button Dock' }} />
6567
</MainStack.Navigator>
6668
);
6769
}

src/screens/Main/HomeScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default function HomeScreen() {
4545
title="Button Dock"
4646
description="Component"
4747
size="lg"
48-
onPress={() => changePage("ButtonScreen")}
48+
onPress={() => changePage("CustomButtonDockScreen")}
4949
/>
5050

5151
{/* Notification Badge */}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { View, Text, StyleSheet } from 'react-native'
2+
import React from 'react'
3+
import { colors, paddings, textStyles } from '../../style';
4+
import CustomButton from '../../components/common/CustomButton';
5+
import CustomIcon from '../../../assets/icons/svg_js/customIcon';
6+
import { ScrollView } from 'react-native-gesture-handler';
7+
import CustomButtonIcon from '../../components/common/CustomButtonIcon';
8+
import CustomButtonDock from '../../components/common/CustomButtonDock';
9+
10+
const ButtonDockScreen = () => {
11+
return (
12+
<ScrollView style={styles.container}>
13+
{/* TYPE */}
14+
<Text style={{ ...textStyles.text_lg_semibold, paddingBottom: paddings.p_8 }}>Type</Text>
15+
<Text style={{ ...textStyles.text_sm_regular, color: colors.grey500, paddingBottom: paddings.p_32 }}>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor.</Text>
16+
<View style={styles.buttonContainer}>
17+
<CustomButtonDock
18+
firstButton={<CustomButton text="Primary" type="primary" />}
19+
/>
20+
</View>
21+
</ScrollView>
22+
)
23+
}
24+
25+
const styles = StyleSheet.create({
26+
container: {
27+
flex: 1,
28+
paddingHorizontal: paddings.p_16,
29+
paddingVertical: paddings.p_32,
30+
backgroundColor: colors.white
31+
},
32+
buttonContainer: {
33+
gap: paddings.p_16,
34+
paddingBottom: paddings.p_32,
35+
},
36+
buttonRow: {
37+
flexDirection: 'row',
38+
gap: paddings.p_16,
39+
},
40+
buttonWrapper: {
41+
width: "auto",
42+
flexDirection: 'row',
43+
gap: paddings.p_16,
44+
},
45+
});
46+
47+
export default ButtonDockScreen

src/screens/PreviewScreens/inputFieldScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { View, Text, StyleSheet } from 'react-native';
22
import React, { useState } from 'react';
33
import { colors, paddings, textStyles } from '../../style';
4-
import CustomInput from '../../components/inputs/CustomInput';
4+
import CustomInput from '../../components/common/CustomInput';
55
import PlusIcon from '../../../assets/icons/svg_js/plusIcon';
66
import { ScrollView } from 'react-native-gesture-handler';
77

0 commit comments

Comments
 (0)