react-native-bootsplash 5.0.0-beta.3 → 5.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/addon/index.js +1 -1
- package/dist/commonjs/addon/index.js.map +1 -1
- package/dist/commonjs/generate.js +33 -11
- package/dist/commonjs/generate.js.map +1 -1
- package/dist/commonjs/index.js +6 -5
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/addon/index.js +1 -1
- package/dist/module/addon/index.js.map +1 -1
- package/dist/module/generate.js +31 -10
- package/dist/module/generate.js.map +1 -1
- package/dist/module/index.js +6 -5
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/addon/index.d.ts.map +1 -1
- package/dist/typescript/generate.d.ts +4 -0
- package/dist/typescript/generate.d.ts.map +1 -1
- package/dist/typescript/index.d.ts +1 -0
- package/dist/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/generate.ts +28 -22
- package/src/index.ts +4 -1
package/src/generate.ts
CHANGED
|
@@ -117,34 +117,40 @@ export const logWrite = (
|
|
|
117
117
|
);
|
|
118
118
|
|
|
119
119
|
export const writeJson = (file: string, json: object) => {
|
|
120
|
-
|
|
121
|
-
? detectIndent(fs.readFileSync(file, "utf-8")).amount || 2
|
|
122
|
-
: 2;
|
|
123
|
-
|
|
124
|
-
fs.writeFileSync(file, JSON.stringify(json, null, amount) + "\n", "utf-8");
|
|
120
|
+
fs.writeFileSync(file, JSON.stringify(json, null, 2) + "\n", "utf-8");
|
|
125
121
|
logWrite(file);
|
|
126
122
|
};
|
|
127
123
|
|
|
124
|
+
export const readXml = (file: string) => {
|
|
125
|
+
const xml = fs.readFileSync(file, "utf-8");
|
|
126
|
+
|
|
127
|
+
const minified = xmlFormat(xml, {
|
|
128
|
+
collapseContent: true,
|
|
129
|
+
forceSelfClosingEmptyTag: true,
|
|
130
|
+
indentation: "",
|
|
131
|
+
lineSeparator: "",
|
|
132
|
+
whiteSpaceAtEndOfSelfclosingTag: true,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const indentation = detectIndent(xml).indent || " ";
|
|
136
|
+
return { minified, indentation };
|
|
137
|
+
};
|
|
138
|
+
|
|
128
139
|
export const writeXml = (
|
|
129
140
|
file: string,
|
|
130
141
|
xml: string,
|
|
131
142
|
options?: XMLFormatterOptions,
|
|
132
143
|
) => {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
lineSeparator: "\n",
|
|
144
|
-
}) + "\n",
|
|
145
|
-
"utf-8",
|
|
146
|
-
);
|
|
147
|
-
|
|
144
|
+
const formatted = xmlFormat(xml, {
|
|
145
|
+
collapseContent: true,
|
|
146
|
+
forceSelfClosingEmptyTag: true,
|
|
147
|
+
indentation: " ",
|
|
148
|
+
lineSeparator: "\n",
|
|
149
|
+
whiteSpaceAtEndOfSelfclosingTag: true,
|
|
150
|
+
...options,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
fs.writeFileSync(file, formatted + "\n", "utf-8");
|
|
148
154
|
logWrite(file);
|
|
149
155
|
};
|
|
150
156
|
|
|
@@ -413,13 +419,13 @@ export const generate: CommandFunction<{
|
|
|
413
419
|
const colorsXmlEntry = `<color name="bootsplash_background">${background.hex}</color>`;
|
|
414
420
|
|
|
415
421
|
if (fs.existsSync(colorsXmlPath)) {
|
|
416
|
-
const colorsXml =
|
|
422
|
+
const { minified: colorsXml, indentation } = readXml(colorsXmlPath);
|
|
417
423
|
|
|
418
424
|
const nextXml = colorsXml.match(androidColorRegex)
|
|
419
425
|
? colorsXml.replace(androidColorRegex, colorsXmlEntry)
|
|
420
426
|
: colorsXml.replace(/<\/resources>/g, `${colorsXmlEntry}</resources>`);
|
|
421
427
|
|
|
422
|
-
writeXml(colorsXmlPath, nextXml);
|
|
428
|
+
writeXml(colorsXmlPath, nextXml, { indentation });
|
|
423
429
|
} else {
|
|
424
430
|
writeXml(colorsXmlPath, `<resources>${colorsXmlEntry}</resources>`);
|
|
425
431
|
}
|
package/src/index.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type Manifest = {
|
|
|
22
22
|
height: number;
|
|
23
23
|
};
|
|
24
24
|
brand?: {
|
|
25
|
+
bottom: number;
|
|
25
26
|
width: number;
|
|
26
27
|
height: number;
|
|
27
28
|
};
|
|
@@ -74,6 +75,7 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
74
75
|
const hasBrand = manifest.brand != null && brandSrc != null;
|
|
75
76
|
const logoWidth = manifest.logo.width;
|
|
76
77
|
const logoHeight = manifest.logo.height;
|
|
78
|
+
const brandBottom = manifest.brand?.bottom;
|
|
77
79
|
const brandWidth = manifest.brand?.width;
|
|
78
80
|
const brandHeight = manifest.brand?.height;
|
|
79
81
|
|
|
@@ -156,7 +158,7 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
156
158
|
source: brandFinalSrc,
|
|
157
159
|
style: {
|
|
158
160
|
position: "absolute",
|
|
159
|
-
bottom: 60,
|
|
161
|
+
bottom: Platform.OS === "web" ? 60 : brandBottom,
|
|
160
162
|
width: brandWidth,
|
|
161
163
|
height: brandHeight,
|
|
162
164
|
},
|
|
@@ -193,6 +195,7 @@ export function useHideAnimation(config: UseHideAnimationConfig) {
|
|
|
193
195
|
|
|
194
196
|
logoWidth,
|
|
195
197
|
logoHeight,
|
|
198
|
+
brandBottom,
|
|
196
199
|
brandWidth,
|
|
197
200
|
brandHeight,
|
|
198
201
|
|