Folks I am following a design that have: image and the bottom navbar have that unique background, I am wondering how to make it in react native or what exactly is that background name?
The difficulties are: getting the background to be like the design what I accomplished are: getting design right until bottom navbar my question: how to make it in RN or where can I search for a solution? Thanks in advance !

<Tab.Navigator
  initialRouteName="home"
  screenOptions={{
    tabBarShowLabel: false,
    headerShown: false,
    tabBarStyle: {
      backgroundColor:
        "radial-gradient(circle, rgba(6,12,28,1) 0%, rgba(121,164,193,1) 53%, rgba(177,207,240,1) 100%)",
      position: "absolute",
      elevation: 0,
      opacity: 0.9,
      height: heightscale(70),
      alignItems: "center",
      borderRadius: 20,
      shadowColor: "#000",
      bottom: heightscale(20),
      padding: moderateScale(10),
      justifyContent: "center",
      marginHorizontal: moderateScale(20),
    },
  }}
>
  <Tab.Screen
    name="home"
    component={Home}
    options={{
      tabBarIcon: ({ focused }) => (
        <View style={{ alignItems: "center", justifyContent: "center" }}>
          {focused ? (
            <Homeiconsolid size={30} color={"#2683f1"} />
          ) : (
            <HomeIcon size={30} color={focused ? "#2683f1" : "#748c94"} />
          )}
        </View>
      ),
    }}
  />
  <Tab.Screen
    name="Search"
    component={Search}
    options={{
      tabBarIcon: ({ focused }) => (
        <View style={{ alignItems: "center", justifyContent: "center" }}>
          {focused ? (
            <Searchiconsolid size={30} color={"#2683f1"} />
          ) : (
            <MagnifyingGlassIcon
              size={30}
              color={focused ? "#2683f1" : "#748c94"}
            />
          )}
        </View>
      ),
    }}
  />
  <Tab.Screen
    name="Favorite"
    component={Bookmark}
    options={{
      tabBarIcon: ({ focused }) => (
        <View style={{ alignItems: "center", justifyContent: "center" }}>
          {focused ? (
            <Bookmarkiconsolid
              size={30}
              color={focused ? "#2683f1" : "#748c94"}
            />
          ) : (
            <BookmarkIcon size={30} color={focused ? "#2683f1" : "#748c94"} />
          )}
        </View>
      ),
    }}
  />
  <Tab.Screen
    name="Profile"
    component={Profile}
    options={{
      tabBarIcon: ({ focused }) => (
        <View style={{ alignItems: "center", justifyContent: "center" }}>
          {focused ? (
            <Usericonsolid size={30} color={"#2683f1"} />
          ) : (
            <UserIcon size={30} color={focused ? "#2683f1" : "#748c94"} />
          )}
        </View>
      ),
    }}
  />
</Tab.Navigator>;

推荐答案

底部导航栏中的模糊效果可以通过使用包@react-native-community/blur来实现.

https://www.npmjs.com/package/@react-native-community/blur

我在我的一个项目中实现了这一点,看起来是这样的.

enter image description here

Note: This package can not be applied directly to your Tab navigation.

为了能够使用这个包,您需要创建一个主屏幕,该主屏幕将在状态更改时呈现其他屏幕,并在状态返回False时隐藏它们.

<View>
  {screenSelection?.home === true ? <Home /> : null}

  {screenSelection?.goal === true ? <Goals /> : null}

  {screenSelection?.account === true ? <Account /> : null}

  {screenSelection?.notification === true ? <Notifications /> : null}
</View>

要在屏幕上添加模糊效果,请像这样使用BlurView

<View style={styles.bottomBarStyle}>
  <BlurView
    style={{
      position: "absolute",
      top: 0,
      left: 0,
      bottom: 0,
      right: 0,
    }}
    blurType="light"
    blurAmount={6}
    reducedTransparencyFallbackColor="white"
  />

  <TouchableOpacity
    style={styles?.bottomTabStyle}
    onPress={() => handleScreenSelection("home")}
  >
    <Image
      resizeMode={"contain"}
      source={
        screenSelection?.home === true
          ? require("../../images/home_selected.png")
          : require("../../images/home_faded.png")
      }
    />       
  </TouchableOpacity>

  <TouchableOpacity
    style={styles?.bottomTabStyle}
    onPress={() => handleScreenSelection("target")}
  >
    <Image
      resizeMode={"contain"}
      source={
        screenSelection?.goal === true
          ? require("../../images/target_selected.png")
          : require("../../images/target_faded.png")
      }
    />       
  </TouchableOpacity>

  <TouchableOpacity
    style={styles?.bottomTabStyle}
    onPress={() => handleScreenSelection("notification")}
  >        
    <Image
      resizeMode={"contain"}
      source={
        screenSelection?.notification === true
          ? require("../../images/bell_selected.png")
          : require("../../images/bell_faded.png")
      }
    />    
  </TouchableOpacity>

  <TouchableOpacity
    style={styles?.bottomTabStyle}
    onPress={() => handleScreenSelection("account")}
  >
    <Image
      resizeMode={"contain"}
      source={
        screenSelection?.account === true
          ? require("../../images/profile_selected.png")
          : require("../../images/profile_faded.png")
      }
    />        
  </TouchableOpacity>
</View>;

BlurView以上的所有内容都将变得模糊,因此我们将创建一个视图,并根据UI设计为其提供样式.低于BlurView的组件将在模糊组件上正确渲染.

React-native相关问答推荐

Redux将旧状态迁移到新状态

Redux toolkit通过按钮操作进行查询

React-Native-Web 错误:rnw_blogpost.bundle.js:1414 Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')

useState 函数似乎阻止了 Animated.timing 事件?

React Native - 何时调用componentWillUnmount?

我如何限制 FlatList 中的元素并增加负载?

在 React Native 中从 Modal 打开 Modal

如何使用 AND/OR 运算符过滤列表/查询 AWS Amplify JavaScript GraphQL

React Native 用于低互联网带宽的小型 apk APP应用

从堆栈导航器中删除屏幕

以编程方式在 React Native 中添加组件

No such property: ABI for class: org.gradle.api.tasks.OutputFile

将图标添加到drawer抽屉react-navigation v5

react native如何访问文件系统?

FlatList vs map react-native

react-navigation模式高度

React Native - 为什么执行这个函数?

React Native:使用选项卡动画收缩标题

手动调用 React.PropTypes 验证 React native "^0.30.0"

在 React Native 中,两个等宽的按钮水平填充屏幕