Skip to content

Commit

Permalink
support for native base
Browse files Browse the repository at this point in the history
  • Loading branch information
pavjacko committed May 25, 2019
1 parent 02a7c17 commit 374773f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"@babel/core": "7.1.2",
"@babel/plugin-proposal-decorators": "7.1.2",
"@babel/plugin-transform-runtime": "7.1.0",
"@babel/plugin-proposal-class-properties": "7.4.4",
"@babel/preset-env": "7.3.4",
"@babel/runtime": "7.1.2",
"@react-navigation/core": "3.1.1",
Expand Down
13 changes: 11 additions & 2 deletions rnv-cli/platformTemplates/_shared/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ function generateConfig(config) {
path.resolve(projectDir, 'node_modules/react-native-material-textfield'),
path.resolve(projectDir, 'node_modules/react-native-material-ripple'),
path.resolve(projectDir, 'node_modules/react-native-easy-grid'),
path.resolve(projectDir, 'node_modules/native-base-shoutem-theme'),
path.resolve(projectDir, 'node_modules/react-native-drawer'),
path.resolve(projectDir, 'node_modules/react-native-safe-area-view'),
path.resolve(projectDir, 'node_modules/react-native-vector-icons'),
path.resolve(projectDir, 'node_modules/react-native-keyboard-aware-scroll-view'),
path.resolve(projectDir, 'node_modules/react-native-tab-view'),
],
use: {
loader: 'babel-loader',
Expand Down Expand Up @@ -76,10 +82,13 @@ function generateConfig(config) {
};

const aliases = {
react: path.resolve(projectDir, 'node_modules/react'),
react: path.resolve(projectDir, 'node_modules/react'),
'react-native': 'react-native-web',
'react-native/Libraries/Renderer/shims/ReactNativePropRegistry': 'react-native-web/dist/modules/ReactNativePropRegistry',
'react-native-linear-gradient': 'react-native-web-linear-gradient',
'react-native-vector-icons': 'react-native-web-vector-icons',
// 'react-native-vector-icons': 'react-native-web-vector-icons',
'react-native-vector-icons': path.resolve(projectDir, 'node_modules/react-native-vector-icons'),
'react-native-vector-icons/Entypo': path.resolve(projectDir, 'node_modules/react-native-vector-icons/dist/Entypo'),
svgs: path.resolve(projectDir, 'node_modules/svgs'),
'react-navigation-tabs': path.resolve(projectDir, 'node_modules/react-navigation-tabs'),
'react-navigation-stack': path.resolve(projectDir, 'node_modules/react-navigation-stack'),
Expand Down
4 changes: 4 additions & 0 deletions rnv-cli/pluginTemplates/plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,10 @@
"copyEditorHtmlToAppAssets(file('../../../node_modules/react-native-zss-rich-text-editor'))"
]
}
},
"native-base": {
"version": "2.12.1",
"dependsOn": ["react-native-vector-icons"]
}
}
}
13 changes: 13 additions & 0 deletions rnv-cli/src/cli/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const _runAdd = c => new Promise((resolve, reject) => {

for (const k in selectedPlugins) {
c.files.pluginConfig.plugins[k] = selectedPlugins[k];
_checkAndAddDependantPlugins(c, selectedPlugins[k]);
}

fs.writeFileSync(c.paths.pluginConfigPath, JSON.stringify(c.files.pluginConfig, null, 2));
Expand All @@ -157,6 +158,18 @@ const _runAdd = c => new Promise((resolve, reject) => {
});
});

const _checkAndAddDependantPlugins = (c, plugin) => {
const templatePlugins = c.files.pluginTemplatesConfig.plugins;
if (plugin.dependsOn) {
plugin.dependsOn.forEach((v) => {
if (templatePlugins[v]) {
console.log(`Added dependant plugin ${v}`);
c.files.pluginConfig.plugins[v] = templatePlugins[v];
}
});
}
};

const _runUpdate = c => new Promise((resolve, reject) => {
logTask('_runUpdate');

Expand Down

0 comments on commit 374773f

Please sign in to comment.