Skip to content

Commit

Permalink
fix android example
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Dec 14, 2024
1 parent 1f95326 commit ab9edd3
Show file tree
Hide file tree
Showing 24 changed files with 2,208 additions and 97 deletions.
Binary file modified bun.lockb
Binary file not shown.
16 changes: 16 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,19 @@ That's it! Now you can commit changes and create a PR.
#### Expo

To update `expo` example you should follow this [guide](https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough).
After re-building the native project you should ensure that top of `android/settings.gradle` file looks like this:

```gradle
pluginManagement {
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())
}
```
Otherwise, you will get an error like this:
```bash
FAILURE: Build failed with an exception.
What went wrong:
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
```
20 changes: 9 additions & 11 deletions examples/bare/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ module.exports = makeMetroConfig({
resolver: {
// We need to make sure that only one version is loaded for peerDependencies
// So we block them at the root, and alias them to the versions in example's node_modules
resolver: {
blacklistRE: exclusionList(
modules.map(
(m) =>
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
),
blacklistRE: exclusionList(
modules.map(
(m) =>
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`),
),
),

extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
}, {}),
},
extraNodeModules: modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
}, {}),
},
watchFolders: [root],
});
30 changes: 27 additions & 3 deletions examples/expo/.gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
npm-debug.*
web-build/
expo-env.d.ts

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo

app-example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions examples/expo/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">ExpoExample</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
</resources>
2 changes: 1 addition & 1 deletion examples/expo/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pluginManagement {
includeBuild(new File("../node_modules/react-native/node_modules/@react-native/gradle-plugin/package.json").getParentFile().toString())
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())
}
plugins { id("com.facebook.react.settings") }

Expand Down
21 changes: 16 additions & 5 deletions examples/expo/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
[
"react-native-video",
"react-native-video",
{
"reactNativeTestApp": false,
"enableNotificationControls": true,
Expand All @@ -33,13 +33,24 @@
}
]
],
"name": "ExpoExample",
"slug": "ExpoExample",
"android": {
"package": "com.anonymous.ExpoExample"
"splash": {
"image": "./assets/images/icon-1920x720.png"
},
"package": "com.anonymous.ExpoExample",
"permissions": [
"android.permission.FOREGROUND_SERVICE",
"android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"
]
},
"ios": {
"splash": {
"image": "./assets/images/icon-1920x720.png"
},
"bundleIdentifier": "com.anonymous.ExpoExample"
}
},
"newArchEnabled": false,
"name": "ExpoExample",
"slug": "ExpoExample"
}
}
16 changes: 1 addition & 15 deletions examples/expo/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
const path = require('path');
const pak = require('../../package.json');

module.exports = function (api) {
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
[
'module-resolver',
{
alias: {
[pak.name]: path.join(__dirname, '../..', pak.source),
extensions: ['.tsx', '.ts', '.js', '.json'],
},
},
],
],
};
};
Loading

0 comments on commit ab9edd3

Please sign in to comment.