Why do I get an error for [RNFirebaseMessaging instance]? - react-native-firebase

As per the instructions at https://rnfirebase.io/docs/v4.3.x/notifications/ios , I added the following to my AppDelegate.m:
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[[RNFirebaseNotifications instance] didReceiveLocalNotification:notification];
}
However, I get this error:
No known class method for selector 'instance'
Question 1: Why?
Note: I'm not importing RNFirebaseNotifications.h

The docs for setup react-native-firebase and settings up the Messaging / Notification modules are really confusing.
Import BOTH:
#import "RNFirebaseNotifications.h"
#import "RNFirebaseMessaging.h"
and it should fix your issue.

Related

How to avoid "Component is declared but its value is never read." when I use Vue3 setup syntax?

<template>
<ConfigProvider :locale="getAntdLocale">
<AppProvider>
<RouterView />
</AppProvider>
</ConfigProvider>
</template>
<script lang="ts" setup>
import { ConfigProvider } from 'ant-design-vue';
import { AppProvider } from '/#/components/Application';
import { useTitle } from '/#/hooks/web/useTitle';
import { useLocale } from '/#/locales/useLocale';
// support Multi-language
const { getAntdLocale } = useLocale();
// Listening to page changes and dynamically changing site titles
useTitle();
</script>
Vetur shows this warning:
'ConfigProvider' is declared but its value is never read.Vetur(6133)
'getAntdLocale' is declared but its value is never read.Vetur(6133)
It seems the template can't read the script with setup syntax variable. How can I avoid this warning?
Vetur has no support for script setup yet - it is planned for v0.37.0 (current version is 0.34.1)
As of now, Volar is better choice for using script setup and TS and is recommended even by Evan You (Vue creator). I'm using it and it is really great!
UPDATE:
And with Vue 3 as the New Default, Volar is recommended in official Vue 3 docs

React Native notification image doesn't showing on IOS

I have currently a problem to display image in notification (with an url).
The problem is only on iOS, it works on Android.
I'm using React Native Firebase :
It works on Android but not in iOS.
I have created the Notification Service and i have followed the react-native-firebase documentation and the image still doesn't appear.
NotificationService.m
#import "NotificationService.h"
#import "FirebaseMessaging.h"
#interface NotificationService ()
#property (nonatomic, strong) void (^contentHandler).
(UNNotificationContent *contentToDeliver);
#property (nonatomic, strong) UNMutableNotificationContent
*bestAttemptContent;
#end
#implementation NotificationService
- (void)didReceiveNotificationRequest:(UNNotificationRequest
*)request withContentHandler:(void (^)(UNNotificationContent *
_Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
[[FIRMessaging extensionHelper]
populateNotificationContent:self.bestAttemptContent
withContentHandler:contentHandler];
}
- (void)serviceExtensionTimeWillExpire {
// Called just before the extension will be terminated by the.
system.
// Use this as an opportunity to deliver your "best attempt" at
modified content, otherwise the original push payload will be
used.
self.contentHandler(self.bestAttemptContent);
}
#end
NotificationService.h
#import <UserNotifications/UserNotifications.h>
#interface NotificationService : UNNotificationServiceExtension
#end
I received the notification json with the fcm_options (image) but it doesn't appear.
Info.plist
NotificationService.m
NotificationService.h
Notification Code
Notification Code Bis
Thanks you.
I have the same problem.
I have followed the react-native-firebase documentation
But when "NotivicationService" in my picture is "ImageNotification" created by xcode, It's "OS Deployment Target" is different the main project "Sitesurveillance" "OS Deployment Target"
Before change ImageNotification target 15.2 and main project target 11.0.
I solved it by change "ImageNotification" > "Build Setting" > "OS Deployment Target" like the "Sitesurveiilance" > "Build Setting" > "OS Deployment Target" is 11.0
this is my project build setting
Edited a bit for clarity

Can't compile material-components with webpack-encore

yarn encore dev fail after setting up material-components
I installed material-components using yarn add material-components-web --dev
and then configured app.js like this :
/* --- CSS --- */
import "../css/normalize.scss";
import "material-components-web/material-components-web.scss"
import "../css/layout.scss";
import "../css/style.scss";
/* --- RESOURCES ---*/
import $ from "jquery";
import * as mdc from "material-components-web";
When running yarn encore dev, I get the following error :
ERROR Failed to compile with 1 errors 22:30:40
error in ./node_modules/material-components-web/material-components-web.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/sass-loader/lib/loader.js):
#import "#material/elevation/mixins";
^
File to import not found or unreadable: #material/elevation/mixins.
in /var/www/vhosts/salon-virtuel/node_modules/#material/button/_mixins.scss (line 23, column 1)
at runLoaders (/var/www/vhosts/salon-virtuel/node_modules/webpack/lib/NormalModule.js:301:20)
at /var/www/vhosts/salon-virtuel/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /var/www/vhosts/salon-virtuel/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/var/www/vhosts/salon-virtuel/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.render [as callback] (/var/www/vhosts/salon-virtuel/node_modules/sass-loader/lib/loader.js:52:13)
at Object.done [as callback] (/var/www/vhosts/salon-virtuel/node_modules/neo-async/async.js:8077:18)
at options.error (/var/www/vhosts/salon-virtuel/node_modules/node-sass/lib/index.js:294:32)
# ./assets/js/app.js 7:0-62
Entrypoint app [big] = runtime.js vendors~app.js app.css app.js
error Command failed with exit code 2.
Imports in files :
node_modules/material-components-web/material-components-web.scss
#import "#material/elevation/mdc-elevation";
node_modules/#material/elevation/mdc-elevation.scss
#import "./mixins";
#include mdc-elevation-core-styles;
node_modules/#material/elevation/_mixins.scss
#import "#material/feature-targeting/functions";
#import "#material/feature-targeting/mixins";
#import "#material/theme/variables";
#import "./variables";
Any idea about why it's happening, and how to fix this?
I think you are very close. Try to edit your encore config to include node_modules to sass loader like this:
// enables Sass/SCSS support
.enableSassLoader(function(options) {
// https://github.com/sass/node-sass#options
options.includePaths = ['./node_modules'];
}, {
// set optional Encore-specific options
// resolve_url_loader: true
});
explained here
For the case, someone else stumbles over this.
It may would have also solved your issue, if you changed the way how you import the scss/sass files.
#import "~#material/feature-targeting/functions";
#import "~#material/feature-targeting/mixins";
#import "~#material/theme/variables";
#import "./variables";
The ~ references the node_modules as well. That is at least how I do it and it works without any special config for the sass-loader.

Angular 5 and Sass : in Bootstrap 's _reboot.scss file '#at-root' error : at-rule unknown

I want to include Bootstrap's scss files in my project.
But when I open _reboot.scss file VS Code complains about :
// IE10+ doesn't honor `<meta name="viewport">` in some cases.
#at-root {
#-ms-viewport {
width: device-width;
}
}
'file:///[...]/node_modules/bootstrap/scss/_reboot.scss'
severity: 'Error'
message: 'at-rule unknown' at: '37,1'
source: 'scss'
code: 'css-unknownatrule'
I created the project with ng new and opened it with VS Code. I don't know much about Lint (configuration, etc).
How can I get rid of this error ?

loading javascript into ipython notebook

I am trying to import the following three js libraries. They all work except for crossfilter.js. Can anyone tell me what I am doing wrong?
import jinja2
from IPython.display import display, Javascript, HTML
%%javascript
require.config({
paths: {
d3: '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min',
crossfilter: '//cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.7/crossfilter.min',
dc: '//cdnjs.cloudflare.com/ajax/libs/dc/1.7.0/dc.min'
}
});
dc = jinja2.Template(
"""
require(["d3","crossfilter","dc"], function(d3,crossfilter,dc) {
console.log(d3);
console.log(crossfilter);
console.log(dc);
});
""")
display(Javascript(dc.render()))
Output I am getting:
Object
Undefined
Object
Crossfilter does not (yet) support requireJS:
https://github.com/square/crossfilter/issues/114
The ticket shows how to use a shim config to load it.

Resources