From f18ca43d424e1b05ce2f4194defeaa9e29f15776 Mon Sep 17 00:00:00 2001 From: Chris Bobbe Date: Wed, 21 Jul 2021 13:51:10 -0400 Subject: [PATCH] flow: Annotate some more exported React components. This is much easier to do now that we've converted these to function components in this series. This will help move us along toward Flow's new "Types-First" mode; switching entirely is #4907. --- src/animation/AnimatedComponent.js | 2 +- src/autocomplete/AutocompleteView.js | 2 +- src/common/ComponentList.js | 2 +- src/common/ComponentWithOverlay.js | 2 +- src/common/Input.js | 2 +- src/common/InputWithClearButton.js | 2 +- src/common/LineSeparator.js | 2 +- src/common/LoadingIndicator.js | 2 +- src/common/NestedNavRow.js | 2 +- src/common/OptionDivider.js | 2 +- src/common/PasswordInput.js | 2 +- src/common/Popup.js | 2 +- src/common/SearchInput.js | 2 +- src/common/SmartUrlInput.js | 2 +- src/common/SwitchRow.js | 2 +- src/common/UnreadCount.js | 2 +- src/common/ZulipButton.js | 2 +- src/common/ZulipSwitch.js | 2 +- src/emoji/EmojiRow.js | 2 +- src/nav/NavButtonGeneral.js | 2 +- src/streams/StreamList.js | 2 +- src/user-groups/UserGroupItem.js | 2 +- src/users/UsersScreen.js | 2 +- 23 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/animation/AnimatedComponent.js b/src/animation/AnimatedComponent.js index b610693c1db..78f2fe31a5e 100644 --- a/src/animation/AnimatedComponent.js +++ b/src/animation/AnimatedComponent.js @@ -19,7 +19,7 @@ type Props = $ReadOnly<{| /** * Animates the specified style property on visibility change. */ -export default function AnimatedComponent(props: Props) { +export default function AnimatedComponent(props: Props): React$Node { const { visible = true, useNativeDriver = true, diff --git a/src/autocomplete/AutocompleteView.js b/src/autocomplete/AutocompleteView.js index 3ef6eede49f..2815c9387ea 100644 --- a/src/autocomplete/AutocompleteView.js +++ b/src/autocomplete/AutocompleteView.js @@ -31,7 +31,7 @@ type Props = $ReadOnly<{| onAutocomplete: (input: string, completion: string, lastWordPrefix: string) => void, |}>; -export default function AutocompleteView(props: Props) { +export default function AutocompleteView(props: Props): React$Node { const { isFocused, text, onAutocomplete, selection } = props; const handleAutocomplete = useCallback( diff --git a/src/common/ComponentList.js b/src/common/ComponentList.js index c59fca5a7a0..36d701bbfdd 100644 --- a/src/common/ComponentList.js +++ b/src/common/ComponentList.js @@ -24,7 +24,7 @@ type Props = $ReadOnly<{| * @prop [style] - Style of the wrapper container. * @prop [itemStyle] - Style applied to each child. */ -export default function ComponentList(props: Props) { +export default function ComponentList(props: Props): React$Node { const { children, itemStyle, spacing = 16, outerSpacing = true, style } = props; const outerStyle = outerSpacing ? { margin: spacing } : {}; const marginStyle = { marginBottom: spacing }; diff --git a/src/common/ComponentWithOverlay.js b/src/common/ComponentWithOverlay.js index 9e2bf0fa12e..688f1d48732 100644 --- a/src/common/ComponentWithOverlay.js +++ b/src/common/ComponentWithOverlay.js @@ -54,7 +54,7 @@ type Props = $ReadOnly<{| * @prop overlayPosition - What corner to align the overlay to. * @prop [style] - Applied to a wrapper View. */ -export default function ComponentWithOverlay(props: Props) { +export default function ComponentWithOverlay(props: Props): React$Node { const { children, style, diff --git a/src/common/Input.js b/src/common/Input.js index 5681e0ba0d9..57893ac917c 100644 --- a/src/common/Input.js +++ b/src/common/Input.js @@ -45,7 +45,7 @@ const componentStyles = createStyleSheet({ * @prop ...all other TextInput props - Passed through verbatim to TextInput. * See upstream: https://reactnative.dev/docs/textinput */ -export default function Input(props: Props) { +export default function Input(props: Props): React$Node { const { style, placeholder, textInputRef, ...restProps } = props; const [isFocused, setIsFocused] = useState(false); diff --git a/src/common/InputWithClearButton.js b/src/common/InputWithClearButton.js index a9bf7925a4d..b617f4a9cef 100644 --- a/src/common/InputWithClearButton.js +++ b/src/common/InputWithClearButton.js @@ -22,7 +22,7 @@ type Props = $ReadOnly<$Diff(''); diff --git a/src/common/LineSeparator.js b/src/common/LineSeparator.js index 64427fa6916..8557913460f 100644 --- a/src/common/LineSeparator.js +++ b/src/common/LineSeparator.js @@ -11,7 +11,7 @@ const componentStyles = createStyleSheet({ }, }); -export default function LineSeparator(props: {||}) { +export default function LineSeparator(props: {||}): React$Node { const themeContext = useContext(ThemeContext); return ( diff --git a/src/common/LoadingIndicator.js b/src/common/LoadingIndicator.js index c706e2bb463..7c9a29402e6 100644 --- a/src/common/LoadingIndicator.js +++ b/src/common/LoadingIndicator.js @@ -36,7 +36,7 @@ type Props = $ReadOnly<{| * @prop [showLogo] - Show or not a Zulip logo in the center. * @prop [size] - Diameter of the indicator in pixels. */ -export default function LoadingIndicator(props: Props) { +export default function LoadingIndicator(props: Props): React$Node { const { color = 'default', showLogo = false, size = 40 } = props; return ( diff --git a/src/common/NestedNavRow.js b/src/common/NestedNavRow.js index 4c10e80fdd8..878a8cc8d67 100644 --- a/src/common/NestedNavRow.js +++ b/src/common/NestedNavRow.js @@ -22,7 +22,7 @@ type Props = $ReadOnly<{| * Shows a right-facing arrow to indicate its purpose. If you need a * selectable option row instead, use `SelectableOptionRow`. */ -export default function NestedNavRow(props: Props) { +export default function NestedNavRow(props: Props): React$Node { const { label, onPress, Icon } = props; const themeContext = useContext(ThemeContext); diff --git a/src/common/OptionDivider.js b/src/common/OptionDivider.js index d3f40fdcc5e..ab23f6e2b73 100644 --- a/src/common/OptionDivider.js +++ b/src/common/OptionDivider.js @@ -10,7 +10,7 @@ const componentStyles = createStyleSheet({ }, }); -export default function OptionDivider(props: {||}) { +export default function OptionDivider(props: {||}): React$Node { const themeContext = useContext(ThemeContext); return ( diff --git a/src/common/PasswordInput.js b/src/common/PasswordInput.js index 3c4f79cb77c..5c93922611e 100644 --- a/src/common/PasswordInput.js +++ b/src/common/PasswordInput.js @@ -35,7 +35,7 @@ type Props = $ReadOnly<$Diff(true); const handleShow = useCallback(() => { diff --git a/src/common/Popup.js b/src/common/Popup.js index a4832ea7810..467a6d9f3cb 100644 --- a/src/common/Popup.js +++ b/src/common/Popup.js @@ -21,7 +21,7 @@ type Props = $ReadOnly<{| children: React$Node, |}>; -export default function Popup(props: Props) { +export default function Popup(props: Props): React$Node { const themeContext = useContext(ThemeContext); return ( diff --git a/src/common/SearchInput.js b/src/common/SearchInput.js index e8c72a1c0a2..e2293296b84 100644 --- a/src/common/SearchInput.js +++ b/src/common/SearchInput.js @@ -29,7 +29,7 @@ type Props = $ReadOnly<{| * @prop [autoFocus] - should the component be focused when mounted. * @prop onChangeText - Event called when search query is edited. */ -export default function SearchInput(props: Props) { +export default function SearchInput(props: Props): React$Node { const { autoFocus = true, onChangeText } = props; return ( diff --git a/src/common/SmartUrlInput.js b/src/common/SmartUrlInput.js index 6a3dca51bae..7534d056c40 100644 --- a/src/common/SmartUrlInput.js +++ b/src/common/SmartUrlInput.js @@ -54,7 +54,7 @@ type Props = $ReadOnly<{| enablesReturnKeyAutomatically: boolean, |}>; -export default function SmartUrlInput(props: Props) { +export default function SmartUrlInput(props: Props): React$Node { const { defaultProtocol, defaultOrganization, diff --git a/src/common/SwitchRow.js b/src/common/SwitchRow.js index 1fb57243913..c522f134a66 100644 --- a/src/common/SwitchRow.js +++ b/src/common/SwitchRow.js @@ -25,7 +25,7 @@ const componentStyles = createStyleSheet({ /** * A row with a label and a switch component. */ -export default function SwitchRow(props: Props) { +export default function SwitchRow(props: Props): React$Node { const { label, value, onValueChange, style, Icon } = props; const themeContext = useContext(ThemeContext); diff --git a/src/common/UnreadCount.js b/src/common/UnreadCount.js index 43fbc5827b1..a0e8afbf9dd 100644 --- a/src/common/UnreadCount.js +++ b/src/common/UnreadCount.js @@ -54,7 +54,7 @@ type Props = $ReadOnly<{| * @prop [inverse] - Indicate if styling should be inverted (dark on light). * @prop [limited] - If set values over 100 will display as `99+`. */ -export default function UnreadCount(props: Props) { +export default function UnreadCount(props: Props): React$Node { const { style, isMuted = false, diff --git a/src/common/ZulipButton.js b/src/common/ZulipButton.js index 2d047f43503..1d5d3a757b5 100644 --- a/src/common/ZulipButton.js +++ b/src/common/ZulipButton.js @@ -121,7 +121,7 @@ type Props = $ReadOnly<{| * @prop [secondary] - Less prominent styling, the button is not as important. * @prop onPress - Event called on button press. */ -export default function ZulipButton(props: Props) { +export default function ZulipButton(props: Props): React$Node { const { style, text, diff --git a/src/common/ZulipSwitch.js b/src/common/ZulipSwitch.js index 60782ed7299..7151c7463cd 100644 --- a/src/common/ZulipSwitch.js +++ b/src/common/ZulipSwitch.js @@ -19,7 +19,7 @@ type Props = $ReadOnly<{| * @prop value - value of the switch. * @prop onValueChange - Event called on switch. */ -export default function ZulipSwitch(props: Props) { +export default function ZulipSwitch(props: Props): React$Node { const { disabled = false, onValueChange, value } = props; return ( void, |}>; -export default function EmojiRow(props: Props) { +export default function EmojiRow(props: Props): React$Node { const { code, name, type, onPress } = props; const handlePress = useCallback(() => { diff --git a/src/nav/NavButtonGeneral.js b/src/nav/NavButtonGeneral.js index 6f7665c01ea..958e3fde8d0 100644 --- a/src/nav/NavButtonGeneral.js +++ b/src/nav/NavButtonGeneral.js @@ -21,7 +21,7 @@ const componentStyles = createStyleSheet({ }, }); -export default function NavButtonGeneral(props: Props) { +export default function NavButtonGeneral(props: Props): React$Node { const { children, onPress, accessibilityLabel } = props; return ( diff --git a/src/streams/StreamList.js b/src/streams/StreamList.js index cd8efb10dd9..65e26e70f93 100644 --- a/src/streams/StreamList.js +++ b/src/streams/StreamList.js @@ -46,7 +46,7 @@ type Props = $ReadOnly<{| onSwitch?: (streamName: string, newValue: boolean) => void, |}>; -export default function StreamList(props: Props) { +export default function StreamList(props: Props): React$Node { const { streams = [], showDescriptions = false, diff --git a/src/user-groups/UserGroupItem.js b/src/user-groups/UserGroupItem.js index 12d2ec30f5b..67825c04f39 100644 --- a/src/user-groups/UserGroupItem.js +++ b/src/user-groups/UserGroupItem.js @@ -25,7 +25,7 @@ type Props = $ReadOnly<{| onPress: (name: string) => void, |}>; -export default function UserGroupItem(props: Props) { +export default function UserGroupItem(props: Props): React$Node { const { name, description, onPress } = props; const handlePress = useCallback(() => { diff --git a/src/users/UsersScreen.js b/src/users/UsersScreen.js index c2a8ba91f69..24d8fc80e01 100644 --- a/src/users/UsersScreen.js +++ b/src/users/UsersScreen.js @@ -11,7 +11,7 @@ type Props = $ReadOnly<{| route: RouteProp<'users', void>, |}>; -export default function UsersScreen(props: Props) { +export default function UsersScreen(props: Props): React$Node { const [filter, setFilter] = useState(''); return (