@trycourier/courier-react-native 2.0.0-beta8 → 2.0.0-beta9

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.
@@ -101,7 +101,7 @@ dependencies {
101
101
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
102
102
 
103
103
  // Courier Core SDK
104
- api 'com.github.trycourier:courier-android:2.0.32'
104
+ api 'com.github.trycourier:courier-android:2.0.37'
105
105
  api 'androidx.recyclerview:recyclerview:1.3.1'
106
106
 
107
107
  }
@@ -3,9 +3,9 @@ package com.courierreactnative
3
3
  import android.content.Context
4
4
  import android.graphics.Color
5
5
  import android.graphics.Typeface
6
- import android.os.Handler
7
6
  import android.view.View
8
7
  import androidx.recyclerview.widget.DividerItemDecoration
8
+ import com.courier.android.inbox.CourierInbox
9
9
  import com.courier.android.inbox.CourierInboxButtonStyles
10
10
  import com.courier.android.inbox.CourierInboxFont
11
11
  import com.courier.android.inbox.CourierInboxTheme
@@ -16,7 +16,7 @@ import com.facebook.react.uimanager.ThemedReactContext
16
16
  import com.facebook.react.uimanager.annotations.ReactProp
17
17
 
18
18
 
19
- class CourierReactNativeViewManager : SimpleViewManager<ReactNativeCourierInbox>() {
19
+ class CourierReactNativeViewManager : SimpleViewManager<CourierInbox>() {
20
20
 
21
21
  private companion object {
22
22
  const val ON_CLICK_MESSAGE_AT_INDEX = "courierClickMessageAtIndex"
@@ -26,14 +26,14 @@ class CourierReactNativeViewManager : SimpleViewManager<ReactNativeCourierInbox>
26
26
 
27
27
  override fun getName() = "CourierReactNativeView"
28
28
 
29
- override fun createViewInstance(reactContext: ThemedReactContext): ReactNativeCourierInbox = ReactNativeCourierInbox(reactContext)
29
+ override fun createViewInstance(reactContext: ThemedReactContext): CourierInbox = CourierInbox(reactContext)
30
30
 
31
31
  private val View.reactContext: ThemedReactContext get() = context as ThemedReactContext
32
32
 
33
33
  @ReactProp(name = "onClickInboxMessageAtIndex")
34
- fun setOnClickInboxMessageAtIndex(view: ReactNativeCourierInbox, callback: Boolean) {
34
+ fun setOnClickInboxMessageAtIndex(view: CourierInbox, callback: Boolean) {
35
35
 
36
- view.inbox.setOnClickMessageListener { message, index ->
36
+ view.setOnClickMessageListener { message, index ->
37
37
 
38
38
  val map = Arguments.createMap()
39
39
  map.putMap("message", message.toWritableMap())
@@ -46,9 +46,9 @@ class CourierReactNativeViewManager : SimpleViewManager<ReactNativeCourierInbox>
46
46
  }
47
47
 
48
48
  @ReactProp(name = "onClickInboxActionForMessageAtIndex")
49
- fun setOnClickInboxActionForMessageAtIndex(view: ReactNativeCourierInbox, callback: Boolean) {
49
+ fun setOnClickInboxActionForMessageAtIndex(view: CourierInbox, callback: Boolean) {
50
50
 
51
- view.inbox.setOnClickActionListener { action, message, index ->
51
+ view.setOnClickActionListener { action, message, index ->
52
52
 
53
53
  val map = Arguments.createMap()
54
54
  map.putMap("action", action.toWritableMap())
@@ -62,9 +62,9 @@ class CourierReactNativeViewManager : SimpleViewManager<ReactNativeCourierInbox>
62
62
  }
63
63
 
64
64
  @ReactProp(name = "onScrollInbox")
65
- fun setOnScrollInbox(view: ReactNativeCourierInbox, callback: Boolean) {
65
+ fun setOnScrollInbox(view: CourierInbox, callback: Boolean) {
66
66
 
67
- view.inbox.setOnScrollInboxListener { offsetInDp ->
67
+ view.setOnScrollInboxListener { offsetInDp ->
68
68
 
69
69
  val offset = Arguments.createMap()
70
70
  offset.putInt("y", offsetInDp)
@@ -80,9 +80,9 @@ class CourierReactNativeViewManager : SimpleViewManager<ReactNativeCourierInbox>
80
80
  }
81
81
 
82
82
  @ReactProp(name = "theme")
83
- fun setTheme(view: ReactNativeCourierInbox, theme: ReadableMap) {
84
- view.inbox.lightTheme = theme.getMap("light")?.toTheme(view) ?: CourierInboxTheme.DEFAULT_LIGHT
85
- view.inbox.darkTheme = theme.getMap("dark")?.toTheme(view) ?: CourierInboxTheme.DEFAULT_DARK
83
+ fun setTheme(view: CourierInbox, theme: ReadableMap) {
84
+ view.lightTheme = theme.getMap("light")?.toTheme(view) ?: CourierInboxTheme.DEFAULT_LIGHT
85
+ view.darkTheme = theme.getMap("dark")?.toTheme(view) ?: CourierInboxTheme.DEFAULT_DARK
86
86
  }
87
87
 
88
88
  private fun ReadableMap.toTheme(view: View): CourierInboxTheme {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trycourier/courier-react-native",
3
- "version": "2.0.0-beta8",
3
+ "version": "2.0.0-beta9",
4
4
  "description": "Inbox & Push Notifications for React Native",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,49 +0,0 @@
1
- package com.courierreactnative
2
-
3
- import android.annotation.SuppressLint
4
- import android.content.Context
5
- import android.util.AttributeSet
6
- import android.widget.FrameLayout
7
- import com.courier.android.inbox.CourierInbox
8
-
9
- class ReactNativeCourierInbox @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr) {
10
-
11
- var inbox: CourierInbox
12
-
13
- init {
14
-
15
- // Create an instance of CourierInbox
16
- inbox = CourierInbox(context, attrs, defStyleAttr)
17
-
18
- // Set layout parameters to fill parent
19
- val layoutParams = LayoutParams(
20
- LayoutParams.MATCH_PARENT,
21
- LayoutParams.MATCH_PARENT
22
- )
23
-
24
- // Apply the layout parameters
25
- inbox.layoutParams = layoutParams
26
-
27
- // Add it as a child of this custom view
28
- addView(inbox)
29
-
30
- }
31
-
32
- // private var mRequestedLayout = false
33
- //
34
- // @SuppressLint("WrongCall")
35
- // override fun requestLayout() {
36
- // super.requestLayout()
37
- // // We need to intercept this method because if we don't our children will never update
38
- // // Check https://stackoverflow.com/questions/49371866/recyclerview-wont-update-child-until-i-scroll
39
- // if (!mRequestedLayout) {
40
- // mRequestedLayout = true
41
- // post {
42
- // mRequestedLayout = false
43
- // layout(left, top, right, bottom)
44
- // onLayout(false, left, top, right, bottom)
45
- // }
46
- // }
47
- // }
48
-
49
- }