Skip to content

refactor: iOS Surface major refactoring #3738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 20, 2023
52 changes: 50 additions & 2 deletions example/src/Examples/SurfaceExample.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { StyleSheet } from 'react-native';
import { StyleSheet, View } from 'react-native';

import { MD3Elevation, Surface, Text } from 'react-native-paper';
import { MD3Elevation, Surface, Text, MD3Colors } from 'react-native-paper';

import { useExampleTheme } from '..';
import { isWeb } from '../../utils';
Expand Down Expand Up @@ -31,6 +31,23 @@ const SurfaceExample = () => {
</Text>
</Surface>
))}

<View style={styles.horizontalSurfacesContainer}>
<Surface style={styles.horizontalSurface}>
<Text style={styles.centerText}>Left</Text>
</Surface>
<Surface style={styles.horizontalSurface}>
<Text style={styles.centerText}>Right</Text>
</Surface>
</View>
<View style={styles.verticalSurfacesContainer}>
<Surface style={styles.verticalSurface}>
<Text style={styles.centerText}>Top</Text>
</Surface>
<Surface style={styles.verticalSurface}>
<Text style={styles.centerText}>Bottom</Text>
</Surface>
</View>
</ScreenWrapper>
);
};
Expand Down Expand Up @@ -61,6 +78,37 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},

horizontalSurfacesContainer: {
flexDirection: 'row',
justifyContent: 'space-between',
width: '100%',
marginBottom: 20,
borderColor: MD3Colors.tertiary50,
padding: 10,
borderWidth: 1,
},
horizontalSurface: {
width: '48%',
},

verticalSurfacesContainer: {
height: 400,
justifyContent: 'space-between',
width: '100%',
marginBottom: 100,
borderColor: MD3Colors.tertiary50,
padding: 10,
borderWidth: 1,
},
verticalSurface: {
height: '48%',
justifyContent: 'center',
},

centerText: {
textAlign: 'center',
},
});

export default SurfaceExample;
5 changes: 1 addition & 4 deletions src/components/FAB/FAB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ const FAB = forwardRef<View, Props>(
},
],
},
styles.container,
!isV3 && styles.elevated,
!isV3 && disabled && styles.disabled,
style,
Expand All @@ -286,6 +285,7 @@ const FAB = forwardRef<View, Props>(
accessibilityRole="button"
accessibilityState={newAccessibilityState}
testID={testID}
style={{ borderRadius }}
>
<View
style={[styles.content, label ? extendedStyle : fabStyle]}
Expand Down Expand Up @@ -330,9 +330,6 @@ const styles = StyleSheet.create({
elevated: {
elevation: 6,
},
container: {
overflow: 'hidden',
},
content: {
flexDirection: 'row',
alignItems: 'center',
Expand Down
Loading