Skip to content
This repository was archived by the owner on May 6, 2022. It is now read-only.

Commit 3c76849

Browse files
committed
fix: upgrade RN to 0.64
1 parent 0115c5e commit 3c76849

31 files changed

+8486
-6735
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ end_of_line = lf
1313
charset = utf-8
1414
trim_trailing_whitespace = true
1515
insert_final_newline = true
16+
17+
# Windows files
18+
[*.bat]
19+
end_of_line = crlf

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
*.pbxproj -text
21
# specific for windows script files
3-
*.bat text eol=crlf
2+
*.bat text eol=crlf

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install commitlint --edit $1

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npm test

README.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ Then follow the instructions for each platform to link react-native-spokestack t
3131
<details>
3232
<summary>iOS details</summary>
3333

34-
First, set your iOS deployment target in XCode to 13.0.
34+
### Set deployment target
35+
36+
First, open XCode and go to Project -> Info to set the iOS Deployment target to 13.0 or higher.
37+
38+
Also, set deployment to 13.0 under Target -> General -> Deployment Info.
39+
40+
### Remove invalid library search path
41+
42+
When Flipper was introduced to React Native, some library search paths were set for Swift. There has been a longstanding issue with the default search paths in React Native projects because a search path was added for swift 5.0 which prevented any other React Native libraries from using APIs only available in Swift 5.2 or later. Spokestack-iOS, a dependency of react-native-spokestack makes use of these APIs and XCode will fail to build.
43+
44+
Fortunately, the fix is fairly simple. Go to your target -> Build Settings and search for "Library Search Paths".
45+
46+
Remove `"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\""` from the list.
3547

3648
### Edit Podfile
3749

@@ -51,17 +63,40 @@ target 'SpokestackExample' do
5163
#...
5264
```
5365

54-
For now, `use_frameworks!` does not work with Flipper, so we also need to disable Flipper. Remove any Flipper-related lines in your Podfile. In React Native 0.63.2, they look like this:
66+
For now, `use_frameworks!` does not work with Flipper, so we also need to disable Flipper. Remove any Flipper-related lines in your Podfile. In React Native 0.63.2+, they look like this:
5567

5668
```ruby
5769
# X Remove or comment out these lines X
58-
use_flipper!
59-
post_install do |installer|
60-
flipper_post_install(installer)
61-
end
70+
# use_flipper!
71+
# post_install do |installer|
72+
# flipper_post_install(installer)
73+
# end
6274
# XX
6375
```
6476

77+
#### Bug in React Native 0.64.0 (should be fixed in 0.64.1)
78+
79+
React Native 0.64.0 broke any projects using `use_frameworks!` in their Podfiles.
80+
81+
For more info on this bug, see https://github.com/facebook/react-native/issues/31149.
82+
83+
To workaround this issue, add the following to your Podfile:
84+
85+
```ruby
86+
# Moves 'Generate Specs' build_phase to be first for FBReactNativeSpec
87+
post_install do |installer|
88+
installer.pods_project.targets.each do |target|
89+
if (target.name&.eql?('FBReactNativeSpec'))
90+
target.build_phases.each do |build_phase|
91+
if (build_phase.respond_to?(:name) && build_phase.name.eql?('[CP-User] Generate Specs'))
92+
target.build_phases.move(build_phase, 0)
93+
end
94+
end
95+
end
96+
end
97+
end
98+
```
99+
65100
Remove your existing Podfile.lock and Pods folder to ensure no conflicts, then install the pods:
66101

67102
```sh
@@ -134,12 +169,13 @@ See our [ASR documentation](https://www.spokestack.io/docs/concepts/asr) for mor
134169
// ...
135170
ext {
136171
// Minimum SDK is 21
172+
// React Native 0.64+ already has this set
137173
minSdkVersion = 21
138174
// ...
139175
dependencies {
140176
// Minimium gradle is 3.0.1+
141177
// The latest React Native already has this
142-
classpath("com.android.tools.build:gradle:3.5.3")
178+
classpath("com.android.tools.build:gradle:4.1.0")
143179
```
144180

145181
### Edit AndroidManifest.xml

android/build.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.1'
11+
classpath 'com.android.tools.build:gradle:4.1.0'
1212
// noinspection DifferentKotlinGradleVersion
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
@@ -126,13 +126,12 @@ dependencies {
126126
// noinspection GradleDynamicVersion
127127
implementation 'com.facebook.react:react-native:+'
128128
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_version"
129-
api 'io.spokestack:spokestack-android:11.0.2'
129+
api 'io.spokestack:spokestack-android:11.2.0'
130130

131131
// for TensorFlow Lite-powered wakeword detection and/or NLU
132132
implementation 'org.tensorflow:tensorflow-lite:2.3.0'
133133

134134
// for playback of TTS audio
135-
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
136-
implementation 'androidx.media:media:1.2.1'
137-
implementation 'com.google.android.exoplayer:exoplayer-core:2.11.7'
135+
implementation 'androidx.media:media:1.3.0'
136+
implementation 'com.google.android.exoplayer:exoplayer-core:2.13.3'
138137
}

example/android/app/build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
121121
def enableHermes = project.ext.react.get("enableHermes", false);
122122

123123
android {
124+
ndkVersion rootProject.ext.ndkVersion
125+
124126
compileSdkVersion rootProject.ext.compileSdkVersion
125127

126128
compileOptions {
@@ -169,11 +171,12 @@ android {
169171
variant.outputs.each { output ->
170172
// For each separate APK per architecture, set a unique version code as described here:
171173
// https://developer.android.com/studio/build/configure-apk-splits.html
174+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
172175
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
173176
def abi = output.getFilter(OutputFile.ABI)
174177
if (abi != null) { // null for the universal-debug, universal-release variants
175178
output.versionCodeOverride =
176-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
179+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
177180
}
178181

179182
}

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application
8+
android:usesCleartextTraffic="true"
9+
tools:targetApi="28"
10+
tools:ignore="GoogleAppIndexingWarning">
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12+
</application>
813
</manifest>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<category android:name="android.intent.category.LAUNCHER" />
2323
</intent-filter>
2424
</activity>
25-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2625
</application>
2726

2827
</manifest>

0 commit comments

Comments
 (0)