Skip to content

KeyboardExtender doesn't immediately show children when enabled prop changes to true #1056

@woals4815

Description

@woals4815

Describe the bug

KeyboardExtender component doesn't immediately show its children when enabled prop changes from false to true. There appears to be a delay or the component doesn't render correctly on the first state change, requiring user interaction or additional re-renders to display properly.

Code snippet

import { KeyboardExtender } from 'react-native-keyboard-controller'

const [showExtender, setShowExtender] = useState(false)

useEffect(() => {
  if (someValue) {
    setShowExtender(true) // This should immediately show the KeyboardExtender
  }
}, [someValue])

return (
  <KeyboardExtender enabled={showExtender} >
    <Banner onPress={onPress} />
  </KeyboardExtender>
)

Repo for reproducing

Unfortunately, I cannot provide a public repository due to proprietary code, but the issue occurs in a React Native app with TypeScript using the KeyboardExtender component from react-native-keyboard-controller.

To Reproduce

Steps to reproduce the behavior:

  1. Initialize KeyboardExtender with enabled={false}
  2. Change the enabled prop to true programmatically (e.g., through useState)
  3. Observe that the children components inside KeyboardExtender are not immediately visible
  4. User interaction or additional re-renders are required to make the content appear

Expected behavior

When the enabled prop changes from false to true, the KeyboardExtender should immediately render and display its children components without delay or requiring additional user interaction.

Screenshots

N/A - Visual behavior issue where component simply doesn't appear when expected.

Smartphone (please complete the following information):

  • Desktop OS: macOS (Darwin 24.5.0)
  • Device: iPhone Simulator & Physical iOS devices
  • OS: iOS
  • RN version: 0.74.5
  • RN architecture: New Architecture (Fabric)
  • JS engine: Hermes
  • Library version: 1.18.2

Additional context

  • The issue seems to be related to the timing of when KeyboardExtender renders its children
  • We have applied a patch to add height prop support: patches/react-native-keyboard-controller+1.18.2.patch
  • As a workaround, we implemented animations using react-native-reanimated to provide visual feedback, but the underlying rendering issue with KeyboardExtender remains
  • The issue is consistent across different iOS devices and simulators
  • Component works correctly after the initial render issue is resolved through user interaction

Metadata

Metadata

Assignees

Labels

KeyboardExtender 🧩Anything about keyboard extending (i. e. `KeyboardExtender` component)🍎 iOSiOS specific🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions