Skip to content

Alert default text not set on android if button config is specified #25016

@Mookiies

Description

@Mookiies

Evironment

info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.2
      CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
      Memory: 943.96 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.15.0 - ~/.nvm/versions/node/v8.15.0/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v8.15.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.2, 26.0.3, 27.0.3, 28.0.3
        System Images: android-19 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 

Description

Setting an Alert with a button configuration with no text does not use default text on android. On iOS one button with OK is created, while on android no button is created. If { cancelable: false } is set this makes it impossible to dismiss the alert since there is no button and tapping outside will not dismiss it.

Example code:

Alert.alert(
   'title',
   'message',
   [ { onPress: () => console.log('onPress') } ],
   { cancelable: false },

Screenshots produced:
Screen Shot 2019-05-23 at 3 55 30 PM
Screen Shot 2019-05-23 at 3 56 15 PM

Expected Behavior

Both platform behave the same and default text is set on android.

Snack

https://snack.expo.io/SkkPUjN64

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions