File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
packages/cli-platform-android/src/config Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,29 @@ export default function getPackageClassName(folder: string) {
3232 let files = getMainActivityFiles ( folder ) ;
3333 let packages = getClassNameMatches ( files , folder ) ;
3434
35- if ( ! packages . length ) {
36- files = getMainActivityFiles ( folder , false ) ;
37- packages = getClassNameMatches ( files , folder ) ;
35+ if ( packages && packages . length > 0 && Array . isArray ( packages [ 0 ] ) ) {
36+ return packages [ 0 ] [ 1 ] ;
3837 }
3938
39+ /*
40+ When module contains `expo-module.config.json` we return null
41+ because expo modules follow other practices and don't implement
42+ ReactPackage/TurboReactPackage directly, so it doesn't make sense
43+ to scan and read hundreds of files to get package class name.
44+
45+ Exception is `expo` package itself which contains `expo-module.config.json`
46+ and implements `ReactPackage/TurboReactPackage`.
47+
48+ Following logic is done due to performance optimization.
49+ */
50+
51+ if ( fs . existsSync ( path . join ( folder , '..' , 'expo-module.config.json' ) ) ) {
52+ return null ;
53+ }
54+
55+ files = getMainActivityFiles ( folder , false ) ;
56+ packages = getClassNameMatches ( files , folder ) ;
57+
4058 // @ts -ignore
4159 return packages . length ? packages [ 0 ] [ 1 ] : null ;
4260}
You can’t perform that action at this time.
0 commit comments