【发布时间】:2017-08-25 00:14:24
【问题描述】:
我最近一直在学习 React Native,但还没有真正找到操作 DOM 的方法。
我一直在努力做到这一点,如果我点击 TouchableHighlight,我的图像会向下移动几个 px,但我还没有设法让它移动,老实说,我不知道如何从在这里。
我的 onclick 函数有效,因为每次单击按钮时它都会返回日志。
到目前为止,我有这个:
export default class MainBody extends Component {
onclick = () => {
console.log('On click works')
};
render() {
return (
<ScrollView showsHorizontalScrollIndicator={false} style={Style.horList} horizontal={true}>
<View >
{/*i need to move this Image down!*/}
<Image source={require("./img/example.png")}/>
<View>
<Text style={Style.peopleInvited}>This is text</Text>
</View>
{/*When clicked on this touchable highlight!*/}
<TouchableHighlight onPress={this.onclick}}>
<Image source={require('./img/moveImg.png')}/>
</TouchableHighlight>
</View>
</ScrollView>
}
如果有人可以帮助我克服这个问题,将不胜感激。 非常感谢您的参与!
【问题讨论】:
标签: javascript dom react-native dom-manipulation