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: TextInput loses focus inside Banner on iOS only #4179

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

abdulbasithqb
Copy link
Contributor

Motivation

TextInput loses focus every type a character is entered and keyboard is dismissed. This happens only on iOS real device.
On android real device it works as expected.

Related issue

issue #4178

Result

1. Banner with TextInput 2. Banner with Text

@abdulbasithqb abdulbasithqb changed the title Fixes/banner focus fix fix: TextInput loses focus inside Banner on iOS only Nov 13, 2023
@callstack-bot
Copy link

callstack-bot commented Nov 13, 2023

Hey @abdulbasithqb, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@lukewalczak lukewalczak linked an issue Nov 28, 2023 that may be closed by this pull request
@lukewalczak lukewalczak added this to the 5.12.0 milestone Jan 8, 2024
lukewalczak
lukewalczak previously approved these changes Jan 8, 2024
@lukewalczak lukewalczak dismissed their stale review January 10, 2024 20:38

It may break a layout for users who pass a component as a child into the Banner component

@lukewalczak
Copy link
Member

It may break a layout for users who pass a <Text /> component as a child into the Banner component:

     <Banner
        onLayout={handleLayout}
        actions={[
          {
            label: `Set ${useCustomTheme ? 'default' : 'custom'} theme`,
            onPress: () => setUseCustomTheme(!useCustomTheme),
          },
          {
            label: 'Fix it',
            onPress: () => setVisible(false),
          },
        ]}
        icon={require('../../assets/images/email-icon.png')}
        visible={visible}
        onShowAnimationFinished={() =>
          console.log('Completed opening animation')
        }
        onHideAnimationFinished={() =>
          console.log('Completed closing animation')
        }
        theme={useCustomTheme ? customTheme : defaultTheme}
        style={styles.banner}
      >
        <Text>
          Two line text string with two actions. One to two lines is preferable
          on mobile.
        </Text>
      </Banner>
before after
Zrzut ekranu 2024-01-10 o 21 39 40 Zrzut ekranu 2024-01-10 o 21 39 24

@abdulbasithqb
Copy link
Contributor Author

It may break a layout for users who pass a <Text /> component as a child into the Banner component:

     <Banner
        onLayout={handleLayout}
        actions={[
          {
            label: `Set ${useCustomTheme ? 'default' : 'custom'} theme`,
            onPress: () => setUseCustomTheme(!useCustomTheme),
          },
          {
            label: 'Fix it',
            onPress: () => setVisible(false),
          },
        ]}
        icon={require('../../assets/images/email-icon.png')}
        visible={visible}
        onShowAnimationFinished={() =>
          console.log('Completed opening animation')
        }
        onHideAnimationFinished={() =>
          console.log('Completed closing animation')
        }
        theme={useCustomTheme ? customTheme : defaultTheme}
        style={styles.banner}
      >
        <Text>
          Two line text string with two actions. One to two lines is preferable
          on mobile.
        </Text>
      </Banner>

before after
Zrzut ekranu 2024-01-10 o 21 39 40 Zrzut ekranu 2024-01-10 o 21 39 24

any suggestion to resolve this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextInput loses focus inside Banner on iOS only
3 participants