React native Can';t在我的视图中显示按钮
我无法在滚动视图下显示我的按钮。问题是什么React native Can';t在我的视图中显示按钮,react-native,button,scrollview,React Native,Button,Scrollview,我无法在滚动视图下显示我的按钮。问题是什么 return ( <View style={{width: width, height: undefined}}> <ScrollView style={{width: width, height: undefined}}> <View style={{flexDirection: 'row', width: width, flexWrap: 'wrap'}}>
return (
<View style={{width: width, height: undefined}}>
<ScrollView style={{width: width, height: undefined}}>
<View style={{flexDirection: 'row', width: width, flexWrap: 'wrap'}}>
{
this.state.photos.map((p, i) => {
return (
<SelectedPhoto
key={i}
index={i}
style={{
width: photoWidth,
height: photoWidth,
}}
limit={this.state.supportLength}
photo={p}
onSelectPhoto={this.onSelectPhoto}
onDeselectPhoto={this.onDeselectPhoto}
/>
);
})
}
</View>
</ScrollView>
<View style={{margin: 20, marginBottom: 40}}>
<Button
raised
onPress={this.onNext}
containerViewStyle={{width: width-80}}
backgroundColor={Colors.red}
title='NEXT' />
</View>
</View>
返回(
{
this.state.photos.map((p,i)=>{
返回(
);
})
}
以下是您所说的示例:
import React, { Component } from 'react';
import {
Text, View, StyleSheet, TouchableOpacity, ScrollView, Button
} from 'react-native';
import Dimensions from 'Dimensions';
const DeviceWidth = Dimensions.get('window').width;
const DeviceHeight = Dimensions.get('window').height;
export default class Visit extends React.Component {
render() {
return (
<View>
<ScrollView style={{width:DeviceWidth*1, height:DeviceHeight*0.5}}>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
<Text>foo bar baz</Text>
</ScrollView>
<Button
title="asdasd"
/>
</View>
);
}
}
import React,{Component}来自'React';
进口{
文本、视图、样式表、触摸不透明度、滚动视图、按钮
}从“反应本机”;
从“维度”导入维度;
const DeviceWidth=Dimensions.get('window').width;
const DeviceHeight=维度.get('window').height;
导出默认类访问扩展React.Component{
render(){
返回(
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
福吧巴兹酒店
);
}
}
我使用
维度来处理屏幕大小,因此宽度:DeviceWidth*1
表示100%的宽度,而高度:DeviceHeight*0.5
表示屏幕高度的50%高度尝试将滚动视图的高度设置为屏幕的一半,可能您的滚动视图隐藏按钮
@flix你能给我一个代码示例吗?我试过了,但没有解决问题。我添加了一个与此主题相关的新问题,但问题有点不同