Skip to content

Commit adcdcf2

Browse files
authored
Merge pull request #592 from Iterable/2.0.0-alpha/MOB-10034-add-commerce-section
[MOB-10034] Example App: commerce
2 parents e4464a1 + a63b342 commit adcdcf2

File tree

17 files changed

+312
-112
lines changed

17 files changed

+312
-112
lines changed

example/Gemfile.lock

Lines changed: 0 additions & 105 deletions
This file was deleted.

example/README.md

Lines changed: 129 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,94 @@ To fix, run the following in the _example app directory_:
108108
bundle install
109109
```
110110

111+
## Error: `Signing for 'ReactNativeSdkExample' requires a development team. Select a development team in the Signing & Capabilities Editor`
112+
113+
- Open XCode
114+
- Go to 'Signing & Capabilities'
115+
- Choose a team
116+
- Stop your application, then rerun
117+
118+
If you are still experiencing issues, try deleting `ios/.xcode.env.local`
119+
120+
## Error: `/Library/Ruby/Gems/XYZ does not have write permissions` or `/usr/local/lib does not have write permissions`
121+
122+
This is a common issue with using ruby on Macs. You can modify the read/write
123+
access of the computers Ruby folder, but a better (and safer) way is to use
124+
`rbenv` and [`homebrew`](https://brew.sh/) by doing the following:
125+
126+
1. **Install/update homebrew**
127+
If you have homebrew, update it by running: `brew update && brew upgrade`.
128+
If you do not have homebrew, follow the [installation
129+
instructions](https://brew.sh/).
130+
131+
2. **Install `rbenv` and `ruby-build`**
132+
```bash
133+
# Uninstall ruby (you can try skipping this step if you have concerns)
134+
brew uninstall --ignore-dependencies ruby
135+
# Install `rbenv` and `ruby-build`
136+
brew install rbenv ruby-build
137+
# Install the correct ruby version, eg: 3.3.6
138+
rbenv install 3.3.6
139+
# Default to using this ruby version
140+
rbenv global 3.3.6
141+
```
142+
143+
3. **Tell your computer to use `rbenv`**
144+
Add the following to the top of your `.zshrc` or `.bash_profile`:
145+
```zsh
146+
eval "$(rbenv init -)"
147+
```
148+
149+
4. **Reload `.zshrc` or `.bash_profile`**
150+
Run the following in your terminal:
151+
```bash
152+
# If using zsh
153+
source ~/.zshrc
154+
# If using bash
155+
source ~/.bash_profile
156+
```
157+
158+
5. **Check that the correct ruby version is loading**
159+
Run the following in your terminal:
160+
```bash
161+
ruby --version
162+
```
163+
If working, it should say `3.3.6`
164+
165+
## Error: `bad interpreter: No such file or directory` on `pod install`
166+
Reinstall cocoapods by doing the following:
167+
```bash
168+
# Uninstall current version of cocoapods
169+
brew uninstall cocoapods
170+
# Install a fresh version of cocoapods
171+
brew install cocoapods
172+
# Recreate link to cocoapods
173+
brew unlink cocoapods && brew link cocoapods
174+
```
175+
176+
Run `pod install` again, and it should work.
177+
178+
## Error: `com.android.builder.errors.EvalIssueException: SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your projects local properties file`
179+
180+
This means that the project cannot find the location of your Android SDK.
181+
182+
There are two ways to fix this:
183+
184+
### 1. Add `ANDROID_HOME` to your *.zshrc* or *.bashrc* file.
185+
1. Open your *.zshrc* or *.bashrc*
186+
2. Add the following to the file:
187+
```bash
188+
ANDROID_HOME=/path/to/Android/SDK # EG: ANDROID_HOME=/Users/My.Name/Library/Android/sdk
189+
```
190+
191+
### 2. Add a *local.properties* file to *example/android*.
192+
1. Go to *example/android*
193+
2. Create a file called *local.properties*
194+
3. In *local.properties*, add:
195+
```bash
196+
sdk.dir=/path/to/Android/SDK # EG: sdk.dir=/Users/My.Name/Library/Android/sdk
197+
```
198+
111199
## Other
112200
If things are not working and you are stumped as to why, try running the
113201
following in the _example app directory_:
@@ -120,4 +208,44 @@ This will give you information about what react native needs in order to run,
120208
and whether it is accessible to the app.
121209

122210
Take a look at the OS you are trying to run. Make sure that everything has been
123-
installed and that the necessary items have been added to your `PATH`.
211+
installed and that the necessary items have been added to your `PATH`. Below
212+
are example items that are commonly added to the *.zshrc* or *.bashrc*:
213+
214+
```zsh
215+
# Load rbenv if using (suggested)
216+
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
217+
218+
# Load nvm if using (suggested)
219+
export NVM_DIR="$HOME/.nvm"
220+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
221+
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
222+
223+
# General paths
224+
export PATH=$HOME/bin:/usr/local/bin:$PATH
225+
export PATH=$PATH:$(pwd)/bin
226+
227+
# Homebrew setup
228+
if [ -d "/opt/homebrew/bin" ]; then
229+
export PATH="/opt/homebrew/bin:$PATH"
230+
fi
231+
232+
# Android paths and variables
233+
export ANDROID_HOME=$HOME/Library/Android/sdk
234+
export ANDROID_SDK_ROOT=$ANDROID_HOME
235+
export PATH=$PATH:$ANDROID_HOME
236+
export PATH=$PATH:$ANDROID_HOME/emulator
237+
export PATH=$PATH:$ANDROID_HOME/platform-tools
238+
export PATH=$PATH:/opt/homebrew/bin/gradle
239+
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
240+
241+
# Java variables
242+
export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home
243+
244+
# Node variables and settings
245+
export NODE_BINARY=node
246+
export NODE_OPTIONS=--openssl-legacy-provider
247+
```
248+
249+
You should also look through the [React Native environment setup
250+
docs](https://reactnative.dev/docs/set-up-your-environment) and make sure that
251+
you did not miss anything.

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
mavenCentral()
1313
}
1414
dependencies {
15-
classpath("com.android.tools.build:gradle")
15+
classpath('com.android.tools.build:gradle:8.7.2')
1616
classpath("com.facebook.react:react-native-gradle-plugin")
1717
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
1818
}

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

example/ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1900,4 +1900,4 @@ SPEC CHECKSUMS:
19001900

19011901
PODFILE CHECKSUM: aab4a30773612c4ffb73be13f5b169b8b156f374
19021902

1903-
COCOAPODS: 1.15.2
1903+
COCOAPODS: 1.16.2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Route } from '../../constants';
22

33
export const routeIcon = {
4+
[Route.Commerce]: 'cash-outline',
45
[Route.Inbox]: 'mail-outline',
56
[Route.User]: 'person-outline',
67
};

example/src/components/App/Main.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import type { MainScreenParamList } from '../../types';
88
import { routeIcon } from './App.constants';
99
import { getIcon } from './App.utils';
1010
import { User } from '../User';
11-
import Inbox from '../Inbox';
11+
import { Inbox } from '../Inbox';
1212
import { useIterableApp } from '../../hooks';
13+
import { Commerce } from '../Commerce';
1314

1415
const Tab = createBottomTabNavigator<MainScreenParamList>();
1516

@@ -65,6 +66,13 @@ export const Main = () => {
6566
},
6667
})}
6768
/>
69+
<Tab.Screen
70+
name={Route.Commerce}
71+
component={Commerce}
72+
listeners={() => ({
73+
tabPress: () => setIsInboxTab(false),
74+
})}
75+
/>
6876
<Tab.Screen
6977
name={Route.User}
7078
component={User}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
export type CommerceItem = {
2+
id: string;
3+
name: string;
4+
icon: any;
5+
subtitle: string;
6+
price: number;
7+
};
8+
9+
export const items: CommerceItem[] = [
10+
{
11+
id: 'black',
12+
name: 'Black Coffee',
13+
icon: require('./img/black-coffee.png'),
14+
subtitle: 'Maximize health benefits',
15+
price: 2.53,
16+
},
17+
{
18+
id: 'cappuccino',
19+
name: 'Cappuccino',
20+
icon: require('./img/cappuccino.png'),
21+
subtitle: 'Tasty and creamy',
22+
price: 3.56,
23+
},
24+
{
25+
id: 'mocha',
26+
name: 'Mocha',
27+
icon: require('./img/mocha.png'),
28+
subtitle: 'Indulge yourself',
29+
price: 4.98,
30+
},
31+
];

0 commit comments

Comments
 (0)