2017-04-18 36 views
0

我在我的RN應用程序中有一個工具欄。該工具欄有一個特意超大的按鈕,並且從該組件溢出。
超大按鈕由同一頁面中的其他組件覆蓋。
enter image description here絕對位置的元素被其他組件切斷

touchable:{ 
    backgroundColor:'#3d3d3d', 
    borderRadius:27.5, 
    position:'absolute', 
    left:width/2 -25, 
    bottom:10, 
    alignItems:'center', 
    borderColor:'black', 
    width:55, 
    height:55, 
    justifyContent:'center', 
    } 

標記:

render() { 
    return (
    <View style={{flex: 1}}> 
     <View style={{position:'absolute', width:42,height:42,left:20,top:(height-42)/3,zIndex:3}}> 
      <Image style={{}} source={require('./Images/Ellipse 36.png')} /> 
      <Image style={{position:'absolute',top:14,left:14}} source={require('./Images/Asset 65.png')} /> 
     </View> 
     <View style={{position:'absolute', width:42,height:42,right:20,top:(height-42)/3,zIndex:3}}> 
      <Image style={{}} source={require('./Images/Ellipse 36.png')} /> 
      <Image style={{position:'absolute',top:10,left:12}} source={require('./Images/Asset 66.png')} /> 
     </View> 
     <View><TopToolbar text='Swipe' navigator={this.props.navigator} user={this.props.user}/></View> 
     <ScrollView style={{zIndex:1,}}><Inders style={{flex: 1}} navigator={this.props.navigator} credentials={this.props.credentials}/></ScrollView> 
     <View style={{zIndex:0,}}><BottomToolbar user={this.props.user} navigator={this.props.navigator} credentials={this.props.credentials}/></View> 
    </View> 
    ) 
    } 

凡Inders是一個組件。
我試着改變組件的順序,但沒有奏效。
使按鈕從另一個組件「浮動」的方法是什麼?

+0

您可以發佈您的React Native代碼示例。風格可能與它無關。 – powerc9000

+0

代碼的哪些部分可以幫助?該加價了嗎? –

+0

https://facebook.github.io/react-native/docs/layout-props.html#zindex –

回答

0

解決方案是將工具欄包裝在另一個視圖中,以便新視圖是要「浮動」的元素的父級。

0

在開發工具菜單中打開檢查器,找出誰剪掉了你的組件,我也喜歡設置backgroundColor來查看它們的位置,這使得解決這種類型的bug更加容易。

+1

我知道誰剪掉了我的組件,我正在嘗試修復它。 –

相關問題