zoukankan      html  css  js  c++  java
  • 使用react-native-blur

    1.

    • npm install react-native-blur --save
    • react-native link react-native-blur

    2.在安卓上只是link还是不够,还要配置,否则安装成功后还是闪退

      打开android/app/build.gradle,添加加黑的代码

      

    android {
        // make sure to use 23.0.3 or greater
        buildToolsVersion '23.0.3' // 这行与我根目录中的build.grale的版本一致
    
        // ...
        defaultConfig {
            // Add these lines below the existing config
            renderscriptTargetApi 23
            renderscriptSupportModeEnabled true
        }
    }

      下面的图片是从官网截图来的 

     

     3.在需要的项目文件中引入

    import { BlurView, VibrancyView } from "@react-native-community/blur";

    4.使用的时候一定要将以下2个放在一起,不然没有效果
    <BlurView
              style={styles.absolute}
              viewRef={this.state.viewRef}
              blurType="light"
              blurAmount={10}
            />
            <Image
              ref={img => {
                this.backgroundImage = img;
              }}
              source={{ uri }}
              style={styles.absolute}
              onLoadEnd={this.imageLoaded.bind(this)}
            />
     
  • 相关阅读:
    HTML特效代码大全
    PHP网站加网站访问量统计
    定时显示隐藏
    加入收藏 设为首页
    IP和归属地
    手机站的拨打电话和发短信
    Shell运算
    Shell命令替换与变量替换
    $* 和 $@ 的区别
    Shell特殊变量列表
  • 原文地址:https://www.cnblogs.com/lude1994/p/11113163.html
Copyright © 2011-2022 走看看