mirror of
https://github.com/expo/config-plugins.git
synced 2026-11-13 20:28:07 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20a4ecf8a8 | ||
|
|
9e8a90d523 |
No files matched your search
@@ -6,6 +6,43 @@
|
||||
- All packages here are community maintained. Feel free to improve docs, packages, tests, etc.
|
||||
- We maintain a 1-1 mapping of **native packages** ⇔ `@config-plugins/*`. This means there should be no general utility packages here -- those are better suited for a different repo / NPM namespace.
|
||||
|
||||
## Awesome
|
||||
|
||||
Here is a list of known packages that have a built-in Config Plugin.
|
||||
|
||||
> Not all packages need a config plugin, packages that don't appear here might still work with managed EAS.
|
||||
|
||||
- [React Native Firebase](https://rnfirebase.io/) (`@react-native-firebase/perf`, `@react-native-firebase/app`)
|
||||
- [react-native-nfc-manager](https://github.com/revtel/react-native-nfc-manager)
|
||||
- [react-native-health](https://github.com/agencyenterprise/react-native-health)
|
||||
- [@react-native-mapbox-gl/maps](https://github.com/rnmapbox/maps)
|
||||
- [@logrocket/react-native](https://www.npmjs.com/package/@logrocket/react-native)
|
||||
- [sentry-expo](https://www.npmjs.com/package/sentry-expo)
|
||||
- [@leanplum/react-native-sdk](https://github.com/Leanplum/Leanplum-ReactNative-SDK#readme)
|
||||
- [react-native-fbsdk-next](https://www.npmjs.com/package/react-native-fbsdk-next)
|
||||
- [@stripe/stripe-react-native](https://www.npmjs.com/package/@stripe/stripe-react-native)
|
||||
- [@react-native-voice/voice](https://www.npmjs.com/package/@react-native-voice/voice)
|
||||
- [react-native-imglysdk](https://www.npmjs.com/package/react-native-imglysdk)
|
||||
- [@viro-community/react-viro](https://github.com/virocommunity/viro)
|
||||
- [react-native-msal](https://www.npmjs.com/package/react-native-msal)
|
||||
- [react-native-spotlight-search](https://www.npmjs.com/package/react-native-spotlight-search)
|
||||
- [newrelic-react-native-agent](https://www.npmjs.com/package/newrelic-react-native-agent)
|
||||
- [react-native-videoeditorsdk](https://www.npmjs.com/package/react-native-videoeditorsdk)
|
||||
|
||||
### Complementary
|
||||
|
||||
More out-of-tree plugins which can be used to configure more packages.
|
||||
|
||||
- [onesignal-expo-plugin](https://github.com/OneSignal/onesignal-expo-plugin) (for use with `react-native-onesignal`)
|
||||
- [@lyrahealth-inc/react-native-orientation-plugin](@lyrahealth-inc/react-native-orientation-plugin) (for use with `react-native-orientation-plugin`)
|
||||
- [airship-expo-plugin](https://www.npmjs.com/package/airship-expo-plugin) (for use with `urbanairship-react-native`)
|
||||
- [config-plugin-react-native-intercom](https://www.npmjs.com/package/config-plugin-react-native-intercom) (for use with `intercom-react-native`)
|
||||
- [@allboatsrise/expo-marketingcloudsdk](https://www.npmjs.com/package/@allboatsrise/expo-marketingcloudsdk) (for use with `react-native-marketingcloudsdk`)
|
||||
- [@ouvio/react-native-background-location-plugin](https://www.npmjs.com/package/@ouvio/react-native-background-location-plugin) (for use with `react-native-background-location-plugin`)
|
||||
- [with-notifee](https://www.npmjs.com/package/with-notifee) (for use with [notifee](https://notifee.app/))
|
||||
- [expo-community-flipper](https://www.npmjs.com/package/expo-community-flipper) (for use with Flipper)
|
||||
|
||||
|
||||
## Contributing!
|
||||
|
||||
See the [contributing guide](/CONTRIBUTING.md).
|
||||
@@ -1,3 +1,10 @@
|
||||
### @config-plugins/ios-stickers [2.0.1](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-05-30)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **ios-stickers:** fix app icon generation ([#82](https://github.com/expo/config-plugins/issues/82)) ([190c489](https://github.com/expo/config-plugins/commit/190c489b764f285dbbecfa42fd7ee953fc849dcb))
|
||||
|
||||
## @config-plugins/ios-stickers [2.0.0](https://github.com/expo/config-plugins/compare/@config-plugins/[email protected]...@config-plugins/[email protected]) (2022-05-12)
|
||||
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
export declare type ContentsJsonImageIdiom = "iphone" | "ipad" | "ios-marketing" | "universal";
|
||||
export declare type ContentsJsonImageAppearance = {
|
||||
appearance: "luminosity";
|
||||
value: "dark";
|
||||
};
|
||||
export declare type ContentsJsonImageScale = "1x" | "2x" | "3x";
|
||||
export interface ContentsJsonImage {
|
||||
appearances?: ContentsJsonImageAppearance[];
|
||||
idiom: ContentsJsonImageIdiom;
|
||||
size?: string;
|
||||
scale: ContentsJsonImageScale;
|
||||
filename?: string;
|
||||
platform?: string;
|
||||
}
|
||||
export declare function generateImessageIconsAsync(projectRoot: string, icon: string, iconsPath: string): Promise<ContentsJsonImage[]>;
|
||||
@@ -0,0 +1,131 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateImessageIconsAsync = void 0;
|
||||
const image_utils_1 = require("@expo/image-utils");
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = require("path");
|
||||
const IMAGE_CACHE_NAME = "ios-stickers-icons";
|
||||
// Hard-coding seemed like the clearest and safest way to implement the sizes.
|
||||
const ICON_CONTENTS = [
|
||||
{
|
||||
idiom: "iphone",
|
||||
sizes: [
|
||||
{
|
||||
size: 29,
|
||||
scales: [2, 3],
|
||||
},
|
||||
{
|
||||
size: [60, 45],
|
||||
scales: [2, 3],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
idiom: "ipad",
|
||||
sizes: [
|
||||
{
|
||||
size: 29,
|
||||
scales: [2],
|
||||
},
|
||||
{
|
||||
size: [67, 50],
|
||||
scales: [2],
|
||||
},
|
||||
{
|
||||
size: [74, 55],
|
||||
scales: [2],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
idiom: "universal",
|
||||
sizes: [
|
||||
{
|
||||
platform: "ios",
|
||||
size: [27, 20],
|
||||
scales: [2, 3],
|
||||
},
|
||||
{
|
||||
platform: "ios",
|
||||
size: [32, 24],
|
||||
scales: [2, 3],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
idiom: "ios-marketing",
|
||||
sizes: [
|
||||
{
|
||||
size: 1024,
|
||||
scales: [1],
|
||||
},
|
||||
{
|
||||
platform: "ios",
|
||||
size: [1024, 768],
|
||||
scales: [1],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
async function generateImessageIconsAsync(projectRoot, icon, iconsPath) {
|
||||
// Ensure the Images.xcassets/AppIcon.appiconset path exists
|
||||
fs_1.default.mkdirSync(iconsPath, { recursive: true });
|
||||
// Store the image JSON data for assigning via the Contents.json
|
||||
const imagesJson = [];
|
||||
// keep track of icons that have been generated so we can reuse them in the Contents.json
|
||||
const generatedIcons = {};
|
||||
for (const platform of ICON_CONTENTS) {
|
||||
// const isMarketing = platform.idiom === 'ios-marketing';
|
||||
for (const { size, scales, ...rest } of platform.sizes) {
|
||||
for (const scale of scales) {
|
||||
// The marketing icon is special because it makes no sense.
|
||||
const filename = getAppleIconName(size, scale, platform.idiom);
|
||||
// Only create an image that hasn't already been generated.
|
||||
const [width, height] = Array.isArray(size) ? size : [size, size];
|
||||
if (!(filename in generatedIcons)) {
|
||||
const iconWSizePx = width * scale;
|
||||
const iconHSizePx = height * scale;
|
||||
// Using this method will cache the images in `.expo` based on the properties used to generate them.
|
||||
// this method also supports remote URLs and using the global sharp instance.
|
||||
const { source } = await image_utils_1.generateImageAsync({ projectRoot, cacheType: IMAGE_CACHE_NAME }, {
|
||||
src: icon,
|
||||
name: filename,
|
||||
width: iconWSizePx,
|
||||
height: iconHSizePx,
|
||||
removeTransparency: true,
|
||||
// The icon should be square, but if it's not then it will be cropped.
|
||||
resizeMode: "cover",
|
||||
// Force the background color to solid white to prevent any transparency.
|
||||
// TODO: Maybe use a more adaptive option based on the icon color?
|
||||
backgroundColor: "#ffffff",
|
||||
});
|
||||
// Write image buffer to the file system.
|
||||
const assetPath = path_1.join(iconsPath, filename);
|
||||
await fs_1.default.promises.writeFile(assetPath, source);
|
||||
// Save a reference to the generated image so we don't create a duplicate.
|
||||
generatedIcons[filename] = true;
|
||||
}
|
||||
const imgJson = {
|
||||
filename,
|
||||
idiom: platform.idiom,
|
||||
scale: `${scale}x`,
|
||||
size: `${width}x${height}`,
|
||||
};
|
||||
// This order closely matches Xcode formatting.
|
||||
imagesJson.push(imgJson);
|
||||
if (rest.platform) {
|
||||
imgJson.platform = rest.platform;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return imagesJson;
|
||||
}
|
||||
exports.generateImessageIconsAsync = generateImessageIconsAsync;
|
||||
function getAppleIconName(size, scale, idiom) {
|
||||
const [width, height] = Array.isArray(size) ? size : [size, size];
|
||||
return `App-Icon-${idiom}-${width}x${height}@${scale}x.png`;
|
||||
}
|
||||
Reference in new issue
Block a user