-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom image/icon #680
Comments
patch the library and use |
@Bilalwarind Seems like this was merged: https://github.com/react-native-menu/menu/pull/731/files |
@Gregoirevda @Gregoirevda its deployed in 1.0.0 — but how do you use it? |
You can pass the image name from an image you have put in xcassets |
@honcon are you able to elaborate a little more for us react native devs who never really have to touch the native code? in my case I'm using EAS so the ios dir isn't even part of the repo - it's generated at build time |
I think something like this https://github.com/EvanBacon/expo-apple-targets could be a solution |
Here's how I solved adding custom icons to Expo project using CNG/prebuild. It involves creating an asset and writing a custom Expo config plugin to copy it into XCode on clean prebuilds.
/* eslint @typescript-eslint/no-var-requires: 0 */
const path = require('path')
const { withXcodeProject, IOSConfig } = require('expo/config-plugins')
function withXcodeBundleResource(config, fileArray) {
return withXcodeProject(config, async (config) => {
for (const file of fileArray) {
config.modResults = await setFileAsync({
file,
projectName: config.modRequest.projectName,
project: config.modResults,
})
}
return config
})
}
async function setFileAsync({ file, projectName, project }) {
const thisFilePath = path.join('../', file)
if (!project.hasFile(thisFilePath)) {
console.log(`Adding ${thisFilePath} to Xcode project`)
IOSConfig.XcodeUtils.addResourceFileToGroup({
filepath: thisFilePath,
groupName: projectName,
project,
isBuildFile: true,
})
}
return project
}
module.exports = withXcodeBundleResource
[...]
"plugins": [
[
"./plugins/withXcodeBundleResource.js",
["./MyImages.xcassets"]
],
[...]
|
How we can use custom image or icon from assets folder other than SF symbols?
The text was updated successfully, but these errors were encountered: