2017-10-13 3 views
0

나는 네비게이션 용 새끼 고양이 UI를 사용하고있다. titleheaderLeft을 렌더링 할 수 있지만 headerRight은 표시되지 않습니다.headerRight가 밀리 초 단위로 표시되고 사라집니다. (반응 탐색)

이것은 navBar.js (ThemedNavigationBar)

_renderRight(headerRight) { 
    let windowWidth = Dimensions.get('window').width; 
    const width = this.state.width 
     ? (windowWidth - this.state.width)/2 
     : undefined; 
    return headerRight && (
     <View style={[{width}, styles.right]}>{headerRight}</View> 
    ); 

    } 

render() { 
    let options = this.props.headerProps.getScreenDetails(this.props.headerProps.scene).options; 
    return (
     <View style={styles.layout}> 
     <View style={styles.container}> 
      {this._renderTitle(options.title, options.headerTitle)} 
      {this._renderLeft(options.headerLeft)} 
      {this._renderRight(options.headerRight)} 
     </View> 
     </View> 
    ) 
    } 

입니다 (이미지는이 질문의 맨 아래에 부착) 이것은 나의과 changepassword의 navigationOption

static navigationOptions = ({ navigation }) => ({ 
    title: `Change Password`, 
    tabBarVisible: false, 
    headerRight: (<- RIGHT HERE 
     <Button 
     title='SAVE' 
     /> 
    ), 
    header: (headerProps) => { 
     return <ThemedNavigationBar navigation={navigation} headerProps={headerProps}/> 
    } 
}); 

<Button title='SAVE' />가 표시되지 않습니다!

enter image description here

UPDATE 내가 지금 무슨 일이 벌어지고있는 거지 (30)에 0에서 styles.right.right 설정이 이상한 찾고 탐색을 얻고있다

enter image description here

?

left: { 
    position: 'absolute', 
    top: 0, 
    bottom: 0, 
    justifyContent: 'center' 
    }, 
    right: { 
    position: 'absolute', 
    right: 30, <- I set right from 30 to 0 and I could see the button (But it shows just the part of the botton. Can I do it better? 
    top: 0, 
    bottom: 0, 
    justifyContent: 'center' 
    }, 
    title: { 
    ...StyleSheet.absoluteFillObject, 
    justifyContent: 'center', 
    alignItems: 'center', 

답변

0

정확한 너비를 설정하면 {width: 40} 내 문제가 해결되었습니다. 고마워요.