Skip to content

Commit a6f74ef

Browse files
feat: added Expo support (#1)
1 parent d4c291d commit a6f74ef

13 files changed

Lines changed: 3885 additions & 95 deletions

File tree

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @generated by expo-module-scripts
2+
const baseConfig = require('expo-module-scripts/eslintrc.base.js');
3+
4+
module.exports = {
5+
...baseConfig,
6+
env: {
7+
node: true,
8+
},
9+
};

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- [IOS](#ios)
1919
- [iOS: Manual linking with React Native v0.59 and below](#ios-manual-linking-with-react-native-v059-and-below)
2020
- [iOS: Setup](#ios-setup)
21+
- [Expo](#expo)
2122
- [Common Methods](#methods)
2223
- [Usage](#usage)
2324
- [Troubleshooting](#troubleshooting)
@@ -167,6 +168,43 @@ See [How to manually link IOS Cello SDK](https://docs.cello.so/docs/cello-for-io
167168
168169
---
169170
171+
### Expo
172+
173+
If you are using Expo, you can use the built-in plugin.
174+
175+
After installing this package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
176+
177+
```json
178+
{
179+
"expo": {
180+
"plugins": ["@getcello/cello-react-native"]
181+
}
182+
}
183+
```
184+
185+
The plugin provides props to set environment. Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app. If no extra properties are added, defaults will be used.
186+
187+
- `env` (_string_): Set to your desired environment, such as `prod`, `sandbox`. Optional. Defaults to `prod`.
188+
189+
```json
190+
{
191+
"expo": {
192+
"plugins": [
193+
[
194+
"@getcello/cello-react-native",
195+
{
196+
"env": "sandbox"
197+
}
198+
]
199+
]
200+
}
201+
}
202+
```
203+
204+
Next, rebuild your app as described in the ["Adding custom native code"](https://docs.expo.io/workflow/customizing/) guide.
205+
206+
---
207+
170208
## Methods
171209

172210
## Import

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@ dependencies {
9090
//noinspection GradleDynamicVersion
9191
implementation "com.facebook.react:react-native:+"
9292
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
93-
implementation "so.cello.android:cello-sdk:0.1.0"
93+
implementation "so.cello.android:cello-sdk:0.1.1"
9494
}
9595

app.plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/commonjs/expo-plugin');

example/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
23
const pak = require('../package.json');
34

45
module.exports = {

example/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AppRegistry } from 'react-native';
2-
import App from './src/App';
2+
33
import { name as appName } from './app.json';
4+
import App from './src/App';
45

56
AppRegistry.registerComponent(appName, () => App);

example/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- boost (1.76.0)
3-
- cello-react-native (0.1.2-rc1):
3+
- cello-react-native (0.1.2):
44
- CelloSDK (~> 0.1.0)
55
- RCT-Folly (= 2021.07.22.00)
66
- React-Core
@@ -664,7 +664,7 @@ EXTERNAL SOURCES:
664664

665665
SPEC CHECKSUMS:
666666
boost: 57d2868c099736d80fcd648bf211b4431e51a558
667-
cello-react-native: 537cf7c11fdac086b160f3ca9bf78abaa3a0dc87
667+
cello-react-native: 747e03efac449c038a89777786c05f8f1a852705
668668
CelloSDK: 626048ab737b81d8883b1e98d457743f7ce2b6e4
669669
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
670670
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54

example/metro.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
2-
const path = require('path');
32
const escape = require('escape-string-regexp');
43
const exclusionList = require('metro-config/src/defaults/exclusionList');
4+
const path = require('path');
5+
56
const pak = require('../package.json');
67

78
const root = path.resolve(__dirname, '..');

example/react-native.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path');
2+
23
const pak = require('../package.json');
34

45
module.exports = {

example/src/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Cello, { CelloEvents } from '@getcello/cello-react-native';
12
import React, { useEffect } from 'react';
23
import type { PropsWithChildren } from 'react';
34
import {
@@ -9,15 +10,13 @@ import {
910
useColorScheme,
1011
View,
1112
} from 'react-native';
12-
1313
import {
1414
Colors,
1515
DebugInstructions,
1616
Header,
1717
LearnMoreLinks,
1818
ReloadInstructions,
1919
} from 'react-native/Libraries/NewAppScreen';
20-
import Cello, { CelloEvents } from '@getcello/cello-react-native';
2120

2221
type SectionProps = PropsWithChildren<{
2322
title: string;

0 commit comments

Comments
 (0)