react-native-external-display icon indicating copy to clipboard operation
react-native-external-display copied to clipboard

Warning: ExternalDisplayView: Support for defaultProps will be removed

Open bastiaanv opened this issue 1 year ago • 0 comments

The current implementation of RN external display uses defaultProps in index.js. This need to be cleaned up.

We made a Patch package for the time being:

diff --git a/node_modules/react-native-external-display/index.js b/node_modules/react-native-external-display/index.js
index 310c5a1..0276933 100644
--- a/node_modules/react-native-external-display/index.js
+++ b/node_modules/react-native-external-display/index.js
@@ -31,7 +31,15 @@ type Props = {
   onScreenDisconnect?: Function,
 }
 
-const ExternalDisplayView = (props: Props) => {
+const ExternalDisplayView = (props: Props = {
+  style: undefined,
+  mainScreenStyle: undefined,
+  screen: '',
+  fallbackInMainScreen: false,
+  onScreenConnect: () => {},
+  onScreenChange: () => {},
+  onScreenDisconnect: () => {},
+}) => {
   const {
     screen,
     fallbackInMainScreen,
@@ -68,16 +76,6 @@ const ExternalDisplayView = (props: Props) => {
   )
 }
 
-ExternalDisplayView.defaultProps = {
-  style: undefined,
-  mainScreenStyle: undefined,
-  screen: '',
-  fallbackInMainScreen: false,
-  onScreenConnect: () => {},
-  onScreenChange: () => {},
-  onScreenDisconnect: () => {},
-}
-
 export { getScreens, useExternalDisplay, SceneManager }
 
 export default ExternalDisplayView

bastiaanv avatar Feb 12 '25 11:02 bastiaanv