Skip to content

Commit 1cd16bc

Browse files
author
Adam Miskiewicz
committed
Convert NavigationPlayground project to a CRNA project
1 parent d145332 commit 1cd16bc

File tree

15 files changed

+2330
-517
lines changed

15 files changed

+2330
-517
lines changed

circle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ jobs:
2727
./scripts/deploy-website.sh
2828
2929
# deploy expo playground demo
30-
yarn global add exp && exp login -u "$EXPO_USERNAME" -p "$EXPO_PASSWORD"
31-
cd examples/ExpoNavigationPlayground && npm install && exp publish
30+
exp login -u "$EXPO_USERNAME" -p "$EXPO_PASSWORD"
31+
cd examples/ExpoNavigationPlayground && yarn && exp publish
3232
fi
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
2-
"presets": [
3-
"react-native"
4-
]
2+
"presets": ["babel-preset-expo"],
3+
"env": {
4+
"development": {
5+
"plugins": ["transform-react-jsx-source"]
6+
}
7+
}
58
}

examples/NavigationPlayground/.flowconfig

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<PROJECT_ROOT>/\.buckd/
77

88
; Ignore unexpected extra "@providesModule"
9-
.*/node_modules/commoner/test/source/widget/share.js
109
.*/node_modules/.*/node_modules/fbjs/.*
1110

1211
; Ignore duplicate module providers
@@ -15,6 +14,22 @@
1514
.*/Libraries/react-native/React.js
1615
.*/Libraries/react-native/ReactNative.js
1716

17+
; Additional create-react-native-app ignores
18+
19+
; Ignore duplicate module providers
20+
.*/node_modules/fbemitter/lib/*
21+
22+
; Ignore misbehaving dev-dependencies
23+
.*/node_modules/xdl/build/*
24+
.*/node_modules/reqwest/tests/*
25+
26+
; Ignore missing expo-sdk dependencies (temporarily)
27+
; https://github.com/exponent/exponent-sdk/issues/36
28+
.*/node_modules/expo/src/*
29+
30+
; Ignore react-native-fbads dependency of the expo sdk
31+
.*/node_modules/react-native-fbads/*
32+
1833
[include]
1934

2035
[libs]
@@ -25,6 +40,8 @@ flow/
2540
[options]
2641
module.system=haste
2742

43+
emoji=true
44+
2845
experimental.strict_type_args=true
2946

3047
munge_underscores=true
@@ -35,11 +52,12 @@ suppress_type=$FlowIssue
3552
suppress_type=$FlowFixMe
3653
suppress_type=$FixMe
3754

38-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
39-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
55+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
56+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-0]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
4057
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
58+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
4159

4260
unsafe.enable_getters_and_setters=true
4361

4462
[version]
45-
^0.36.0
63+
^0.40.0
Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,3 @@
1-
# OSX
2-
#
3-
.DS_Store
4-
5-
# Xcode
6-
#
7-
build/
8-
*.pbxuser
9-
!default.pbxuser
10-
*.mode1v3
11-
!default.mode1v3
12-
*.mode2v3
13-
!default.mode2v3
14-
*.perspectivev3
15-
!default.perspectivev3
16-
xcuserdata
17-
*.xccheckout
18-
*.moved-aside
19-
DerivedData
20-
*.hmap
21-
*.ipa
22-
*.xcuserstate
23-
project.xcworkspace
24-
25-
# Android/IntelliJ
26-
#
27-
build/
28-
.idea
29-
.gradle
30-
local.properties
31-
*.iml
32-
33-
# node.js
34-
#
351
node_modules/
36-
npm-debug.log
37-
38-
# BUCK
39-
buck-out/
40-
\.buckd/
41-
android/app/libs
42-
*.keystore
43-
44-
# fastlane
45-
#
46-
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
47-
# screenshots whenever they are needed.
48-
# For more information about the recommended setup visit:
49-
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
50-
51-
fastlane/report.xml
52-
fastlane/Preview.html
53-
fastlane/screenshots
2+
.expo/
3+
npm-debug.*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

examples/NavigationPlayground/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import App from './js/App';
2+
export default App;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react';
2+
import 'react-native';
3+
import renderer from 'react-test-renderer';
4+
5+
import App from './App';
6+
7+
it('renders without crashing', () => {
8+
const rendered = renderer.create(<App />).toJSON();
9+
expect(rendered).toBeTruthy();
10+
});
Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
{
2-
"name": "NavigationPlayground",
3-
"displayName": "NavigationPlayground"
4-
}
2+
"expo": {
3+
"name": "NavigationPlayground",
4+
"description": "Try out react-navigation now with this awesome playground",
5+
"version": "1.0.0",
6+
"slug": "NavigationPlayground",
7+
"privacy": "public",
8+
"orientation": "portrait",
9+
"primaryColor": "#cccccc",
10+
"icon": "./assets/icons/react-navigation.png",
11+
"loading": {
12+
"icon": "./assets/icons/react-navigation.png",
13+
"hideExponentText": false
14+
},
15+
"sdkVersion": "16.0.0",
16+
"entryPoint": "./examples/NavigationPlayground/node_modules/react-native-scripts/build/bin/crna-entry.js",
17+
"packagerOpts": {
18+
"projectRoots": "",
19+
"assetExts": [
20+
"ttf",
21+
"mp4"
22+
],
23+
"config": "./rn-cli.config.js"
24+
},
25+
"ios": {
26+
"supportsTablet": true
27+
}
28+
}
29+
}
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
{
22
"name": "NavigationPlayground",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"private": true,
5+
"devDependencies": {
6+
"react-native-scripts": "0.0.29",
7+
"jest-expo": "^0.4.0",
8+
"react-test-renderer": "16.0.0-alpha.6"
9+
},
10+
"main": "./examples/node_modules/react-native-scripts/build/bin/crna-entry.js",
511
"scripts": {
6-
"test": "jest"
12+
"start": "react-native-scripts start",
13+
"eject": "react-native-scripts eject",
14+
"android": "react-native-scripts android",
15+
"ios": "react-native-scripts ios",
16+
"test": "node node_modules/jest/bin/jest.js --watch"
717
},
818
"dependencies": {
19+
"expo": "^16.0.0",
920
"react": "16.0.0-alpha.6",
10-
"react-native": "^0.44.0",
11-
"react-native-vector-icons": "^4.1.1",
12-
"react-navigation": "file:../.."
13-
},
14-
"devDependencies": {
15-
"babel-jest": "^20.0.1",
16-
"jest": "^20.0.1",
17-
"react-test-renderer": "^15.5.4"
21+
"react-native": "^0.43.4"
1822
},
1923
"jest": {
20-
"preset": "react-native",
24+
"preset": "jest-expo",
2125
"setupFiles": [
2226
"<rootDir>/../../jest-setup.js"
2327
],
2428
"transformIgnorePatterns": [
2529
"node_modules/(?!react-native|react-navigation)/",
26-
"__exponent"
30+
"examples/ReduxExample/"
2731
]
2832
}
2933
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* RN CLI Config that allows Exponent to work with this project
3+
*
4+
* Extends the base rn-cli.config.js at the root of the project to use a custom transfomer and a
5+
* special blacklist.
6+
*/
7+
8+
const fs = require('fs');
9+
const path = require('path');
10+
const blacklist = require('react-native/packager/blacklist');
11+
const config = require('react-native/packager/rn-cli.config');
12+
13+
const examples = getDirectories(path.join(__dirname, '..'));
14+
const CURRENT_EXAMPLE = 'NavigationPlayground';
15+
16+
const getBlacklistForExample = (example) => [
17+
...examples.filter(x => x !== example).map(exampleName => new RegExp(`${path.resolve(__dirname, '..')}/${exampleName}/(.*)`))
18+
];
19+
20+
config.getBlacklist = () => [
21+
new RegExp(
22+
`${path.resolve(__dirname, '../..')}/node_modules/react-native/(.*)`
23+
),
24+
new RegExp(`${path.resolve(__dirname, '../..')}/node_modules/react/(.*)`),
25+
...getBlacklistForExample(CURRENT_EXAMPLE)
26+
];
27+
28+
config.getBlacklistRE = () => blacklist(config.getBlacklist());
29+
30+
config.getTransformModulePath = () =>
31+
path.resolve(__dirname, 'transformer.js');
32+
33+
config.getTransformOptions = () => ({
34+
reactNativePath: path.resolve(__dirname, 'node_modules/react-native/'),
35+
reactPath: path.resolve(__dirname, 'node_modules/react/'),
36+
});
37+
38+
config.getProjectRoots = () => getRoots();
39+
config.getAssetRoots = () => getRoots();
40+
41+
function getRoots() {
42+
return [path.join(__dirname, '..', '..')];
43+
}
44+
45+
function getDirectories (srcpath) {
46+
return fs.readdirSync(srcpath)
47+
.filter(file => fs.lstatSync(path.join(srcpath, file)).isDirectory())
48+
}
49+
50+
module.exports = config;

0 commit comments

Comments
 (0)