Giter Club home page Giter Club logo

react-native-multitask-blur's Introduction

react-native-multitask-blur

Blur screen on switch mode with specific screen

Installation

npm install react-native-multitask-blur

iOS

  • In AppDelegate.m
      @implementation AppDelegate
      ...
      NSNumber* blur = 0;
      ...
      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
      {
          ...
          [[NSNotificationCenter defaultCenter] addObserver:self
            selector:@selector(receiveTestNotification:)
            name:@"onBlur"
            object:nil];
          ...
      }
      ...
      - (void) receiveTestNotification:(NSNotification *) notification
      {
    
          if ([[notification name] isEqualToString:@"onBlur"]){
              NSDictionary* userInfo = notification.userInfo;
              NSNumber* isBlur = (NSNumber*)userInfo[@"isBlur"];
              blur = isBlur;
              NSLog (@"%@", isBlur);
          }
              
      }
      ...
      
      - (void)applicationWillResignActive:(UIApplication *)application{
          ...
          if(blur.intValue == 1){
              UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
              UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
              //always fill the view
              blurEffectView.frame = self.window.bounds;
              blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
              blurEffectView.tag = 181099;
              [self.window addSubview:blurEffectView];
          }
          ...
      }
    
      - (void)applicationDidBecomeActive:(UIApplication *)application{
          ...
          [[self.window viewWithTag:181099] removeFromSuperview];
          ...
      }
    

Android

  • No need to config ๐Ÿ˜‚.

Usage

import MultitaskBlur from "react-native-multitask-blur";

// ...

MultitaskBlur.blur(); // For blur on multitask switch mode
MultitaskBlur.unBlur(); // For unblur on multitask switch mode

Demo iOS

Demo Android

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

react-native-multitask-blur's People

Contributors

raden-hor avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

lab256-tech

react-native-multitask-blur's Issues

Android resource linking failed

`> Task :react-native-multitask-blur:verifyReleaseResources FAILED
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/username/.gradle/caches/transforms-3/61b7a8ae1182ce233ca54e9c675b993a/transformed/core-1.7.0/res/values/values.xml","position":{"startLine":104,"startColumn":4,"startOffset":6400,"endLine":113,"endColumn":24,"endOffset":6854}}],"original":"ERROR:/Users/username/.gradle/caches/transforms-3/61b7a8ae1182ce233ca54e9c675b993a/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.\n ","tool":"AAPT"}

Execution failed for task ':react-native-multitask-blur:verifyReleaseResources'.

A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
Android resource linking failed
ERROR:/Users/username/.gradle/caches/transforms-3/61b7a8ae1182ce233ca54e9c675b993a/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
`.

Could you update the package for the newer .gradle versions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.