useTranslation hook ( i18next package) and material ui tab indicator bug - material-ui

I've noticed strange behaviour using material ui tabs with i18next npm package (useTranslation hook) - for localize my buttons. The main problem is: bottom indicator doesn't recalculate its position after page reload, but when I comment my useTranslation hook - everything is ok. my hook looks like this at top of component:
const { t: tc }: UseTranslationResponse = useTranslation('common');
I don't see any dependency here or any asynchronicity problem why this happens. Any ideas? Thanks

I faced the same issue today. Just like you, I'm using react material tabs with i18next.
To solve this problem, I forced namespaces load on i18n initialization.
I don't know why this bug happens, but this workaround works for me.
i18n.init({ns: ['components', 'pages', 'common', 'generalData']})

You're probably loading your translations asynchronously? Using i18next-http-backend maybe?
Then you may not be using Suspense and also not waiting for the ready flag: https://react.i18next.com/latest/usetranslation-hook#not-using-suspense

Related

Material ui breaks on refresh in Next js

I have tried adding the babelrc settings in the root directory as suggested by some people but it didn't work. Material ui always seems to break on refresh in next js. Is there a configuration setup I have to do?
applied-styles
breaks-on-refresh
This is probably because your server does not render your styles. Did you try to inject them like the official Mui repo suggests in this example?

GoogleMaps on Ionic5 messing up Swipe Modal

I’m having issues with the GoogleMaps and the new ‘swipe to close’ modal.
My issue is that the class _gmaps_cdv_ that gets attached to the body by GoogleMaps is changing the background color to white. The effect looks weird and bad.
I’ve tried pretty much everything…
Removing the class once the modal gets loaded. That will make the map disappear and take whatever color I’ve set to the background.
Removing the class once the modal gets loaded and attaching it again once the modal gets destroyed. Same result as previous
Destroying the map on the ionViewWillLeave() and recreating using the ionViewWIllLoad(). Same result as previous.
Any tips? Is this a bug?
Thanks
I got around this. The solution is pretty simple. The background color can be setup on the Environment class of the GoogleMaps.
Make sure the Environment is imported on your component and do as follows:
// If you're following the documentation, there should be more things imported here, because I'm focusing on the Environment, I will only use this one.
import { Environment } from '#ionic-native/google-maps/ngx';
ngOninit() {
Environment.setBackgroundColor('black'); // Or whatever color you want.
}
That's it!
Here is the documentation link for reference:
https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/environment/README.md

Fancytree dnd5 triggering multiple loads of lazy nodes on hover

I just updated my application from the old Dnd extension to Dnd5 and I'm now seeing multiple/many server AJAX calls (usually 5 or 6) when I hover over lazy-load nodes while dragging. I have only implemented the dragStart, dragEnter, and dragDrop callbacks, and I only see the dragEnter callback being called once when I hover. Is there some special handling or response required from the lazyLoad callback to prevent this? I should also point out that I also updated to the latest version of Fancytree (2.34.0) so perhaps something else has changed that is causing this? (My tree works fine otherwise.)
Thanks!
Seems you found a bug. This will be fixed in Fancytree 2.34.1

ionic header bar disappears after reloading the state in angularjs

I am working on a project where I need to use a messaging system.
I have an inbox: When I used the $state.reload() to show the newly sent message but when the state gets reloaded the header bar gets disappeared and doesn't gets visible until i do the manual refresh. I am using ionic 1.1.1 version
I searched a lot but didn't get any suitable reason that why it is happening. Kindly suggest me on this.
So, after searching a lot for ways to solve this problem, that I am also stuck on, I found out there is not! Unfortunatelly updating to the new version of Ionic did not help, and the workaround provided at Ionic's GitHub desn't work for me. It is:
$scope.$on('$ionicView.enter', function(e) {
$ionicNavBarDelegate.showBar(true);
});
But if you have custom buttons in your header, this code doesn't work as expected. There are some jQuery solutions too, but I think it's not what we really need.
Source: https://github.com/driftyco/ionic/issues/3852
EDIT
So, I've worked on a pure Javascript solution, for my situation, and here it is. Hope it can help.
$scope.$on('$ionicView.enter', function(e) {
$timeout(function() {
showHeader();
}, 1000);
function showHeader() {
// Having the nav-bar in your template, set an ID to it.
var header = document.getElementById('header_id');
if (header.classList) {
if (header.classList.contains('hide')) {
header.classList.remove('hide');
}
}
}
});
For me what was causing that issue came from the solution of this problem:
https://github.com/ionic-team/ionic-v1/issues/119
Once i removed this line:
$ionicConfigProvider.views.maxCache(0);
from my config phase the action bar started to work again.

TinyMCE inside Durandal widget - callback after routing transition?

I'm trying to use TinyMCE in a widget but it fails. I think the problem is that view is still hidden when "viewAttached" is fired. It seems that TinyMCE has a bug/feature (read last paragraph) and can't be displayed when the target (textarea) is hidden (or inside a hidden div).
I got it working by doing the job in a setTimeout but it's crappy.
Is there a callback that I could attached to which is fired after the view is unhided (after the transition is completed)?
I found one solution:
Explicitly subscribe to the "isNavigating" observable of the router and add TinyMCE when "isNavigating" value becomes false.
Still : this has the effect of flickering - you see the textarea and then it is replaced by TinyMCE... but this is not a Durandal problem IMO.
Edit 1
Finally, I think the the best solution (for now... follow the link below for the thread on the subject) is to do a setTimeout(xyz(), 0) - I have seen a lot of people using this technique and it prevents the flickering.
https://groups.google.com/forum/?fromgroups#!topic/durandaljs/5NpSwMBnrew
Durandal does have a callbacks when you're using composition - you just put a function on to your viewModel with the correct name. In your case, you would use viewAttached:
Here's the docs:
http://durandaljs.com/documentation/Interacting-with-the-DOM/