Skip to content

Warning: ExternalDisplayView: Support for defaultProps will be removed #950

Open
@bastiaanv

Description

@bastiaanv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions