我是React Native的新手,所以我可能会问一些非常明显的事情,但请帮忙.
我有一个可触摸的视图,所以整个区域响应攻丝.然后将ScrollView嵌套在视图中.整体结构是这样的:
<TouchableWithoutFeedback onPress={this.handlePress.bind(this)}>
<View>
<ScrollView>
<Text>Hello, here is a very long text that needs scrolling.</Text>
<ScrollView>
</View>
</TouchableWithoutFeedback>
Run Code Online (Sandbox Code Playgroud)
编译并运行时,会检测到点击,但滚动视图根本不会滚动.我使上面的代码简洁明了,但每个组件都有正确的样式,我可以看到所有渲染都很好,长文本在ScrollView的底部被截断.请帮忙.
谢谢!
不幸的是,我的ScrollView没有滚动,我尝试过这里发布的解决方案:React-Native,Scroll View Not Scrolling,但它似乎没有帮助.有没有人遇到这个,能够帮助我吗?
<View style={styles.container}>
<View style={{ flex: 1 }}>
<ImageBackground
style={{ height: "100%", width: "100%" }}
source={{ uri: IMAGE }}
resizeMode="cover"
>
<Overlay styleName="fill-parent">
<Title>Title</Title>
{this.renderOffer()}
{this.renderSwitch()}
</Overlay>
</ImageBackground>
</View>
<View style={{ backgroundColor: "white", flex: 1 }}>
<View style={{ paddingTop: 5 }}>
<Title styleName="md-gutter-bottom h-center">Title</Title>
</View>
<ScrollView
style={{
backgroundColor: "white",
flex: 1,
marginBottom: 5,
marginTop: 0
}}
>
<Caption style={{ margin: 10 }}>
A Stop on the Salt Route 1000 B.C. As they rounded a bend …Run Code Online (Sandbox Code Playgroud)我试图在 ReactNative 的 View 中创建一个滚动视图。由于某种原因,我无法在 ScrollView 中滚动。
render() {
return (
<View>
<View>
<Text>Top</Text>
</View>
<ScrollView >
<Text>Line 1</Text>
<Text>Line 2</Text>
<Text>Line 3</Text>
<Text>Line 4</Text>
<Text>Line 5</Text>
<Text>Line 6</Text>
<Text>Line 7</Text>
...
</ScrollView>
</View>
);
}
Run Code Online (Sandbox Code Playgroud)
这里有什么问题吗?我在 Android 上测试
谢谢,马格努斯