菜鸟教程小白 发表于 2022-12-13 16:19:12

javascript - React Native AlertIOS api 中可能有多个文本字段?


                                            <p><p>有没有办法使用 React Native 的 AlertIOS api 来发出带有多个文本字段的警报?似乎提示功能只允许一个。 </p>

<p>如果没有办法拥有多个文本字段,我将如何将此功能添加到警报中?</p>

<p>任何帮助将不胜感激!谢谢!</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>我假设您希望在 <code>Alert</code> 中有多个纯文本输入字段?如果是这样, VanillaReact Native 是不可能的。如果你看源代码<a href="https://github.com/facebook/react-native/blob/235b16d93287061a09c4624e612b5dc4f960ce47/React/Modules/RCTAlertManager.m#L23" rel="noreferrer noopener nofollow">here</a>和 <a href="https://github.com/facebook/react-native/blob/235b16d93287061a09c4624e612b5dc4f960ce47/React/Modules/RCTAlertManager.m#L186" rel="noreferrer noopener nofollow">here</a> ,您会看到只有 <strong>plain-text</strong>、<strong>secure-text</strong> 或 <strong>login-password</strong> 是可用的配置。但是如果你真的想要一个 <code>Alert</code> 框中的多个文本字段(不考虑不太好的用户体验),你可以创建一个 <a href="https://facebook.github.io/react-native/docs/native-components-ios.html#content" rel="noreferrer noopener nofollow">native module</a>并执行类似 <a href="https://stackoverflow.com/questions/33996443/how-to-add-text-input-in-alertview-of-ios-8#answer-33996521" rel="noreferrer noopener nofollow">this</a> 的操作.</p></p>
                                   
                                                <p style="font-size: 20px;">关于javascript - React Native AlertIOS api 中可能有多个文本字段?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/37106469/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/37106469/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: javascript - React Native AlertIOS api 中可能有多个文本字段?