Kol007
Kol007

Reputation: 292

react-native-navigation showInAppNotification blank

Trying use this.props.navigator.showInAppNotification

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

screen InAppNotification is registered, but see notification with blank content: enter image description here

Can anyone help with this?

example.InAppNotification:

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

Upvotes: 0

Views: 369

Answers (1)

Mohamed Khalil
Mohamed Khalil

Reputation: 3126

try by adding flex:1 to container View

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

also you need to register InAppNotification screen correctly

Upvotes: 2

Related Questions