diff --git a/native/chat/settings/thread-settings-promote-sidebar.react.js b/native/chat/settings/thread-settings-promote-sidebar.react.js index e6146126d..6427c19f4 100644 --- a/native/chat/settings/thread-settings-promote-sidebar.react.js +++ b/native/chat/settings/thread-settings-promote-sidebar.react.js @@ -1,96 +1,114 @@ // @flow import * as React from 'react'; import { Text, ActivityIndicator, View, Alert } from 'react-native'; import { usePromoteSidebar } from 'lib/hooks/promote-sidebar.react'; import type { LoadingStatus } from 'lib/types/loading-types'; import type { ThreadInfo } from 'lib/types/thread-types'; import Button from '../../components/button.react'; import { type Colors, useColors, useStyles } from '../../themes/colors'; import type { ViewStyle } from '../../types/styles'; type BaseProps = { +threadInfo: ThreadInfo, +buttonStyle: ViewStyle, }; type Props = { ...BaseProps, +loadingStatus: LoadingStatus, +colors: Colors, +styles: typeof unboundStyles, +promoteSidebar: () => mixed, }; class ThreadSettingsPromoteSidebar extends React.PureComponent { + onClick = () => { + Alert.alert( + 'Are you sure?', + "This promoting a sidebar to a full thread can't be undone.", + [ + { + text: 'Cancel', + style: 'cancel', + }, + { + text: 'Yes', + onPress: this.props.promoteSidebar, + }, + ], + ); + }; + render() { const { panelIosHighlightUnderlay, panelForegroundSecondaryLabel, } = this.props.colors; const loadingIndicator = this.props.loadingStatus === 'loading' ? ( ) : null; + return ( ); } } const unboundStyles = { button: { flexDirection: 'row', paddingHorizontal: 12, paddingVertical: 10, }, container: { backgroundColor: 'panelForeground', paddingHorizontal: 12, }, text: { color: 'panelForegroundSecondaryLabel', flex: 1, fontSize: 16, }, }; const onError = () => { Alert.alert('Unknown error', 'Uhh... try again?', undefined, { cancelable: true, }); }; const ConnectedThreadSettingsPromoteSidebar: React.ComponentType = React.memo( function ConnectedThreadSettingsPromoteSidebar(props: BaseProps) { const { threadInfo } = props; const colors = useColors(); const styles = useStyles(unboundStyles); const { onPromoteSidebar, loading } = usePromoteSidebar( threadInfo, onError, ); return ( ); }, ); export default ConnectedThreadSettingsPromoteSidebar;