Skip to content

Commit

Permalink
Fix #5652: Ripple set deprecated static when context is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Dec 29, 2023
1 parent 47d5663 commit 9190967
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/lib/api/PrimeReact.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { FilterMatchMode } from './FilterMatchMode';

/**
* @deprecated please use PrimeReactContext
*/
export default class PrimeReact {
static ripple = false;

Expand Down
22 changes: 22 additions & 0 deletions components/lib/api/PrimeReactContext.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import { FilterMatchMode } from './FilterMatchMode';
import PrimeReact from './PrimeReact';

export const PrimeReactContext = React.createContext();

Expand Down Expand Up @@ -58,6 +59,27 @@ export const PrimeReactProvider = (props) => {
linkElement.parentNode?.insertBefore(cloneLinkElement, linkElement.nextSibling);
};

/**
* @deprecated
*/
React.useEffect(() => {
PrimeReact.ripple = ripple;
}, [ripple]);

/**
* @deprecated
*/
React.useEffect(() => {
PrimeReact.inputStyle = inputStyle;
}, [inputStyle]);

/**
* @deprecated
*/
React.useEffect(() => {
PrimeReact.locale = locale;
}, [locale]);

const value = {
changeTheme,
ripple,
Expand Down

0 comments on commit 9190967

Please sign in to comment.