mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Fix NUI every render (#75)
This commit is contained in:
1 parent
1d3a17220a
commit
e2c8964b81
1 file changed
+7
-5
+7
-5
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import './Phone.css';
|
import './Phone.css';
|
||||||
import './i18n';
|
import './i18n';
|
||||||
import { Route } from 'react-router-dom';
|
import { Route } from 'react-router-dom';
|
||||||
@@ -62,12 +62,14 @@ function Phone() {
|
|||||||
|
|
||||||
const [settings] = useRecoilState(settingsState);
|
const [settings] = useRecoilState(settingsState);
|
||||||
|
|
||||||
|
const currentTheme = useMemo(
|
||||||
|
() => createMuiTheme(config.themes[settings.theme]),
|
||||||
|
[settings.theme]
|
||||||
|
);
|
||||||
|
|
||||||
if (visibility === false) {
|
if (visibility === false) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentTheme = () => createMuiTheme(config.themes[settings.theme]);
|
|
||||||
|
|
||||||
document.onkeyup = function (data) {
|
document.onkeyup = function (data) {
|
||||||
if (data.which === 27) {
|
if (data.which === 27) {
|
||||||
Nui.send('phone:close');
|
Nui.send('phone:close');
|
||||||
@@ -75,7 +77,7 @@ function Phone() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={currentTheme()}>
|
<ThemeProvider theme={currentTheme}>
|
||||||
<div className='PhoneWrapper'>
|
<div className='PhoneWrapper'>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in new issue
Block a user