0

尝试使用 this.props.navigator.showInAppNotification

this.props.navigator.showInAppNotification({
  screen: "example.InAppNotification", 
  passProps: {
    title: 'Title',
    body: 'Body...'
  }, 
  position: 'bottom',
  autoDismissTimerSec: 3
});

屏幕InAppNotification已注册,但看到通知内容为空白: 在此处输入图像描述

有人能帮忙吗?

示例.InAppNotification:

export default class InAppNotification extends Component {
  render() {
    console.log(this.props);
    return (
      <View>
        <Text>
          {JSON.stringify(this.props)}
        </Text>
      </View>
    );
  }
}
4

1 回答 1

2

尝试添加flex:1到容器View

export default class InAppNotification extends Component {
  render() {
  console.log(this.props);
  return (
    <View style={{ flex: 1 }}>
      <Text>
        {JSON.stringify(this.props)}
      </Text>
    </View>
  );
 }
}

您还需要正确注册 InAppNotification 屏幕

于 2017-09-20T10:19:05.020 回答