Closed yatessss closed 4 years ago
应该不是 三目运算的问题,你把 this.props. children
换成 <Text>1</Text>
试试看, 可能是this.props.children
的问题
改为<Text>1</Text>
是可以的,不过我传入的是一段element,尝试了一下是在children外面包裹view就可以了
<TouchableOpacity
onPress={() => {
this.props.onPress && this.props.onPress()
}}>
{this.props.disabled ? <View style={{opacity: 0.3}}>{this.props.children}</View> : <View>{this.props.children}</View>}
</TouchableOpacity>
我看下
@yatessss 问题定位到了,正在修复。 暂时可以
<TouchableOpacity
onPress={() => {
this.props.onPress()
}}>
{this.props.disabled
? <View style={{opacity: 0.3}}>{this.props.children}</View>
: <View>{this.props.children}</View>}
</TouchableOpacity>
下面没有被JSX元素包裹的this.props.children
没有被识别。
嗯 好的,不过我在尝试的时候遇到很多奇奇怪怪的报错,有时能复现有时不能 完全是一个黑盒😂😂 还有一点就是在编译时报错有时不打印哪个文件,我看源码有一个类似filepath的其实可以加上 比较好定位是哪个文件出错的
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: yankang <notifications@github.com> 发送时间: 2020年1月11日 09:23 收件人: areslabs/alita <alita@noreply.github.com> 抄送: yatessss <897969073@qq.com>, Mention <mention@noreply.github.com> 主题: 回复:[areslabs/alita] 组件内不支持三目运算符 (#50)
@yatessss 问题定位到了,正在修复。 暂时可以 <TouchableOpacity onPress={() => { this.props.onPress() }}> {this.props.disabled ? <View style={{opacity: 0.3}}>{this.props.children}</View> : <View>{this.props.children}</View>} </TouchableOpacity>
下面没有被JSX元素包裹的this.props.children 没有被识别。
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
嗯。你说的对。 “奇奇怪怪的报错” 你可以加我QQ(1527997464)发我, 我应该可以定位出哪里出了问题。 filepath的确应该加上,我想一想
好的,我个人理解可以把整个原理画一个简易的图,然后在dev构建时候的log打全一些,这样我们可以帮助定位问题一起修复,目前想要快速把整个流程搞明白还是挺困难的,一报错也不清楚是哪个步骤有问题,一家之言仅供参考
发自我的iPhone
------------------ 原始邮件 ------------------ 发件人: yankang <notifications@github.com> 发送时间: 2020年1月11日 09:56 收件人: areslabs/alita <alita@noreply.github.com> 抄送: yatessss <897969073@qq.com>, Mention <mention@noreply.github.com> 主题: 回复:[areslabs/alita] 组件内不支持三目运算符 (#50)
嗯。你说的对。 “奇奇怪怪的报错” 你可以加我QQ(1527997464)发我, 我应该可以定位出哪里出了问题。 filepath的确应该加上,我想一想
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
组件内写了类似的三目运算后,模板不会生成,编译也不会有报错