【问题标题】:react native paper header Appbar.Content issue反应原生纸张标题 Appbar.Content 问题
【发布时间】:2020-10-29 10:08:51
【问题描述】:

在这张图片中听到我在 Appbar 中添加了标题(react native paper appbar),但它没有显示完整。

我想显示整个标题

听到是我的密码

export default function Header(props) {
  const navigation = useNavigation();
  return (
    <Appbar.Header style={{backgroundColor: primaryBlack}}>
      <Appbar.Action
        icon="menu"
        onPress={() => navigation.openDrawer()}
        size={28}
        style={{paddingLeft: 3}}
      />
      <Appbar.Content 
          title={<Text style={{color: textColor, fontSize: 20}}> This 
        is not display </Text>}
          style={{marginLeft: -10}}
       />
    <Appbar.Content
      onPress={() =>
       props.goback ? navigation.goBack() : navigation.navigate('Profile')
      }
      title={
      <TouchableOpacity
        onPress={() =>
          props.goback ? navigation.goBack() : navigation.navigate('Profile')
        }
        style={{flexDirection: 'row', display: 'flex'}}>
        <Icon name={'ellipsis-vertical'} size={20} color={'#000'} />
        <Text style={{color: textColor, fontSize: 21}}>test</Text>
      </TouchableOpacity>
     }
     style={{alignItems: 'flex-end'}}
    />
    </Appbar.Header>
  );
}

请帮我解决这个问题...

【问题讨论】:

  • 分享你的完整代码
  • 我更新问题并添加完整代码
  • 您的选项图标和“测试”标题在哪里?
  • @NooruddinLakhani okkk 现在请帮助我..
  • 我回答了,请检查,如果有帮助请投票,谢谢:-)

标签: react-native react-native-paper


【解决方案1】:

在 last 的 App.Bar 内容样式中添加 flex:0 类似

<Appbar.Content
      onPress={() =>
       props.goback ? navigation.goBack() : navigation.navigate('Profile')
      }
      title={
      <TouchableOpacity
        onPress={() =>
          props.goback ? navigation.goBack() : navigation.navigate('Profile')
        }
        style={{flexDirection: 'row', display: 'flex'}}>
        <Icon name={'ellipsis-vertical'} size={20} color={'#000'} />
        <Text style={{color: textColor, fontSize: 21}}>test</Text>
      </TouchableOpacity>
     }
     style={{flex: 0}} // Update with this style will solve the issue
 />

查看示例Snack

【讨论】:

    猜你喜欢
    • 2020-02-04
    • 2023-03-26
    • 1970-01-01
    • 2019-07-31
    • 1970-01-01
    • 2022-01-22
    • 2021-02-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多