小编Ale*_*sky的帖子

WARN 没有为 React Native 中的关键 ReactNativeFirebaseMessagingHeadlessTask 注册任务?

react-native Firebase我使用和创建了推送通知react-native-push-notification。我已经实现了所有类型的通知,例如本地通知、计划背景通知和退出通知。但当我的应用程序处于退出状态时,我已通过FCM发送了推送通知。所以我在控制台上显示了一条警告,即WARN No task Registration for key ReactNativeFirebaseMessagingHeadlessTask。那我该如何解决呢。

代码:

import React, {Fragment, useEffect} from 'react';
import {StyleSheet, View, Text, Button} from 'react-native';
import PushNotification from 'react-native-push-notification';

import messaging from '@react-native-firebase/messaging';

//1
const checkPermission = () => {
  messaging()
    .hasPermission()
    .then((enabled) => {
      if (enabled) {
        getToken();
      } else {
        requestPermission();
      }
    })
    .catch((error) => {
      console.log('error checking permisions ' + error);
    });
};

//2
const requestPermission = () => {
  messaging()
    .requestPermission()
    .then(() …
Run Code Online (Sandbox Code Playgroud)

react-native firebase-cloud-messaging react-native-firebase react-native-push-notification

7
推荐指数
1
解决办法
2万
查看次数

Angular 4 组件响应式动画

我正在开发一个 Angular 响应式应用程序,它在移动设备上有一个抽屉。

我喜欢 Angular 中的 Web Animations API 实现,但我找不到可以根据媒体查询断点配置动画的地方。

我所能找到的只是通过我的 css 表取消动画,但这让我开始在我的项目中的不同地方传播代码,而且我不确定这是我想要做的 angular ......

现实生活中的例子

我的应用程序抽屉使用此代码制作动画

<div class="mobile-menu" [@animateDrawer]="drawerOpened">
  <!-- Drawer's menu goes here -->
</div>
Run Code Online (Sandbox Code Playgroud)

drawerOpened 是一个布尔值,当应用菜单按钮被按下时切换。

我的组件看起来像这样:

@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.scss'],
  animations: [
    trigger('animateDrawer', [
      state('inactive', style({
        transform: 'translate3d(-100%, 0, 0)'
      })),
      state('active', style({
        transform: 'translate3d(0, 0, 0)'
      }))
    ])
  ]
})
Run Code Online (Sandbox Code Playgroud)

我取消动画效果的CSS 代码

.mobile-menu {
  opacity: 1 !important;
  display: flex !important;
  transform: none !important;
}
Run Code Online (Sandbox Code Playgroud)

除了在我的 css 代码中操作所有内容并禁用 Desktop BreakPoint …

media-queries web-animations angular angular-animations

3
推荐指数
1
解决办法
8503
查看次数

如何在anime.js 中使用“seek”来控制滚动时的动画?举个例子,请

更新的anime.js 文档(Controls->Seek)说你可以在滚动时控制动画,但是没有例子。

谁能举例说明如何设置animation.seek?

https://animejs.com/documentation/#seekAnim

var animation = anime({
  targets: '.seek-anim-demo .el',
  translateX: 270,
  delay: function(el, i) { return i * 100; },
  elasticity: 200,
  easing: 'easeInOutSine',
  autoplay: false
});

var seekProgressEl = document.querySelector('.seek-anim-demo .progress');
seekProgressEl.oninput = function() {
  animation.seek(animation.duration * (seekProgressEl.value / 100));
};
Run Code Online (Sandbox Code Playgroud)

scroll seek anime.js

3
推荐指数
1
解决办法
6571
查看次数

如何使用 Angular 6 发送带有正确标头的 OAuth2 POST 请求?

我需要向 Spring Boot OAuth 2 授权服务器发送 post 请求以获取 JWT 令牌?使用 Postman 我得到了令牌并且 Auth 服务器工作正常。但是使用 Angular 我很难找出正确的发布请求格式?

这是我目前使用的方法。

login() {
  const url = 'http://localhost:9090/oauth/token';

  const data = {
    'grant_type': 'password',
    'username': 'username',
    'password': 'password'
  };

  const reqH = new HttpHeaders({
    'Content-Type': 'application/x-www-urlencoded',
    'Authorization': 'Basic ' + btoa('client-id' + ':' + 'secret'),
    'grant_type': 'password',
    'username': 'administrator%40divinedragon.com',
    'password': 'password'
  });

  return this.http.post('http://localhost:9090/oauth/token', data, {
    headers: reqH
  });
}
Run Code Online (Sandbox Code Playgroud)

使用此方法时,出现以下错误。

HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "OK", url: "http://localhost:9090/oauth/token", ok: false, ...},

错误:{错误:“invalid_request”,error_description:“缺少授权类型”}

非常感谢帮助!

oauth oauth-2.0 jwt angular

2
推荐指数
1
解决办法
6175
查看次数