expo-blur 12.3.1 → 12.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,19 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 12.4.0 — 2023-06-21
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Enable blurring by default when static rendering. ([#23000](https://github.com/expo/expo/pull/23000) by [@EvanBacon](https://github.com/EvanBacon))
18
+
19
+ ## 12.3.2 — 2023-06-13
20
+
21
+ ### 🐛 Bug fixes
22
+
23
+ - [iOS] Fixed Detox tests hanging when `BlurView` is present ([#22439](https://github.com/expo/expo/pull/22439) by [@behenate](https://github.com/behenate))
24
+ - Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
25
+
13
26
  ## 12.3.1 — 2023-05-08
14
27
 
15
28
  _This version does not introduce any user-facing changes._
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '12.3.1'
6
+ version = '12.4.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -35,19 +35,11 @@ buildscript {
35
35
  }
36
36
  }
37
37
 
38
- // Creating sources with comments
39
- task androidSourcesJar(type: Jar) {
40
- classifier = 'sources'
41
- from android.sourceSets.main.java.srcDirs
42
- }
43
-
44
38
  afterEvaluate {
45
39
  publishing {
46
40
  publications {
47
41
  release(MavenPublication) {
48
42
  from components.release
49
- // Add additional sourcesJar to artifacts
50
- artifact(androidSourcesJar)
51
43
  }
52
44
  }
53
45
  repositories {
@@ -70,15 +62,21 @@ android {
70
62
  jvmTarget = JavaVersion.VERSION_11.majorVersion
71
63
  }
72
64
 
65
+ namespace "expo.modules.blur"
73
66
  defaultConfig {
74
67
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
68
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
69
  versionCode 1
77
- versionName "12.3.1"
70
+ versionName "12.4.0"
78
71
  }
79
72
  lintOptions {
80
73
  abortOnError false
81
74
  }
75
+ publishing {
76
+ singleVariant("release") {
77
+ withSourcesJar()
78
+ }
79
+ }
82
80
  }
83
81
 
84
82
  dependencies {
@@ -1,2 +1,2 @@
1
- <manifest package="expo.modules.blur">
1
+ <manifest>
2
2
  </manifest>
@@ -9,6 +9,11 @@ export default class BlurView extends React.Component {
9
9
  }
10
10
  }
11
11
  function isBlurSupported() {
12
+ // TODO: Replace with CSS or static extraction to ensure hydration errors cannot happen.
13
+ // Enable by default in Node.js
14
+ if (typeof window === 'undefined') {
15
+ return true;
16
+ }
12
17
  // https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports
13
18
  // https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility
14
19
  return (typeof CSS !== 'undefined' &&
@@ -1 +1 @@
1
- {"version":3,"file":"BlurView.web.js","sourceRoot":"","sources":["../src/BlurView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAwB;IAClE,MAAM;QACJ,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACzE,MAAM,SAAS,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9E,OAAO,oBAAC,IAAI,OAAK,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,GAAI,CAAC;IACxD,CAAC;CACF;AAED,SAAS,eAAe;IACtB,gEAAgE;IAChE,yFAAyF;IACzF,OAAO,CACL,OAAO,GAAG,KAAK,WAAW;QAC1B,CAAC,GAAG,CAAC,QAAQ,CAAC,yBAAyB,EAAE,WAAW,CAAC;YACnD,GAAG,CAAC,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAChD,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE;IACvC,MAAM,KAAK,GAA2B;QACpC,eAAe,EAAE,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC;KACrD,CAAC;IAEF,IAAI,eAAe,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,uBAAuB,SAAS,GAAG,GAAG,KAAK,CAAC;QACzD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;QAC5B,iBAAiB;QACjB,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC;KACnC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\n\nimport { BlurViewProps } from './BlurView.types';\nimport getBackgroundColor from './getBackgroundColor';\n\nexport default class BlurView extends React.Component<BlurViewProps> {\n render() {\n const { tint = 'default', intensity = 50, style, ...props } = this.props;\n const blurStyle = getBlurStyle({ tint, intensity: Math.min(intensity, 100) });\n return <View {...props} style={[style, blurStyle]} />;\n }\n}\n\nfunction isBlurSupported(): boolean {\n // https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports\n // https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility\n return (\n typeof CSS !== 'undefined' &&\n (CSS.supports('-webkit-backdrop-filter', 'blur(1px)') ||\n CSS.supports('backdrop-filter', 'blur(1px)'))\n );\n}\n\nfunction getBlurStyle({ intensity, tint }): Record<string, string> {\n const style: Record<string, string> = {\n backgroundColor: getBackgroundColor(intensity, tint),\n };\n\n if (isBlurSupported()) {\n const blur = `saturate(180%) blur(${intensity * 0.2}px)`;\n style.backdropFilter = blur;\n // Safari support\n style.WebkitBackdropFilter = blur;\n }\n\n return style;\n}\n"]}
1
+ {"version":3,"file":"BlurView.web.js","sourceRoot":"","sources":["../src/BlurView.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAwB;IAClE,MAAM;QACJ,MAAM,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QACzE,MAAM,SAAS,GAAG,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QAC9E,OAAO,oBAAC,IAAI,OAAK,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,GAAI,CAAC;IACxD,CAAC;CACF;AAED,SAAS,eAAe;IACtB,wFAAwF;IACxF,+BAA+B;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,OAAO,IAAI,CAAC;KACb;IACD,gEAAgE;IAChE,yFAAyF;IACzF,OAAO,CACL,OAAO,GAAG,KAAK,WAAW;QAC1B,CAAC,GAAG,CAAC,QAAQ,CAAC,yBAAyB,EAAE,WAAW,CAAC;YACnD,GAAG,CAAC,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC,CAChD,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE;IACvC,MAAM,KAAK,GAA2B;QACpC,eAAe,EAAE,kBAAkB,CAAC,SAAS,EAAE,IAAI,CAAC;KACrD,CAAC;IAEF,IAAI,eAAe,EAAE,EAAE;QACrB,MAAM,IAAI,GAAG,uBAAuB,SAAS,GAAG,GAAG,KAAK,CAAC;QACzD,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;QAC5B,iBAAiB;QACjB,KAAK,CAAC,oBAAoB,GAAG,IAAI,CAAC;KACnC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import * as React from 'react';\nimport { View } from 'react-native';\n\nimport { BlurViewProps } from './BlurView.types';\nimport getBackgroundColor from './getBackgroundColor';\n\nexport default class BlurView extends React.Component<BlurViewProps> {\n render() {\n const { tint = 'default', intensity = 50, style, ...props } = this.props;\n const blurStyle = getBlurStyle({ tint, intensity: Math.min(intensity, 100) });\n return <View {...props} style={[style, blurStyle]} />;\n }\n}\n\nfunction isBlurSupported(): boolean {\n // TODO: Replace with CSS or static extraction to ensure hydration errors cannot happen.\n // Enable by default in Node.js\n if (typeof window === 'undefined') {\n return true;\n }\n // https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports\n // https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility\n return (\n typeof CSS !== 'undefined' &&\n (CSS.supports('-webkit-backdrop-filter', 'blur(1px)') ||\n CSS.supports('backdrop-filter', 'blur(1px)'))\n );\n}\n\nfunction getBlurStyle({ intensity, tint }): Record<string, string> {\n const style: Record<string, string> = {\n backgroundColor: getBackgroundColor(intensity, tint),\n };\n\n if (isBlurSupported()) {\n const blur = `saturate(180%) blur(${intensity * 0.2}px)`;\n style.backdropFilter = blur;\n // Safari support\n style.WebkitBackdropFilter = blur;\n }\n\n return style;\n}\n"]}
@@ -39,6 +39,15 @@ final class BlurEffectView: UIVisualEffectView {
39
39
 
40
40
  override func draw(_ rect: CGRect) {
41
41
  super.draw(rect)
42
+
43
+ // BlurView intensity relies on running an animation and making it partially complete. This means that there
44
+ // is a continually running animation, which makes detox hang (it waits for the animation to finish indefinitely).
45
+ // We can detect if detoxServer is running and in that case replace smooth intensity value with an on/off behaviour.
46
+ if isDetoxPresent() {
47
+ effect = intensity > 0 ? visualEffect : nil
48
+ return
49
+ }
50
+
42
51
  effect = nil
43
52
  animator?.stopAnimation(true)
44
53
  animator = UIViewPropertyAnimator(duration: 1, curve: .linear) { [unowned self] in
@@ -57,6 +66,12 @@ private func blurEffectStyleFrom(_ tint: String) -> UIBlurEffect.Style {
57
66
  }
58
67
  }
59
68
 
69
+ private func isDetoxPresent() -> Bool {
70
+ let args = ProcessInfo.processInfo.arguments
71
+
72
+ return args.contains("-detoxServer") && args.contains("-detoxSessionId")
73
+ }
74
+
60
75
  /**
61
76
  Property wrapper clamping the value between an upper and lower bound
62
77
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-blur",
3
- "version": "12.3.1",
3
+ "version": "12.4.0",
4
4
  "description": "A component that renders a native blur view on iOS and falls back to a semi-transparent view on Android. A common usage of this is for navigation bars, tab bars, and modals.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -43,5 +43,5 @@
43
43
  "peerDependencies": {
44
44
  "expo": "*"
45
45
  },
46
- "gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
46
+ "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
47
47
  }
@@ -13,6 +13,11 @@ export default class BlurView extends React.Component<BlurViewProps> {
13
13
  }
14
14
 
15
15
  function isBlurSupported(): boolean {
16
+ // TODO: Replace with CSS or static extraction to ensure hydration errors cannot happen.
17
+ // Enable by default in Node.js
18
+ if (typeof window === 'undefined') {
19
+ return true;
20
+ }
16
21
  // https://developer.mozilla.org/en-US/docs/Web/API/CSS/supports
17
22
  // https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter#Browser_compatibility
18
23
  return (