mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-03-04 04:13:49 +01:00
FIX: float button styles
This commit is contained in:
parent
de27d7a5c1
commit
27ceb71c4e
2 changed files with 6 additions and 10 deletions
|
@ -5,7 +5,7 @@ import { View, Text, TouchableOpacity, StyleSheet, Dimensions, PixelRatio } from
|
||||||
import { BlueCurrentTheme } from './themes';
|
import { BlueCurrentTheme } from './themes';
|
||||||
|
|
||||||
const BORDER_RADIUS = 30;
|
const BORDER_RADIUS = 30;
|
||||||
const ICON_MARGIN = 5;
|
const ICON_MARGIN = 7;
|
||||||
|
|
||||||
const cStyles = StyleSheet.create({
|
const cStyles = StyleSheet.create({
|
||||||
root: {
|
root: {
|
||||||
|
@ -32,7 +32,7 @@ export const FContainer = ({ children }) => {
|
||||||
const onLayout = event => {
|
const onLayout = event => {
|
||||||
if (flag.current) return;
|
if (flag.current) return;
|
||||||
const { width } = event.nativeEvent.layout;
|
const { width } = event.nativeEvent.layout;
|
||||||
const maxWidth = Dimensions.get('window').width - BORDER_RADIUS * 2 - 10;
|
const maxWidth = Dimensions.get('window').width - BORDER_RADIUS - 10;
|
||||||
const len = React.Children.count(children);
|
const len = React.Children.count(children);
|
||||||
const newWidth = width * len > maxWidth ? Math.floor(maxWidth / len) : Math.ceil(width + ICON_MARGIN);
|
const newWidth = width * len > maxWidth ? Math.floor(maxWidth / len) : Math.ceil(width + ICON_MARGIN);
|
||||||
setNewWidth(newWidth);
|
setNewWidth(newWidth);
|
||||||
|
@ -89,12 +89,12 @@ export const FButton = ({ text, icon, width, first, last, ...props }) => {
|
||||||
if (width) {
|
if (width) {
|
||||||
let totalWidth = width;
|
let totalWidth = width;
|
||||||
if (first) {
|
if (first) {
|
||||||
style.paddingLeft = BORDER_RADIUS;
|
style.paddingLeft = BORDER_RADIUS / 2;
|
||||||
totalWidth += BORDER_RADIUS;
|
totalWidth += BORDER_RADIUS / 2;
|
||||||
}
|
}
|
||||||
if (last) {
|
if (last) {
|
||||||
style.paddingRight = BORDER_RADIUS;
|
style.paddingRight = BORDER_RADIUS / 2;
|
||||||
totalWidth += BORDER_RADIUS;
|
totalWidth += BORDER_RADIUS / 2;
|
||||||
}
|
}
|
||||||
style.width = totalWidth;
|
style.width = totalWidth;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,14 +161,10 @@ const styles = StyleSheet.create({
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
},
|
},
|
||||||
sendIcon: {
|
sendIcon: {
|
||||||
left: 5,
|
|
||||||
transform: [{ rotate: '225deg' }],
|
transform: [{ rotate: '225deg' }],
|
||||||
marginRight: 8,
|
|
||||||
},
|
},
|
||||||
receiveIcon: {
|
receiveIcon: {
|
||||||
left: 5,
|
|
||||||
transform: [{ rotate: '-45deg' }],
|
transform: [{ rotate: '-45deg' }],
|
||||||
marginRight: 8,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue