【问题标题】:Bottom Tab Navigation with an arc/hump带有弧形/驼峰的底部选项卡导航
【发布时间】:2019-05-23 02:40:14
【问题描述】:

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

【问题讨论】:

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


    【解决方案1】:

    我已经完成了 ART 库。它并不完美,但它可以给出想法请检查零食。

    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',
      },
    });

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-02-02
      • 2020-06-16
      • 2022-12-26
      • 2020-06-05
      • 1970-01-01
      • 2020-12-02
      • 2021-09-10
      • 1970-01-01
      相关资源
      最近更新 更多