react-native-navigation showInAppNotification为空

时间:2017-09-20 10:08:01

标签: android react-native react-native-navigation

尝试使用this.props.navigator.showInAppNotification

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

屏幕 InAppNotification 已注册,但请参阅包含空白内容的通知: enter image description here

任何人都可以帮忙吗?

example.InAppNotification:

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

1 个答案:

答案 0 :(得分: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屏幕