Kev*_* H. 3 momentjs react-native
我缩小了范围以发现仅当我尝试<Moment />按React-Moment文档中所述传递组件时才会发生错误。到目前为止,我还没有找到有关此软件包的任何解释,希望那里的人也有类似的问题!
该文档阐明了这样的用法:
import Moment from 'react-moment';
// then within the class component:
return (
const dateToFormat = '1976-04-19T12:59-0500';
<Moment>{dateToFormat}</Moment>
);
Run Code Online (Sandbox Code Playgroud)
我想要一个像这样的原始日期字符串:
<Text>Created {this.props.postDate}</Text>
因此存储: "postDate": "2019-01-31T04:13:31.224Z"
但是到目前为止,无论何时添加<Moment>{this.props.postDate}</Moment>,无论是在现有<Text />块的外部还是内部,我都会变成红色:
在文档中:
https://github.com/headzoo/react-moment#usage-with-react-native
<Moment element={Text}>{dateToFormat}</Moment>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
372 次 |
| 最近记录: |