带弧/驼峰的底部标签导航

时间:2018-12-23 15:31:07

标签: react-native react-navigation floating-action-button bottomnavigationview

enter image description here

如何在react native中创建如上所述的内容?

1 个答案:

答案 0 :(得分:0)

我已经完成了ART Library。它不是很完美,但是可以给我一个主意,请检查小吃。

enter image description here https://snack.expo.io/@nazrdogan/intrigued-yogurt

import * as React from 'react';
import { Text, View, StyleSheet, ART, Dimensions } from 'react-native';
import { Constants } from 'expo';
const { Surface, Group, Shape, Path } = ART;
import { Card } from 'react-native-paper';
import { IconButton, Colors, FAB } from 'react-native-paper';
const MyComponent = () => (
  <FAB style={styles1.fab} onPress={() => console.log('Pressed')} />
);
const styles1 = StyleSheet.create({
  fab: {
    position: 'absolute',
    alignSelf: 'center',
    bottom: 30,
  },
});
export default class App extends React.Component {
  render() {
    let deviceWidth = Dimensions.get('window').width;
    return (
      <View style={styles.container}>
        <View>
          <Surface width={deviceWidth} height={60}>
            <Shape
              d={new Path()
                .moveTo(0, 0)
                .lineTo(0, deviceWidth)
                .lineTo(deviceWidth, deviceWidth)
                .lineTo(deviceWidth, 0)
                .move(-deviceWidth / 2 + 60, 0)
                .arc(-120, 0, 80, 120)
                .close()}
              fill={'#f00'}
            />
          </Surface>
          <IconButton
            style={{ left: 0, position: 'absolute', zIndex: 100 }}
            icon="add-a-photo"
            color={'white'}
            size={30}
            onPress={() => console.log('Pressed')}
          />
          <MyComponent />
          <IconButton
            style={{ right: 0, position: 'absolute', zIndex: 100 }}
            icon="add-a-photo"
            color={'white'}
            size={30}
            onPress={() => console.log('Pressed')}
          />
        </View>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    paddingTop: Constants.statusBarHeight,
    backgroundColor: '#ecf0f1',
  },
});