Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

}
Expand Down
28 changes: 28 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React, { useEffect } from 'react';
import type { PropsWithChildren } from 'react';
import {
Button,
SafeAreaView,
ScrollView,
StatusBar,
Expand Down Expand Up @@ -106,6 +107,26 @@
<Section title="Debug">
<DebugInstructions />
</Section>
<Section title="Open Widget">
<View style={styles.buttonGroup}>
<Button

Check warning on line 112 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `⏎················title="Open·Widget"⏎················onPress={()·=>·Cello.openWidget()}⏎·············` with `·title="Open·Widget"·onPress={()·=>·Cello.openWidget()}`
title="Open Widget"
onPress={() => Cello.openWidget()}
/>
<View style={styles.buttonSpacer} />
<Button
title="Open Rewards"
onPress={() => Cello.openWidget('rewards')}
color="#6200ee"
/>
<View style={styles.buttonSpacer} />
<Button
title="Open Edit Payments"
onPress={() => Cello.openWidget('edit-payments')}
color="#03dac6"
/>
</View>
</Section>
<Section title="Learn More">
Read the docs to discover what to do next:
</Section>
Expand Down Expand Up @@ -133,6 +154,13 @@
highlight: {
fontWeight: '700',
},
buttonGroup: {
marginTop: 12,
gap: 8,
},
buttonSpacer: {
height: 8,
},
});

export default App;
2 changes: 1 addition & 1 deletion ios/CelloReactNative.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions ios/CelloReactNative.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ function hideFab() {
return CelloReactNative.hideFab();
}

function openWidget() {
return CelloReactNative.openWidget();
function openWidget(destination?: string) {
return CelloReactNative.openWidget(destination);
}

function hideWidget() {
Expand Down
Loading