@pinwheel/react-native-pinwheel 3.2.0-rc.6 → 3.2.1

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.
@@ -32,7 +32,7 @@ repositories {
32
32
  google()
33
33
  }
34
34
 
35
- def PW_ANDROID_SDK_VERSION = '3.1.1'
35
+ def PW_ANDROID_SDK_VERSION = '3.1.2'
36
36
 
37
37
  dependencies {
38
38
  def pwVersion = rootProject.hasProperty('pwVersion') ? rootProject.pwVersion : PW_ANDROID_SDK_VERSION
@@ -14,11 +14,13 @@ import com.facebook.react.bridge.ReactApplicationContext
14
14
  import com.underdog_tech.pinwheel_android.PinwheelEventListener
15
15
  import com.underdog_tech.pinwheel_android.PinwheelFragment
16
16
  import com.facebook.react.uimanager.ThemedReactContext
17
+ import com.facebook.react.modules.systeminfo.ReactNativeVersion
17
18
 
18
19
  class Pinwheel : FrameLayout {
19
20
  private var token: String? = null
20
21
  private var pinwheelFragment: PinwheelFragment? = null
21
22
  private var pinwheelEventListener: PinwheelEventListener? = null
23
+ private var handleInsets: Boolean = true
22
24
 
23
25
  constructor(context: Context) : super(context) {
24
26
  init()
@@ -45,10 +47,19 @@ class Pinwheel : FrameLayout {
45
47
  this.token = token
46
48
  }
47
49
 
50
+ fun setHandleInsets(handleInsets: Boolean) {
51
+ this.handleInsets = handleInsets
52
+ }
53
+
54
+ fun getReactNativeVersion(): String {
55
+ val version = ReactNativeVersion.VERSION
56
+ return "${version["major"]}.${version["minor"]}.${version["patch"]}"
57
+ }
58
+
48
59
  private fun createFragment() {
49
60
  Handler(Looper.getMainLooper()).post {
50
61
  this.token?.let {
51
- val pinwheelFragment = PinwheelFragment.newInstance(it, "react native", "3.2.0")
62
+ val pinwheelFragment = PinwheelFragment.newInstance(it, "react native", "3.2.1", getReactNativeVersion(), this.handleInsets)
52
63
  pinwheelEventListener?.let { listener ->
53
64
  pinwheelFragment.pinwheelEventListener = listener
54
65
  }
@@ -12,7 +12,7 @@ import com.facebook.react.viewmanagers.RTNPinwheelManagerInterface
12
12
  import com.facebook.react.viewmanagers.RTNPinwheelManagerDelegate
13
13
 
14
14
  @ReactModule(name = PinwheelManager.NAME)
15
- class PinwheelManager(private val reactContext: ReactApplicationContext) :
15
+ class PinwheelManager(private val reactContext: ReactApplicationContext) :
16
16
  SimpleViewManager<Pinwheel>(),
17
17
  RTNPinwheelManagerInterface<Pinwheel> {
18
18
 
@@ -29,7 +29,7 @@ class PinwheelManager(private val reactContext: ReactApplicationContext) :
29
29
  (reactContext.getNativeModule(PinwheelEventsModule::class.java) as? PinwheelEventsModule)?.let { module ->
30
30
  view.setPinwheelEventListener(module)
31
31
  }
32
-
32
+
33
33
  return view
34
34
  }
35
35
 
@@ -38,6 +38,11 @@ class PinwheelManager(private val reactContext: ReactApplicationContext) :
38
38
  view.setToken(token)
39
39
  }
40
40
 
41
+ @ReactProp(name = "handleInsets")
42
+ override fun setHandleInsets(view: Pinwheel, handleInsets: Boolean) {
43
+ view.setHandleInsets(handleInsets)
44
+ }
45
+
41
46
  @ReactPropGroup(names = ["width", "height"], customType = "Style")
42
47
  fun setStyle(view: Pinwheel, index: Int, value: Int) {
43
48
  if (index == 0) propWidth = value
@@ -38,7 +38,7 @@ using namespace facebook::react;
38
38
 
39
39
  - (void)initPinwheelWrapperVC {
40
40
  if (self.token != nil && self.pinwheelWrapperVC == nil) {
41
- self.pinwheelWrapperVC = [[PinwheelVCWrapper alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.0"];
41
+ self.pinwheelWrapperVC = [[PinwheelVCWrapper alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.1"];
42
42
  [self addSubview:self.pinwheelWrapperVC.view];
43
43
  }
44
44
  }
@@ -102,7 +102,7 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
102
102
  return RTNPinwheelView.class;
103
103
  }
104
104
 
105
- #else
105
+ #else
106
106
 
107
107
  #import "RTNPinwheelView.h"
108
108
  #import "RTNPinwheelEvents.h"
@@ -125,7 +125,7 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void)
125
125
 
126
126
  - (void)initPinwheelWrapperVC {
127
127
  if (self.token != nil && self.pinwheelWrapperVC == nil) {
128
- self.pinwheelWrapperVC = [[PinwheelVCWrapper alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.0"];
128
+ self.pinwheelWrapperVC = [[PinwheelVCWrapper alloc] initWithToken:self.token delegate:self sdk:@"react native" version: @"3.2.1"];
129
129
  [self addSubview:self.pinwheelWrapperVC.view];
130
130
  }
131
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinwheel/react-native-pinwheel",
3
- "version": "3.2.0-rc.6",
3
+ "version": "3.2.1",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/Pinwheel.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
2
  import { LinkOptions } from './client-events/client';
3
- declare const Pinwheel: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent, }: LinkOptions) => React.JSX.Element;
3
+ declare const Pinwheel: ({ linkToken, onLogin, onLoginAttempt, onSuccess, onError, onExit, onEvent, handleInsets, }: LinkOptions & {
4
+ handleInsets?: boolean;
5
+ }) => React.JSX.Element;
4
6
  export default Pinwheel;
package/src/Pinwheel.tsx CHANGED
@@ -17,7 +17,10 @@ const Pinwheel = ({
17
17
  onError,
18
18
  onExit,
19
19
  onEvent,
20
- }: LinkOptions) => {
20
+ handleInsets,
21
+ }: LinkOptions & {
22
+ handleInsets?: boolean;
23
+ }) => {
21
24
  const eventsListener = useCallback(
22
25
  (event: any) => {
23
26
  if (!event) {
@@ -72,7 +75,13 @@ const Pinwheel = ({
72
75
 
73
76
  return (
74
77
  <SafeAreaView style={styles.container}>
75
- {linkToken && <RTNPinwheel style={{ flex: 1 }} token={linkToken} />}
78
+ {linkToken && (
79
+ <RTNPinwheel
80
+ style={{ flex: 1 }}
81
+ token={linkToken}
82
+ handleInsets={handleInsets ?? true}
83
+ />
84
+ )}
76
85
  </SafeAreaView>
77
86
  );
78
87
  };
@@ -1,7 +1,8 @@
1
- import type { ViewProps } from "react-native";
2
- import type { HostComponent } from "react-native";
1
+ import type { ViewProps } from 'react-native';
2
+ import type { HostComponent } from 'react-native';
3
3
  export interface NativeProps extends ViewProps {
4
4
  token: string;
5
+ handleInsets: boolean;
5
6
  }
6
7
  declare const _default: HostComponent<NativeProps>;
7
8
  export default _default;
@@ -1,15 +1,16 @@
1
- import type { ViewProps } from "react-native";
2
- import type { HostComponent } from "react-native";
3
- import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
1
+ import type { ViewProps } from 'react-native';
2
+ import type { HostComponent } from 'react-native';
3
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
4
 
5
5
  type Event = {
6
- name: string;
7
- }
6
+ name: string;
7
+ };
8
8
 
9
9
  export interface NativeProps extends ViewProps {
10
- token: string;
10
+ token: string;
11
+ handleInsets: boolean;
11
12
  }
12
13
 
13
14
  export default codegenNativeComponent<NativeProps>(
14
- "RTNPinwheel"
15
- ) as HostComponent<NativeProps>;
15
+ 'RTNPinwheel'
16
+ ) as HostComponent<NativeProps>;