diff --git a/android/src/main/java/com/celloreactnative/CelloReactNativeModule.kt b/android/src/main/java/com/celloreactnative/CelloReactNativeModule.kt index 6b794dc..5860ea8 100644 --- a/android/src/main/java/com/celloreactnative/CelloReactNativeModule.kt +++ b/android/src/main/java/com/celloreactnative/CelloReactNativeModule.kt @@ -101,9 +101,9 @@ class CelloReactNativeModule(reactContext: ReactApplicationContext) : } @ReactMethod - fun openWidget() { + fun openWidget(destination: String?) { try { - Cello.client()?.openWidget() + Cello.client()?.openWidget(destination = destination) } catch (e: Exception) { } diff --git a/example/src/App.tsx b/example/src/App.tsx index 94e88df..29da301 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -2,6 +2,7 @@ import Cello, { CelloEvents } from '@getcello/cello-react-native'; import React, { useEffect } from 'react'; import type { PropsWithChildren } from 'react'; import { + Button, SafeAreaView, ScrollView, StatusBar, @@ -106,6 +107,26 @@ function App(): JSX.Element {
+
+ +
Read the docs to discover what to do next:
@@ -133,6 +154,13 @@ const styles = StyleSheet.create({ highlight: { fontWeight: '700', }, + buttonGroup: { + marginTop: 12, + gap: 8, + }, + buttonSpacer: { + height: 8, + }, }); export default App; diff --git a/ios/CelloReactNative.mm b/ios/CelloReactNative.mm index ba3c0fd..a784931 100644 --- a/ios/CelloReactNative.mm +++ b/ios/CelloReactNative.mm @@ -27,7 +27,7 @@ @interface RCT_EXTERN_MODULE(CelloReactNative, NSObject) RCT_EXTERN_METHOD(hideFab) -RCT_EXTERN_METHOD(openWidget) +RCT_EXTERN_METHOD(openWidget:(nullable NSString *)destination) RCT_EXTERN_METHOD(hideWidget) diff --git a/ios/CelloReactNative.swift b/ios/CelloReactNative.swift index 97f4845..37831fe 100644 --- a/ios/CelloReactNative.swift +++ b/ios/CelloReactNative.swift @@ -88,9 +88,9 @@ class CelloReactNative: NSObject { Cello.hideFab() } - @objc(openWidget) - func openWidget() -> Void { - Cello.openWidget() + @objc(openWidget:) + func openWidget(destination: String?) -> Void { + Cello.openWidget(destination: destination) } @objc(hideWidget) diff --git a/src/index.tsx b/src/index.tsx index dd94a41..4ca47fc 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -99,8 +99,8 @@ function hideFab() { return CelloReactNative.hideFab(); } -function openWidget() { - return CelloReactNative.openWidget(); +function openWidget(destination?: string) { + return CelloReactNative.openWidget(destination); } function hideWidget() {