areslabs / alita

一套把React Native代码转换成微信小程序代码的转换引擎工具。我们不造轮子,不发明新框架,只是提供工具把RN扩展到微信小程序端。
https://areslabs.github.io/alita
MIT License
1.96k stars 130 forks source link

生成模板找不到 template not found #50

Closed yatessss closed 4 years ago

yatessss commented 4 years ago
<TouchableOpacity
          onPress={() => {
            this.props.onPress()
          }}>
            {this.props.disabled
              ? <View style={{opacity: 0.3}}>{this.props.children}</View>
              : this.props.children}
        </TouchableOpacity>

组件内写了类似的三目运算后,模板不会生成,编译也不会有报错

ykforerlang commented 4 years ago

应该不是 三目运算的问题,你把 this.props. children 换成 <Text>1</Text> 试试看, 可能是this.props.children的问题

yatessss commented 4 years ago

改为<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>
ykforerlang commented 4 years ago

我看下

ykforerlang commented 4 years ago

@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 没有被识别。

yatessss commented 4 years ago

嗯  好的,不过我在尝试的时候遇到很多奇奇怪怪的报错,有时能复现有时不能 完全是一个黑盒😂😂  还有一点就是在编译时报错有时不打印哪个文件,我看源码有一个类似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.

ykforerlang commented 4 years ago

嗯。你说的对。 “奇奇怪怪的报错” 你可以加我QQ(1527997464)发我, 我应该可以定位出哪里出了问题。 filepath的确应该加上,我想一想

yatessss commented 4 years ago

好的,我个人理解可以把整个原理画一个简易的图,然后在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.

ykforerlang commented 4 years ago

嗯。 关于原理,我有时间 整理一下,其实主要就是一种让小程序支持JSX语法的新思路, 另外加上 小程序 实例和React实例建立关系的过程。

log会一步步完善

非常欢迎一起修复 😄 😄