2016-01-13 115 views
6

如何將絕對定位的元素/組件置於其後呈現的其他組件頂部。 我使用scrollview部件反應本機中的z-index問題

style: 
     width: 300, 
     height: 100, 
     position:'absolute', 
     top:30, 

但其他部件重疊滾動下拉菜單。 我將top改成bottom,但scrollview頂部的組件沒有重疊。

由於我是新來的這種反應,本機和不知道reactjs我無法找出解決方案和條款來表達我的問題,請幫助。我的問題如下圖我在scrollview組件和區域社會下拉菜單中 我附上屏幕截圖是另一個滾動視圖是可見的,重疊的第一部分

enter image description here

+1

出現同樣的問題,您是否發現任何解決方案/解決方法? – antihate

回答

2

編輯:陣營原生現在確實支持z-index財產! https://facebook.github.io/react-native/docs/layout-props.html

==老答案==

陣營本地沒有一個z-index財產。 z指數由組件的順序決定。例如:

<View> 
    <Image /> 
    <Text /> 
</View> 

<Text>將始終是<Image>上方。

+0

你可以建議任何建議,因爲我的scrollview組件高於另一個,所以我如何命令他們,讓他們不會超出我的scrollview? –

3

zIndex屬性支持反應原生版本0.29.0對於iOS

-2

我有一個類似的問題,它來自zIndex沒有應用到正確的組件。例如,如果你具備以下條件:

class App extends Component { 
    render() { 
     return (
      <View style={styles.form}> 
       <View style={styles.selectInput}> 
        <TextInput placeholder="Select something" /> 
        <Dropdown /> 
       </View> 
       <View style={styles.formInput}> 
        <TextInput placeholder="Stuff" /> 
       </View> 
       <View style={styles.formInput}> 
        <TextInput placeholder="Other stuff" /> 
       </View> 
      </View> 
     ); 
    } 
} 

並希望您的Dropdown組件上面去下面的2個表單輸入,你需要添加zIndex: 100到其容器,與selectInput風格的景觀。