Skip to content

Commit ab9edd3

Browse files
committed
fix android example
1 parent 1f95326 commit ab9edd3

File tree

24 files changed

+2208
-97
lines changed

24 files changed

+2208
-97
lines changed

bun.lockb

-73.3 KB
Binary file not shown.

examples/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,19 @@ That's it! Now you can commit changes and create a PR.
192192
#### Expo
193193

194194
To update `expo` example you should follow this [guide](https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough).
195+
After re-building the native project you should ensure that top of `android/settings.gradle` file looks like this:
196+
197+
```gradle
198+
pluginManagement {
199+
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().toString())
200+
}
201+
```
202+
203+
Otherwise, you will get an error like this:
204+
205+
```bash
206+
FAILURE: Build failed with an exception.
207+
208+
What went wrong:
209+
Included build (...)/react-native-video/examples/expo/node_modules/react-native/node_modules/@react-native/gradle-plugin has build path :gradle-plugin which is the same as included build (...)/react-native-video/node_modules/@react-native/gradle-plugin
210+
```

examples/bare/metro.config.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,17 @@ module.exports = makeMetroConfig({
2020
resolver: {
2121
// We need to make sure that only one version is loaded for peerDependencies
2222
// So we block them at the root, and alias them to the versions in example's node_modules
23-
resolver: {
24-
blacklistRE: exclusionList(
25-
modules.map(
26-
(m) =>
27-
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
28-
),
23+
blacklistRE: exclusionList(
24+
modules.map(
25+
(m) =>
26+
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
2927
),
28+
),
3029

31-
extraNodeModules: modules.reduce((acc, name) => {
32-
acc[name] = path.join(__dirname, 'node_modules', name);
33-
return acc;
34-
}, {}),
35-
},
30+
extraNodeModules: modules.reduce((acc, name) => {
31+
acc[name] = path.join(__dirname, 'node_modules', name);
32+
return acc;
33+
}, {}),
3634
},
3735
watchFolders: [root],
3836
});

examples/expo/.gitignore

+27-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,38 @@
1+
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2+
3+
# dependencies
14
node_modules/
5+
6+
# Expo
27
.expo/
38
dist/
4-
npm-debug.*
9+
web-build/
10+
expo-env.d.ts
11+
12+
# Native
13+
*.orig.*
514
*.jks
615
*.p8
716
*.p12
817
*.key
918
*.mobileprovision
10-
*.orig.*
11-
web-build/
19+
20+
# Metro
21+
.metro-health-check*
22+
23+
# debug
24+
npm-debug.*
25+
yarn-debug.*
26+
yarn-error.*
1227

1328
# macOS
1429
.DS_Store
30+
*.pem
31+
32+
# local env files
33+
.env*.local
34+
35+
# typescript
36+
*.tsbuildinfo
37+
38+
app-example
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<resources>
22
<string name="app_name">ExpoExample</string>
3+
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
4+
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
35
</resources>

examples/expo/android/settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pluginManagement {
2-
includeBuild(new File("../node_modules/react-native/node_modules/@react-native/gradle-plugin/package.json").getParentFile().toString())
2+
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().toString())
33
}
44
plugins { id("com.facebook.react.settings") }
55

examples/expo/app.json

+16-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
[
20-
"react-native-video",
20+
"react-native-video",
2121
{
2222
"reactNativeTestApp": false,
2323
"enableNotificationControls": true,
@@ -33,13 +33,24 @@
3333
}
3434
]
3535
],
36-
"name": "ExpoExample",
37-
"slug": "ExpoExample",
3836
"android": {
39-
"package": "com.anonymous.ExpoExample"
37+
"splash": {
38+
"image": "./assets/images/icon-1920x720.png"
39+
},
40+
"package": "com.anonymous.ExpoExample",
41+
"permissions": [
42+
"android.permission.FOREGROUND_SERVICE",
43+
"android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"
44+
]
4045
},
4146
"ios": {
47+
"splash": {
48+
"image": "./assets/images/icon-1920x720.png"
49+
},
4250
"bundleIdentifier": "com.anonymous.ExpoExample"
43-
}
51+
},
52+
"newArchEnabled": false,
53+
"name": "ExpoExample",
54+
"slug": "ExpoExample"
4455
}
4556
}

examples/expo/babel.config.js

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
const path = require('path');
2-
const pak = require('../../package.json');
3-
4-
module.exports = function (api) {
1+
module.exports = function(api) {
52
api.cache(true);
63
return {
74
presets: ['babel-preset-expo'],
8-
plugins: [
9-
[
10-
'module-resolver',
11-
{
12-
alias: {
13-
[pak.name]: path.join(__dirname, '../..', pak.source),
14-
extensions: ['.tsx', '.ts', '.js', '.json'],
15-
},
16-
},
17-
],
18-
],
195
};
206
};

0 commit comments

Comments
 (0)