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)}
            />
     
  • 相关阅读:
    JavaScript常用正則表達式
    详尽解析window.event对象
    DWR的类却无法在js里用
    javascript控制小数点精度
    49. Group Anagrams
    48. Rotate Image
    64. Minimum Path Sum
    63. Unique Paths II
    62. Unique Paths
    53. Maximum Subarray
  • 原文地址:https://www.cnblogs.com/lude1994/p/11113163.html
Copyright © 2011-2022 走看看