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

fix: Android - Create Chat - "You appear to be offline" is displayed floating on room creation #55047

Merged
merged 2 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
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
13 changes: 12 additions & 1 deletion src/components/ValuePicker/ValueSelectorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import type {ValueSelectorModalProps} from './types';

function ValueSelectorModal({items = [], selectedItem, label = '', isVisible, onClose, onItemSelected, shouldShowTooltips = true, onBackdropPress}: ValueSelectorModalProps) {
function ValueSelectorModal({
items = [],
selectedItem,
label = '',
isVisible,
onClose,
onItemSelected,
shouldShowTooltips = true,
onBackdropPress,
shouldEnableKeyboardAvoidingView = true,
}: ValueSelectorModalProps) {
const styles = useThemeStyles();

const sections = useMemo(
Expand All @@ -31,6 +41,7 @@ function ValueSelectorModal({items = [], selectedItem, label = '', isVisible, on
includePaddingTop={false}
includeSafeAreaPaddingBottom
testID={ValueSelectorModal.displayName}
shouldEnableKeyboardAvoidingView={shouldEnableKeyboardAvoidingView}
>
<HeaderWithBackButton
title={label}
Expand Down
6 changes: 2 additions & 4 deletions src/components/ValuePicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import useStyleUtils from '@hooks/useStyleUtils';
import Navigation from '@libs/Navigation/Navigation';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import KeyboardUtils from '@src/utils/keyboard';
import type {ValuePickerItem, ValuePickerProps} from './types';
import ValueSelectorModal from './ValueSelectorModal';

Expand All @@ -15,9 +14,7 @@ function ValuePicker({value, label, items, placeholder = '', errorText = '', onI
const [isPickerVisible, setIsPickerVisible] = useState(false);

const showPickerModal = () => {
KeyboardUtils.dismiss().then(() => {
setIsPickerVisible(true);
});
setIsPickerVisible(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic:

 KeyboardUtils.dismiss().then(() => {
            setIsPickerVisible(true);
        });

was introduced in this PR to address the bug. However, as observed, it did not resolve the issue. With the implementation of a new solution, this logic is now redundant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate your work to make the code cleaner. Asking here

};

const hidePickerModal = () => {
Expand Down Expand Up @@ -57,6 +54,7 @@ function ValuePicker({value, label, items, placeholder = '', errorText = '', onI
onItemSelected={updateInput}
shouldShowTooltips={shouldShowTooltips}
onBackdropPress={Navigation.dismissModal}
shouldEnableKeyboardAvoidingView={false}
/>
</View>
);
Expand Down
3 changes: 3 additions & 0 deletions src/components/ValuePicker/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ type ValueSelectorModalProps = {

/** Whether to show the tooltip text */
shouldShowTooltips?: boolean;

/** Flag to indicate if the keyboard avoiding view should be enabled */
shouldEnableKeyboardAvoidingView?: boolean;
};

type ValuePickerProps = {
Expand Down
Loading