microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.1k stars 1.13k forks source link

Text input not apearing on a flyout modal #13377

Open AhmedRyad22 opened 1 week ago

AhmedRyad22 commented 1 week ago

Problem Description

Text input behaves in a stange way. when you put a flyout modal that contains a Text input, initialy you get it working, after that when you continue working and get back to it you dont find it there, or somtimes just when you close the modal and open it again you dont find it there, it just doesnt show up,

Screenshot 2024-06-23 094530

Screenshot 2024-06-23 094220

<Flyout
        isOpen={CredentialsModal}
        onDismiss={() => {
          setCredentialsModal(false);
        }}>
        <View
          className={clsx(
            'w-[400px] p-6 space-y-4 rounded',
            colorScheme === 'dark' ? 'bg-neutral-900' : 'bg-neutral-200',
          )}>
          <View>
            <TextInput onChangeText={setAccessKey} placeholder="Access key" />
          </View>
          <View>
            <TextInput onChangeText={setSecreetKey} placeholder="Secret key" />
          </View>
          <View className="mt-4 flex-row space-x-1">
            <View className="flex-1">
              <Button
                onPress={async () => {
                  Managedrives.testConnection(accessKey, secreetKey);
                }}
                title="Testez les accès"
              />
            </View>

            <View className="flex-1">
              <Button
                onPress={() => {
                  // setMountModal(false);
                }}
                title="Enregistrez les accès"
              />
            </View>
          </View>
        </View>
      </Flyout>

By the way im using naitvewind for styling,

PS: i tried using react native stylesheet and got the same results

Steps To Reproduce

  1. a flyout menu with the code provided above.

Expected Results

the text input to apear each time

CLI version

13.6.6

Environment

System:
  OS: Windows 11 10.0.22631
  CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
  Memory: 2.55 GB / 15.81 GB
Binaries:
  Node:
    version: 18.20.2
    path: C:\Program Files\nodejs-18\node.EXE
  Yarn:
    version: 3.6.4
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 9.3.1
    path: C:\Program Files\nodejs-18\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
      - 10.0.22621.0
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.10.34928.147 (Visual Studio Community 2022)
Languages:
  Java: 19.0.2
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.2
    wanted: 0.74.2
  react-native-windows:
    installed: 0.74.7
    wanted: 0.74.7
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Community Modules

"@react-native-async-storage/async-storage": "^1.23.1", "@react-native-picker/picker": "^2.7.6", "nativewind": "^2.0.11", "react-router-native": "^6.23.1",

Target Platform Version

10.0.19041

Target Device(s)

Desktop

Visual Studio Version

Visual Studio 2022

Build Configuration

Debug

Snack, code example, screenshot, or link to a repository

No response

chrisglein commented 1 week ago

We'd like to reconstruct your repro so we can investigate. Is it possible to share more of your component here (hooks and such, full JS file, or best yet a full standalone repo) so we can best replicate it?

AhmedRyad22 commented 1 week ago

Certaintly here is a public repo containing the project

https://github.com/AhmedRyad22/react-native-windows-flyout-bug

https://github.com/microsoft/react-native-windows/assets/54637658/42a21029-9ad2-49bb-abdf-b8a99426efa8

and here is a video to showcase the issue.

thank you in advance

AhmedRyad22 commented 1 week ago

notice when i added the new text content the first text input disapeared

chrisglein commented 5 days ago

notice when i added the new text content the first text input disapeared

When you add the Text element, that would be pushing the 2 TextInput elements down, right? If you remove it again... they come back maybe?

I have a hypothesis here, which is that the Flyout doesn't handle dynamic content sizing (it stays at whatever size it gets from first layout) and so when your content shows/hides, it stays with the old size, which is going to clip the content. Given the layout rules, the buttons maybe prioritized over the main dialog content area... which means the bottom buttons stay but the content gets clipped. Does that match the behavior you're seeing? If so, that's a limitation of Flyout on the current Paper renderer that we expect to address with the upcoming Fabric renderer. Which doesn't help you today, but helps with our future tracking.

Some background: https://github.com/microsoft/react-native-windows/issues/7601

Is the resizing of the content here something you have to support in your final production app, or just during development?

AhmedRyad22 commented 2 days ago

hello, thank you for your response,

the issue is not really related to dynamic content, here you can see that when you build the app or when you launch it again, the text input will not be displayed in the flyout.

( i simulated the build or new luanch by reloading JS server )

https://github.com/microsoft/react-native-windows/assets/54637658/2458cd56-cea2-43a2-8e3c-ae8f8fb5aac6