首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >文本可见,但不是同一覆盖块中的两个按钮

文本可见,但不是同一覆盖块中的两个按钮
EN

Stack Overflow用户
提问于 2021-03-04 03:08:28
回答 2查看 182关注 0票数 0

我正在向React Native 0.62.3应用程序添加一个覆盖(react-native-element 3.2)。这个页面是用Native Base 2.13.14编排的。我注意到之前的原生基页与react-native-elements或原生元素不兼容。代码如下:

代码语言:javascript
运行
复制
import { Container,  Left, Right, Body, Icon, Header,Text, Button, Content,  Form, Textarea, Card, CardItem } from 'native-base';
import { Col, Row, Grid } from 'react-native-easy-grid';
import {Overlay} from 'react-native-elements';

return (
               
        <Container style={styles.container}>
            
                <Header>
                    <Left>
                        <Button onPress={showOverlay} transparent>
                        <Icon name="arrow-back-sharp" />
                        </Button>
                    </Left>
                    
                    <Right>
                        <ReturnButton type={"fortrade"} />
                        <ReturnButton type={"forsale"} />
                        <Button onPress={clickSave} disabled={!post} transparent>
                            <Icon name='checkmark-outline' />
                        </Button>  
                    </Right>
                </Header>
                
                <Content style={styles.contentContainer}
                    showsHorizontalScrollIndicator={false}
                    showsVerticalScrollIndicator={false}
                    >
                        <Form>
                            <TextInput onChangeText={nameChange} placeholder={'作品名称'} value={name} />
                            <TextInput onChangeText={authorChange} placeholder={'作者'} value={author} />
                            
                            <TextInput keyboardType={'number-pad'} autoFocus={true} value={price.toString()} onChangeText={priceChange} placeholder={'卖价'} />
                            <TextInput keyboardType={'number-pad'} value={shippingCost.toString()} onChangeText={shChange} placeholder={'运费'} />
                            
                            <Textarea padder rowSpan={2} bordered placeholder={'介绍'} onChangeText={despChange} value={description} />
                        </Form>
                        
                        <DisplayImages pics={imgs} deleteImage={()=>{}} noDelete={true} updateImage={() => {}} swipeImage={swipeImage}/> 
                        
                </Content>
                
                    //<<==below is the overlay
                    <Overlay isVisible={isOverlayVisible} onBackdropPress={toggleOverlay}>
                            <View style={{position:"relative", width:200, paddingTop:10, alignContents:"top", alignItems:"center"}}>
                                <Text>I am here</Text>
                                <Button onPress={sellerMakeDeposit} title="存保证金" />
                                <Button onPress={sellerCancel} title="下市" />
                            </View>
                    </Overlay>  
                
                
                <Footerbar />              
                
        </Container>
    );
};

const styles = StyleSheet.create({
    modalContainer: {  
        flex: 1,  
        alignItems: 'center',  
        justifyContent: 'center',  
        backgroundColor: '#ecf0f1',  
      }, 
    modal: {  
        justifyContent: 'center',  
        alignItems: 'center',   
        //backgroundColor : "#00BCD4",   
        height: 200 ,  
        width: '67%',  
        borderRadius:10, 
        borderWidth: 1,  
        borderColor: 'black',    
        marginTop: 80,  
        marginLeft: 50,  
    },  
    modealOpacity: {
        flex:1,
    },
    tags:{

    },
    row:{
        paddingTop:0,
    },
    content:{

    //alignContent:"center",
    },

    container: {
        paddingTop:0,
    //justifyContent: 'center',     
    },
    contentContainer: {
        paddingTop:2,
        paddingLeft: 10,
        paddingRight:10,
        backgroundColor: '#F5FCFF',
    },
});

下面是显示的页面:

是可见的。然而,两个按钮无处可见。已尝试设置height:400,但按钮仍然不可见。如何使按钮适应叠加屏幕?

EN

Stack Overflow用户

发布于 2021-03-04 03:59:36

这样使用您的按钮:

<Button><Text>Hello world</Text></Button>

请注意,文本由<Text>组件包装。

这是link to the solution I think is the best,即使它不是被选中的,这是一个小的button comparison on snack Expo (在android上运行它,出于模糊的原因,你需要触发一个渲染来使原生按钮出现)。

票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66463370

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档