Skip to content

Commit 89e9479

Browse files
committed
Update tab based navigation
1 parent da8957a commit 89e9479

File tree

2 files changed

+308
-36
lines changed

2 files changed

+308
-36
lines changed

src/components/Pre.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,21 @@ export default function Pre({
7373
}
7474

7575
const dependencies = deps
76-
? Object.fromEntries(deps.split(',').map((entry) => entry.split('@')))
76+
? Object.fromEntries(
77+
deps.split(',').map((entry) => {
78+
let prefix = '';
79+
80+
// Handles scoped packages, e.g. @expo/vector-icons
81+
if (entry.startsWith('@')) {
82+
prefix = '@';
83+
entry = entry.slice(1);
84+
}
85+
86+
const [name, version = '*'] = entry.split('@');
87+
88+
return [prefix + name, version];
89+
})
90+
)
7791
: {};
7892

7993
Object.assign(
@@ -118,6 +132,11 @@ export default function Pre({
118132
].every((comment) => line.trim() !== comment)
119133
)
120134
.join('\n')
135+
// Use expo/vector-icons instead of react-native-vector-icons for snack
136+
.replace(
137+
/import (.*) from 'react-native-vector-icons\/(.*)'/g,
138+
'import $1 from "@expo/vector-icons/$2"'
139+
)
121140
);
122141

123142
url.searchParams.set(

0 commit comments

Comments
 (0)