我有一个 monorepo,它公开了一个 TypeScript 模块,它被 React TypeScript 项目消耗和使用。
当模块将任意 React 元素插入到虚拟 DOM 时 - 一切都按预期工作,包括当我尝试使用 React Router 时(最初是有问题的,但我能够修复它)。
但是,当我尝试使用 react-intl, via 时FormattedMessage
,出现错误:
Error: [React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.
Run Code Online (Sandbox Code Playgroud)
当我在控制台日志中看到这一点时,这尤其令人讨厌:
The above error occurred in the <Context.Consumer> component:
in FormattedMessage
in h2
in div
in Loading (at App.tsx:11)
in IntlProvider (at App.tsx:8)
in App (at src/index.tsx:9)
in StrictMode (at src/index.tsx:8)
Run Code Online (Sandbox Code Playgroud)
(注意IntlProvider
包装Loading
- 这是使用FormattedMessage
which can't …
我正在编写一个将在移动设备上使用的 React 应用程序。
其中一页包含<input>
用户使用键盘输入的文本。在字段中输入文本会立即生效,因此之后无需按任何按钮。我想让软键盘“输入”键简单地关闭键盘而不采取任何操作。这是可能吗?听起来很简单,但我却找不到如何去做。
对于它的价值,我尝试添加enterKeyHint="done"
属性(如此处所述),但除了将输入标题从“完成”更改为“v”符号之外,它不会关闭键盘。
有任何想法吗?提前致谢!