calintamas / react-native-toast-message

Animated toast message component for React Native
MIT License
1.73k stars 265 forks source link

KeyboardOffset applied when keyboard is not open #546

Open Acex187x opened 5 months ago

Acex187x commented 5 months ago

Describe the bug Using Toast component with bottomOffset={0} and position="bottom", there is still ~10px gap between end of the screen and toast, even with keyboard closed all the time. When keyboardOffset={0} is provided, gap disappears.

Steps to reproduce Steps to reproduce the behavior:

  1. Add Toast to the App like this:
    <Toast
    position={'bottom'}
    bottomOffset={0}
    />
  2. Call Toast.show({...})
  3. Zero gap between bottom of the screen and Toast expected when keyboard is closed, however ~10px gap exists.
  4. Add keyboardOffset={0} to the Toast component like this:
    <Toast
    position={'bottom'}
    bottomOffset={0}
    keyboardOffset={0}
    />
  5. Gap disappears

Expected behavior keyboardOffset does not affect Toast layout while keyboard is not open.

Screenshots image

image

Code sample Provided above

Environment (please complete the following information):

Additional context It's my first issue, hope I did everything right. Do not hesitate to ask additional information.

Jeidoz commented 5 months ago

Have you checked out the documentation yet? It's not a bug; it's actually an "out of the box" feature 😐

ToastOptions:

  /**
   * Offset from the Keyboard (in px)
   * Has effect only when `position` is `bottom` and Keyboard is visible
   * Default value: `10`
   */
  keyboardOffset?: number;