microsoft / react-native-xaml

A React Native Windows library to use XAML / WinUI controls
MIT License
97 stars 28 forks source link

ContentDialog Opens Only Once #227

Closed Qurishe closed 2 years ago

Qurishe commented 2 years ago

Problem Description

I am using react-native-xaml in my React Native Windows project. I created a Dialog using ContentDialog from react-native-xaml but the problem is the first time the app loads, when i press the button it open up the ContentDialog but after closing it, it doesn't open the second time. React Native : 0.70 React Native Windows: 0.70.1 react-native-xaml: 0.0.69

Steps To Reproduce

  1. Show and hide the ContentDialog with a button using state.

Expected Results

Toggle the ContentDialog on and off by pressing the button.

Environment

System:
    OS: Windows 10 10.0.22000
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 5.28 GB / 11.90 GB
  Binaries:
    Node: 16.17.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.15.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
    Windows SDK:
      AllowDevelopmentWithoutDevLicense: Enabled
      AllowAllTrustedApps: Enabled
      Versions: 10.0.18362.0, 10.0.19041.0
  IDEs:
    Android Studio: Not Found
    Visual Studio: 16.11.32901.82 (Visual Studio Enterprise 2019)
  Languages:
    Java: Not Found
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.0 => 0.70.0
    react-native-windows: 0.70.1 => 0.70.1
  npmGlobalPackages:
    *react-native*: Not Found
asklar commented 2 years ago

You have to set its state prop to closed in the onClosed event. See https://github.com/microsoft/react-native-xaml/blob/main/USAGE.md#contentdialog

Qurishe commented 2 years ago

@asklar Yes, when i click the close button it closes without a problem but when i click the button to open it again it doesn't open the contentDialog Box. I have copied the exact code from the usage guide.

asklar commented 2 years ago

thanks for reporting @Qurishe , this got recently broken, fixing it in #228