flash-notifications 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "main": "index.js",
3
3
  "name": "flash-notifications",
4
- "version": "0.0.9",
4
+ "version": "0.0.11",
5
5
  "private": false,
6
6
  "dependencies": {
7
7
  "diggerize": "^1.0.5",
@@ -30,7 +30,8 @@ export default memo(shapeComponent(class FlashNotificationsContainer extends Sha
30
30
  <Notification
31
31
  key={`notification-${notification.count}`}
32
32
  message={notification.message}
33
- onRemovedClicked={(e) => this.onRemovedClicked(e, notification)}
33
+ notification={notification}
34
+ onRemovedClicked={this.onRemovedClicked}
34
35
  title={notification.title}
35
36
  type={notification.type}
36
37
  />
@@ -55,10 +56,7 @@ export default memo(shapeComponent(class FlashNotificationsContainer extends Sha
55
56
  this.setState({count, notifications: this.state.notifications.concat([notification])})
56
57
  }
57
58
 
58
- onRemovedClicked = (e, notification) => {
59
- e.preventDefault()
60
- removeNotification(digg(notification, "count"))
61
- }
59
+ onRemovedClicked = (notification) => this.removeNotification(digg(notification, "count"))
62
60
 
63
61
  removeNotification = (count) => {
64
62
  this.setState({
@@ -8,13 +8,14 @@ export default memo(shapeComponent(class NotificationsNotification extends Shape
8
8
  static propTypes = PropTypesExact({
9
9
  className: PropTypes.string,
10
10
  message: PropTypes.string.isRequired,
11
+ notification: PropTypes.object.isRequired,
11
12
  onRemovedClicked: PropTypes.func.isRequired,
12
13
  title: PropTypes.string.isRequired,
13
14
  type: PropTypes.string.isRequired
14
15
  })
15
16
 
16
17
  render() {
17
- const {className, message, onRemovedClicked, title, type} = this.props
18
+ const {className, message, title, type} = this.props
18
19
 
19
20
  const style = {
20
21
  width: 300,
@@ -42,7 +43,7 @@ export default memo(shapeComponent(class NotificationsNotification extends Shape
42
43
  }
43
44
 
44
45
  return (
45
- <Pressable dataSet={{class: classNames("flash-notifications-notification", className), type}} onPress={onRemovedClicked}>
46
+ <Pressable dataSet={{class: classNames("flash-notifications-notification", className), type}} onPress={this.onRemovedClicked}>
46
47
  <View style={style}>
47
48
  <View dataSet={{class: "notification-title"}} style={{marginBottom: 5}}>
48
49
  <Text style={{color: "#fff", fontWeight: "bold"}}>
@@ -58,4 +59,8 @@ export default memo(shapeComponent(class NotificationsNotification extends Shape
58
59
  </Pressable>
59
60
  )
60
61
  }
62
+
63
+ onRemovedClicked = () => {
64
+ this.props.onRemovedClicked(this.props.notification)
65
+ }
61
66
  }))