Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace defaultProps with default js parameters #932

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Remove deprecated defaultProps
juliesaia-vendora authored Nov 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit af04e868377b3d87cea8a44976b7ff47dfaec461
31 changes: 12 additions & 19 deletions packages/react-native-external-display/index.js
Original file line number Diff line number Diff line change
@@ -22,27 +22,30 @@

type Props = {
...ViewProps,
style?: ViewProps.style,

Check failure on line 25 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "style" is not required, but has no corresponding defaultProps declaration
mainScreenStyle?: ViewProps.style,

Check failure on line 26 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "mainScreenStyle" is not required, but has no corresponding defaultProps declaration
screen?: string,

Check failure on line 27 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "screen" is not required, but has no corresponding defaultProps declaration
fallbackInMainScreen?: boolean,

Check failure on line 28 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "fallbackInMainScreen" is not required, but has no corresponding defaultProps declaration
onScreenConnect?: Function,

Check failure on line 29 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "onScreenConnect" is not required, but has no corresponding defaultProps declaration
onScreenChange?: Function,

Check failure on line 30 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "onScreenChange" is not required, but has no corresponding defaultProps declaration
onScreenDisconnect?: Function,

Check failure on line 31 in packages/react-native-external-display/index.js

GitHub Actions / lint

propType "onScreenDisconnect" is not required, but has no corresponding defaultProps declaration
}

const ExternalDisplayView = (props: Props) => {
const {
screen,
fallbackInMainScreen,
mainScreenStyle,
style,
const ExternalDisplayView = ({
style = undefined,
mainScreenStyle = undefined,
screen = '',
fallbackInMainScreen = false,
onScreenConnect = () => {},
onScreenChange = () => {},
onScreenDisconnect = () => {},
...nativeProps
}: Props) => {
const screens = useExternalDisplay({
onScreenConnect,
onScreenChange,
onScreenDisconnect,
...nativeProps
} = props
const screens = useExternalDisplay(props)
})
const scr = screens[screen]
if (!scr && !fallbackInMainScreen) {
return null
@@ -68,16 +71,6 @@
)
}

ExternalDisplayView.defaultProps = {
style: undefined,
mainScreenStyle: undefined,
screen: '',
fallbackInMainScreen: false,
onScreenConnect: () => {},
onScreenChange: () => {},
onScreenDisconnect: () => {},
}

export { getScreens, useExternalDisplay, SceneManager }

export default ExternalDisplayView

Unchanged files with check annotations Beta

change.remove()
disconnect.remove()
}
}, [])

Check warning on line 42 in packages/react-native-external-display/js/useExternalDisplay.js

GitHub Actions / lint

React Hook useEffect has missing dependencies: 'onScreenChange', 'onScreenConnect', and 'onScreenDisconnect'. Either include them or remove the dependency array. If 'onScreenConnect' changes too often, find the parent component that defines it and wrap that definition in useCallback
return screens
}