2017-05-25 138 views
0

我在屏幕底部有TextInput。當TextInput被關注時,鍵盤出現,並且由於這個,所有的flex視圖都縮小到可用的屏幕。我希望實現該頁面佈局不應該改變和輸入應該是用戶可見。反應原生軟鍵盤問題

<View style={MainView}> 
     <View style={subMain1}> 
      <View style={{flex:1,backgroundColor:'#add264'}}></View> 
      <View style={{flex:1,backgroundColor:'#b7d778'}}></View> 
      <View style={{flex:1,backgroundColor:'#c2dd8b'}}></View> 
     </View> 
     <View style={subMain2}> 
      <View style={{flex:1,backgroundColor:'#cce39f'}}></View> 
      <View style={{flex:1,backgroundColor:'#d6e9b3'}}></View> 
      <View style={{flex:1,backgroundColor:'#69ee9a'}}> 
       <TextInput placeholder="input field"/> 
      </View> 

     </View> 
    </View> 

常量樣式= {

MainView:{ 
    flex:1, 
    backgroundColor:'green' 
}, 
subMain1:{ 
    flex:1, 
    backgroundColor:'blue' 
}, 
subMain2:{ 
    flex:1, 
    backgroundColor:'orange' 
} 

} enter image description here

回答

0

我不是很肯定我理解的問題,您正在運行的產品進入,但我最近與鍵盤掙扎避免在我的應用程序中查看 - 出於某種原因,本地組件無法正常工作。

檢查這個包了 - 它的伎倆對我來說,並提供了一些很酷的定製功能: https://github.com/APSL/react-native-keyboard-aware-scroll-view

1

我只是找到了一個答案。

我只需要爲我的主容器和內部使用固定高度,我可以使用柔性佈局。如果鍵盤隱藏了內容,那麼我們可以使用滾動查看,當用戶點擊輸入時,該滾動查看將允許滾動界面。

這幫助我希望它可以幫助別人。 :)