Skip to content

Commit

Permalink
Make yarn link work with example project. (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVann authored Oct 23, 2018
1 parent 6967876 commit 65ba0c4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion react-native-fast-image-example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ project(':react-native-vector-icons').projectDir = new File(rootProject.projectD
include ':react-native-image-picker'
project(':react-native-image-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-picker/android')
include ':react-native-fast-image'
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fast-image/android')
project(':react-native-fast-image').projectDir = new File(rootProject.projectDir, '../../android')

include ':app'
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@
DEAD_CODE_STRIPPING = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
"$(SRCROOT)/../../ios",
"$(SRCROOT)/../node_modules/react-native-image-picker/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
);
Expand All @@ -1451,7 +1451,7 @@
CURRENT_PROJECT_VERSION = 1;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-fast-image/ios/FastImage/**",
"$(SRCROOT)/../../ios",
"$(SRCROOT)/../node_modules/react-native-image-picker/ios",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
);
Expand Down
36 changes: 36 additions & 0 deletions react-native-fast-image-example/rn-cli.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const path = require('path')

const extraNodeModules = {
'prop-types': path.resolve(__dirname, 'node_modules/prop-types'),
react: path.resolve(__dirname, 'node_modules/react'),
'react-native': path.resolve(__dirname, 'node_modules/react-native'),
}

const blacklistPath = path.resolve(__dirname, '../node_modules/react-native')
const blacklistRegexes = [new RegExp(`${blacklistPath}/.*`)]

const watchFolder = path.resolve(__dirname, '../')
const watchFolders = [watchFolder]

const metroVersion = require('metro/package.json').version
const metroVersionComponents = metroVersion.match(/^(\d+)\.(\d+)\.(\d+)/)
if (
metroVersionComponents[1] === '0' &&
parseInt(metroVersionComponents[2], 10) >= 43
) {
module.exports = {
resolver: {
extraNodeModules,
blacklistRE: require('metro-config/src/defaults/blacklist')(
blacklistRegexes,
),
},
watchFolders,
}
} else {
module.exports = {
extraNodeModules,
getBlacklistRE: () => require('metro/src/blacklist')(blacklistRegexes),
getProjectRoots: () => [path.resolve(__dirname)].concat(watchFolders),
}
}

0 comments on commit 65ba0c4

Please sign in to comment.