Don't add duplicate font entries to plist during link (iOS)
Summary: **Test plan** 1. Add fonts using `react-native link` and a `"rnpm"` config in package.json 2. Manually delete one or more fonts from Xcode's Resources folder using Remove References option 3. Run `react-native link` again With the patch in this PR, the plist will not accidentally get populated with duplicate entries. Closes https://github.com/facebook/react-native/pull/12048 Differential Revision: D4560432 fbshipit-source-id: aba3733acfd5373f8d654406b06b8338b137bc07
This commit is contained in:
parent
09fa9da209
commit
c6c1c02b75
|
@ -29,7 +29,9 @@ module.exports = function linkAssetsIOS(files, projectConfig) {
|
|||
.filter(file => file) // xcode returns false if file is already there
|
||||
.map(file => file.basename);
|
||||
|
||||
plist.UIAppFonts = (plist.UIAppFonts || []).concat(fonts);
|
||||
const existingFonts = (plist.UIAppFonts || []);
|
||||
const allFonts = [...existingFonts, ...fonts];
|
||||
plist.UIAppFonts = Array.from(new Set(allFonts)); // use Set to dedupe w/existing
|
||||
|
||||
fs.writeFileSync(
|
||||
projectConfig.pbxprojPath,
|
||||
|
|
Loading…
Reference in New Issue