Skip to content

Commit af520e5

Browse files
Ron RadtkeRon Radtke
Ron Radtke
authored and
Ron Radtke
committed
Update:
* support for new arch Merge remote-tracking branch 'origin/develop'
2 parents 8d9d980 + 6ce36b8 commit af520e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3597
-2556
lines changed

.eslintrc.js

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
module.exports = {
22
root: true,
3+
extends: '@react-native-community',
34
rules: {
45
'prettier/prettier': 0,
56
"eqeqeq": 2,
67
"comma-dangle": 0,
7-
"curly": 0,
8+
curly: 0,
89
"no-console": 1,
910
"no-debugger": 1,
1011
"no-extra-semi": 2,
@@ -24,7 +25,32 @@ module.exports = {
2425
"requireReturnDescription": false
2526
}
2627
],
27-
"radix": 0
28+
"radix": 0,
29+
30+
"react/display-name": 2,
31+
"react/forbid-prop-types": 1,
32+
"react/jsx-boolean-value": 1,
33+
"react/jsx-closing-bracket-location": 1,
34+
"react/jsx-curly-spacing": 1,
35+
"react/jsx-indent-props": 0,
36+
"react/jsx-max-props-per-line": 0,
37+
"react/jsx-no-duplicate-props": 1,
38+
"react/jsx-no-literals": 0,
39+
"react/jsx-no-undef": 1,
40+
"react/jsx-sort-props": 0,
41+
"react/jsx-uses-react": 1,
42+
"react/jsx-uses-vars": 1,
43+
"react/jsx-wrap-multilines": 1,
44+
"react/no-danger": 1,
45+
"react/no-did-mount-set-state": 1,
46+
"react/no-did-update-set-state": 1,
47+
"react/no-direct-mutation-state": 1,
48+
"react/no-multi-comp": 1,
49+
"react/no-set-state": 0,
50+
"react/no-unknown-property": 1,
51+
"react/prop-types": 0,
52+
"react/react-in-jsx-scope": 0,
53+
"react/self-closing-comp": 1,
54+
"react/sort-comp": 1,
2855
},
29-
"parser": "babel-eslint"
3056
};

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ codecov.yml
2727
# Example
2828
img/
2929
example/
30+
examples/
3031
app.json
3132

3233
# Android

Migration.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Migration to the New Architecture
2+
3+
This file is a tracker for what has been done to work on the migration of this library and to keep also track of the various todo:
4+
5+
## TODO
6+
7+
- [] Write JS spec in Flow for the New Architecture
8+
- [] Implent the new Native Code on iOS
9+
- [] Implent the new Native Code on Android
10+
- [] Test on OldArch app (iOS)
11+
- [] Test on OldArch app (Android)
12+
- [] Test on NewArch app (iOS)
13+
- [] Test on NewArch app (Android)
14+
- [] Open PR
15+
16+
## Done
17+
18+
### Setup
19+
1. Forked and cloned the repo
20+
1. Checked the list of APIs to migrate.
21+
1. Created an `OldArch` app (0.70) configured for the Old Architecture.
22+
1. Run the app to make sure that it works properly.
23+
1. Created a `NewArch` app (0.70) configured for the New Architecture.
24+
1. Switched the flags for iOS and Android to have the new arch enabled by default
25+
1. Run the app to make sure that it works properly.
26+
1. Moved the apps in the `examples` folder
27+
28+
### Installing blob-utils
29+
1. Move to `OldArch`
30+
1. Run `yarn add ../..` to install the blob utils.
31+
1. `cd ios`
32+
1. `bundle install && bundle exec pod install`
33+
1. `cd ..`
34+
1. `npx react-native run-ios`
35+
1. Copy the app JS code from `examples/ReactNativeBlobUtil/App.js` to `examples/OldArch/App.js`
36+
1. Fixed various JS issues
37+
1. The app depends on the `Picker`. *Note:* It does not support the New Arch, we need to figure out another way to choose.
38+
1. run `yarn add @react-native-picker/picker`
39+
1. run `bundle exec pod install` from the iOS folder
40+
1. re-run the app
41+
1. Repeat the above steps for `NewArch`

android.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
// Use of this source code is governed by a MIT-style license that can be
33
// found in the LICENSE file.
44

5-
import { NativeModules, Platform } from 'react-native';
6-
7-
const ReactNativeBlobUtil = NativeModules.ReactNativeBlobUtil;
5+
import { Platform } from 'react-native';
6+
import ReactNativeBlobUtil from './codegenSpecs/NativeBlobUtils';
87

98
/**
109
* Send an intent to open the file.

android/build.gradle

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@ buildscript {
3030
mavenCentral()
3131
}
3232
dependencies {
33-
classpath 'com.android.tools.build:gradle:4.1.3'
33+
classpath 'com.android.tools.build:gradle:7.2.1'
3434
}
3535
}
3636
}
3737

38+
def isNewArchitectureEnabled() {
39+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
40+
}
41+
42+
if (isNewArchitectureEnabled()) {
43+
apply plugin: 'com.facebook.react'
44+
}
45+
3846
android {
3947
compileSdkVersion safeExtGet('compileSdkVersion', 30)
4048
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')
@@ -43,6 +51,7 @@ android {
4351
targetSdkVersion safeExtGet('targetSdkVersion', 30)
4452
versionCode 1
4553
versionName "1.0"
54+
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
4655
}
4756
buildTypes {
4857
release {
@@ -55,6 +64,15 @@ android {
5564
}
5665
productFlavors {
5766
}
67+
sourceSets {
68+
main {
69+
if (isNewArchitectureEnabled()) {
70+
java.srcDirs += ['src/newarch']
71+
} else {
72+
java.srcDirs += ['src/oldarch']
73+
}
74+
}
75+
}
5876
}
5977

6078
dependencies {

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip

android/gradlew

100644100755
File mode changed.

0 commit comments

Comments
 (0)