【发布时间】:2017-06-10 10:39:47
【问题描述】:
我的一个 react-native 组件中有以下 JSX
<TouchableOpacity onPress={this.onEnableNotifications} style={{marginHorizontal: 10}}>
<Image source={require('../../img/ic_warning.png')} style={{tintColor: colorThemes.Blue.red}}/>
</TouchableOpacity>
我收到以下 ESLint 错误:
'require' is not defined. (no-undef)
我尝试在Image 之后添加行{ // eslint-disable-line no-undef },但这会导致解析错误。我怎样才能摆脱这个错误只是为了那条线。
【问题讨论】:
标签: reactjs react-native react-jsx eslint