-
Notifications
You must be signed in to change notification settings - Fork 0
/
compositor.json
90 lines (90 loc) · 18.2 KB
/
compositor.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
"name": "fabriceclementz/HackerNewsApp",
"version": "0.1.4",
"libraries": {
"xv": "^1.1.25"
},
"title": "",
"branch": "master",
"style": {
"name": "Material",
"componentSet": {
"nav": "nav/DarkAbsoluteNav",
"header": "header/GradientHeader",
"article": "article/BasicArticle",
"footer": "footer/BasicFooter"
},
"fontFamily": "Roboto, sans-serif",
"heading": {
"fontWeight": 500,
"letterSpacing": "-0.01em"
},
"colors": {
"text": "#212121",
"background": "#fff",
"primary": "#2196f3",
"secondary": "#1565c0",
"highlight": "#ff4081",
"border": "#e0e0e0",
"muted": "#f5f5f5"
},
"layout": {
"centered": true,
"bannerHeight": "80vh",
"maxWidth": 896
}
},
"content": [
{
"component": "nav",
"links": [
{
"href": "https://github.com/fabriceclementz/HackerNewsApp",
"text": "GitHub"
},
{
"href": "https://npmjs.com/package/HackerNewsApp",
"text": "npm"
}
]
},
{
"component": "header",
"heading": "HackerNewsApp",
"subhead": " A react-native HackerNews Client App",
"children": [
{
"component": "ui/TweetButton",
"text": "HackerNewsApp: A react-native HackerNews Client App",
"url": null
},
{
"component": "ui/GithubButton",
"user": "fabriceclementz",
"repo": "HackerNewsApp"
}
],
"text": "v0.1.0"
},
{
"component": "article",
"metadata": {
"source": "github.readme"
},
"html": "<p>This project was bootstrapped with <a href=\"https://github.com/react-community/create-react-native-app\">Create React Native App</a>.</p>\n<p>Below you'll find information about performing common tasks. The most recent version of this guide is available <a href=\"https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/README.md\">here</a>.</p>\n<h2>Table of Contents</h2>\n<ul>\n<li><a href=\"#updating-to-new-releases\">Updating to New Releases</a></li>\n<li><a href=\"#available-scripts\">Available Scripts</a><ul>\n<li><a href=\"#npm-start\">npm start</a></li>\n<li><a href=\"#npm-test\">npm test</a></li>\n<li><a href=\"#npm-run-ios\">npm run ios</a></li>\n<li><a href=\"#npm-run-android\">npm run android</a></li>\n<li><a href=\"#npm-run-eject\">npm run eject</a></li>\n</ul>\n</li>\n<li><a href=\"#writing-and-running-tests\">Writing and Running Tests</a></li>\n<li><a href=\"#environment-variables\">Environment Variables</a><ul>\n<li><a href=\"#configuring-packager-ip-address\">Configuring Packager IP Address</a></li>\n</ul>\n</li>\n<li><a href=\"#adding-flow\">Adding Flow</a></li>\n<li><a href=\"#customizing-app-display-name-and-icon\">Customizing App Display Name and Icon</a></li>\n<li><a href=\"#sharing-and-deployment\">Sharing and Deployment</a><ul>\n<li><a href=\"#publishing-to-expos-react-native-community\">Publishing to Expo's React Native Community</a></li>\n<li><a href=\"#building-an-expo-standalone-app\">Building an Expo "standalone" app</a></li>\n<li><a href=\"#ejecting-from-create-react-native-app\">Ejecting from Create React Native App</a><ul>\n<li><a href=\"#build-dependencies-xcode-android-studio\">Build Dependencies (Xcode & Android Studio)</a></li>\n<li><a href=\"#should-i-use-expokit\">Should I Use ExpoKit?</a></li>\n</ul>\n</li>\n</ul>\n</li>\n<li><a href=\"#troubleshooting\">Troubleshooting</a><ul>\n<li><a href=\"#networking\">Networking</a></li>\n<li><a href=\"#ios-simulator-wont-open\">iOS Simulator won't open</a></li>\n<li><a href=\"#qr-code-does-not-scan\">QR Code does not scan</a></li>\n</ul>\n</li>\n</ul>\n<h2>Updating to New Releases</h2>\n<p>You should only need to update the global installation of <code>create-react-native-app</code> very rarely, ideally never.</p>\n<p>Updating the <code>react-native-scripts</code> dependency of your app should be as simple as bumping the version number in <code>package.json</code> and reinstalling your project's dependencies.</p>\n<p>Upgrading to a new version of React Native requires updating the <code>react-native</code>, <code>react</code>, and <code>expo</code> package versions, and setting the correct <code>sdkVersion</code> in <code>app.json</code>. See the <a href=\"https://github.com/react-community/create-react-native-app/blob/master/VERSIONS.md\">versioning guide</a> for up-to-date information about package version compatibility.</p>\n<h2>Available Scripts</h2>\n<p>If Yarn was installed when the project was initialized, then dependencies will have been installed via Yarn, and you should probably use it to run these commands as well. Unlike dependency installation, command running syntax is identical for Yarn and NPM at the time of this writing.</p>\n<h3><code>npm start</code></h3>\n<p>Runs your app in development mode.</p>\n<p>Open it in the <a href=\"https://expo.io\">Expo app</a> on your phone to view it. It will reload if you save edits to your files, and you will see build errors and logs in the terminal.</p>\n<p>Sometimes you may need to reset or clear the React Native packager's cache. To do so, you can pass the <code>--reset-cache</code> flag to the start script:</p>\n<pre>npm <span class=\"hljs-built_in\">start</span> <span class=\"hljs-comment\">-- --reset-cache</span>\n<span class=\"hljs-comment\"># or</span>\nyarn <span class=\"hljs-built_in\">start</span> <span class=\"hljs-comment\">-- --reset-cache</span></pre><h4><code>npm test</code></h4>\n<p>Runs the <a href=\"https://github.com/facebook/jest\">jest</a> test runner on your tests.</p>\n<h4><code>npm run ios</code></h4>\n<p>Like <code>npm start</code>, but also attempts to open your app in the iOS Simulator if you're on a Mac and have it installed.</p>\n<h4><code>npm run android</code></h4>\n<p>Like <code>npm start</code>, but also attempts to open your app on a connected Android device or emulator. Requires an installation of Android build tools (see <a href=\"https://facebook.github.io/react-native/docs/getting-started.html\">React Native docs</a> for detailed setup). We also recommend installing Genymotion as your Android emulator. Once you've finished setting up the native build environment, there are two options for making the right copy of <code>adb</code> available to Create React Native App:</p>\n<h5>Using Android Studio's <code>adb</code></h5>\n<ol>\n<li>Make sure that you can run adb from your terminal.</li>\n<li>Open Genymotion and navigate to <code>Settings -> ADB</code>. Select “Use custom Android SDK tools” and update with your <a href=\"https://stackoverflow.com/questions/25176594/android-sdk-location\">Android SDK directory</a>.</li>\n</ol>\n<h5>Using Genymotion's <code>adb</code></h5>\n<ol>\n<li>Find Genymotion’s copy of adb. On macOS for example, this is normally <code>/Applications/Genymotion.app/Contents/MacOS/tools/</code>.</li>\n<li>Add the Genymotion tools directory to your path (instructions for <a href=\"http://osxdaily.com/2014/08/14/add-new-path-to-path-command-line/\">Mac</a>, <a href=\"http://www.computerhope.com/issues/ch001647.htm\">Linux</a>, and <a href=\"https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/\">Windows</a>).</li>\n<li>Make sure that you can run adb from your terminal.</li>\n</ol>\n<h4><code>npm run eject</code></h4>\n<p>This will start the process of "ejecting" from Create React Native App's build scripts. You'll be asked a couple of questions about how you'd like to build your project.</p>\n<p><strong>Warning:</strong> Running eject is a permanent action (aside from whatever version control system you use). An ejected app will require you to have an <a href=\"https://facebook.github.io/react-native/docs/getting-started.html\">Xcode and/or Android Studio environment</a> set up.</p>\n<h2>Customizing App Display Name and Icon</h2>\n<p>You can edit <code>app.json</code> to include <a href=\"https://docs.expo.io/versions/latest/guides/configuration.html\">configuration keys</a> under the <code>expo</code> key.</p>\n<p>To change your app's display name, set the <code>expo.name</code> key in <code>app.json</code> to an appropriate string.</p>\n<p>To set an app icon, set the <code>expo.icon</code> key in <code>app.json</code> to be either a local path or a URL. It's recommended that you use a 512x512 png file with transparency.</p>\n<h2>Writing and Running Tests</h2>\n<p>This project is set up to use <a href=\"https://facebook.github.io/jest/\">jest</a> for tests. You can configure whatever testing strategy you like, but jest works out of the box. Create test files in directories called <code>__tests__</code> or with the <code>.test</code> extension to have the files loaded by jest. See the <a href=\"https://github.com/react-community/create-react-native-app/blob/master/react-native-scripts/template/App.test.js\">the template project</a> for an example test. The <a href=\"https://facebook.github.io/jest/docs/getting-started.html\">jest documentation</a> is also a wonderful resource, as is the <a href=\"https://facebook.github.io/jest/docs/tutorial-react-native.html\">React Native testing tutorial</a>.</p>\n<h2>Environment Variables</h2>\n<p>You can configure some of Create React Native App's behavior using environment variables.</p>\n<h3>Configuring Packager IP Address</h3>\n<p>When starting your project, you'll see something like this for your project URL:</p>\n<pre><span class=\"hljs-built_in\">exp</span>:<span class=\"hljs-comment\">//192.168.0.2:19000</span></pre><p>The "manifest" at that URL tells the Expo app how to retrieve and load your app's JavaScript bundle, so even if you load it in the app via a URL like <code>exp://localhost:19000</code>, the Expo client app will still try to retrieve your app at the IP address that the start script provides.</p>\n<p>In some cases, this is less than ideal. This might be the case if you need to run your project inside of a virtual machine and you have to access the packager via a different IP address than the one which prints by default. In order to override the IP address or hostname that is detected by Create React Native App, you can specify your own hostname via the <code>REACT_NATIVE_PACKAGER_HOSTNAME</code> environment variable:</p>\n<p>Mac and Linux:</p>\n<pre><span class=\"hljs-attr\">REACT_NATIVE_PACKAGER_HOSTNAME</span>=<span class=\"hljs-string\">'my-custom-ip-address-or-hostname'</span> npm start</pre><p>Windows:</p>\n<pre><span class=\"hljs-keyword\">set</span> REACT_NATIVE_PACKAGER_HOSTNAME='<span class=\"hljs-keyword\">my</span>-custom-ip-address-<span class=\"hljs-keyword\">or</span>-hostname'\nnpm start</pre><p>The above example would cause the development server to listen on <code>exp://my-custom-ip-address-or-hostname:19000</code>.</p>\n<h2>Adding Flow</h2>\n<p>Flow is a static type checker that helps you write code with fewer bugs. Check out this <a href=\"https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb\">introduction to using static types in JavaScript</a> if you are new to this concept.</p>\n<p>React Native works with <a href=\"http://flowtype.org/\">Flow</a> out of the box, as long as your Flow version matches the one used in the version of React Native.</p>\n<p>To add a local dependency to the correct Flow version to a Create React Native App project, follow these steps:</p>\n<ol>\n<li>Find the Flow <code>[version]</code> at the bottom of the included <a href=\".flowconfig\">.flowconfig</a></li>\n<li>Run <code>npm install --save-dev flow-bin@x.y.z</code> (or <code>yarn add --dev flow-bin@x.y.z</code>), where <code>x.y.z</code> is the .flowconfig version number.</li>\n<li>Add <code>"flow": "flow"</code> to the <code>scripts</code> section of your <code>package.json</code>.</li>\n<li>Add <code>// @flow</code> to any files you want to type check (for example, to <code>App.js</code>).</li>\n</ol>\n<p>Now you can run <code>npm run flow</code> (or <code>yarn flow</code>) to check the files for type errors.\nYou can optionally use a <a href=\"https://flow.org/en/docs/editors/\">plugin for your IDE or editor</a> for a better integrated experience.</p>\n<p>To learn more about Flow, check out <a href=\"https://flow.org/\">its documentation</a>.</p>\n<h2>Sharing and Deployment</h2>\n<p>Create React Native App does a lot of work to make app setup and development simple and straightforward, but it's very difficult to do the same for deploying to Apple's App Store or Google's Play Store without relying on a hosted service.</p>\n<h3>Publishing to Expo's React Native Community</h3>\n<p>Expo provides free hosting for the JS-only apps created by CRNA, allowing you to share your app through the Expo client app. This requires registration for an Expo account.</p>\n<p>Install the <code>exp</code> command-line tool, and run the publish command:</p>\n<pre><span class=\"hljs-symbol\">$</span> npm i -g <span class=\"hljs-built-in\">exp</span>\n<span class=\"hljs-symbol\">$</span> <span class=\"hljs-built-in\">exp</span> publish</pre><h3>Building an Expo "standalone" app</h3>\n<p>You can also use a service like <a href=\"https://docs.expo.io/versions/latest/guides/building-standalone-apps.html\">Expo's standalone builds</a> if you want to get an IPA/APK for distribution without having to build the native code yourself.</p>\n<h3>Ejecting from Create React Native App</h3>\n<p>If you want to build and deploy your app yourself, you'll need to eject from CRNA and use Xcode and Android Studio.</p>\n<p>This is usually as simple as running <code>npm run eject</code> in your project, which will walk you through the process. Make sure to install <code>react-native-cli</code> and follow the <a href=\"https://facebook.github.io/react-native/docs/getting-started.html\">native code getting started guide for React Native</a>.</p>\n<h4>Should I Use ExpoKit?</h4>\n<p>If you have made use of Expo APIs while working on your project, then those API calls will stop working if you eject to a regular React Native project. If you want to continue using those APIs, you can eject to "React Native + ExpoKit" which will still allow you to build your own native code and continue using the Expo APIs. See the <a href=\"https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md\">ejecting guide</a> for more details about this option.</p>\n<h2>Troubleshooting</h2>\n<h3>Networking</h3>\n<p>If you're unable to load your app on your phone due to a network timeout or a refused connection, a good first step is to verify that your phone and computer are on the same network and that they can reach each other. Create React Native App needs access to ports 19000 and 19001 so ensure that your network and firewall settings allow access from your device to your computer on both of these ports.</p>\n<p>Try opening a web browser on your phone and opening the URL that the packager script prints, replacing <code>exp://</code> with <code>http://</code>. So, for example, if underneath the QR code in your terminal you see:</p>\n<pre><span class=\"hljs-built_in\">exp</span>:<span class=\"hljs-comment\">//192.168.0.1:19000</span></pre><p>Try opening Safari or Chrome on your phone and loading</p>\n<pre><span class=\"hljs-symbol\">http:</span><span class=\"hljs-comment\">//192.168.0.1:19000</span></pre><p>and</p>\n<pre><span class=\"hljs-symbol\">http:</span><span class=\"hljs-comment\">//192.168.0.1:19001</span></pre><p>If this works, but you're still unable to load your app by scanning the QR code, please open an issue on the <a href=\"https://github.com/react-community/create-react-native-app\">Create React Native App repository</a> with details about these steps and any other error messages you may have received.</p>\n<p>If you're not able to load the <code>http</code> URL in your phone's web browser, try using the tethering/mobile hotspot feature on your phone (beware of data usage, though), connecting your computer to that WiFi network, and restarting the packager.</p>\n<h3>iOS Simulator won't open</h3>\n<p>If you're on a Mac, there are a few errors that users sometimes see when attempting to <code>npm run ios</code>:</p>\n<ul>\n<li>"non-zero exit code: 107"</li>\n<li>"You may need to install Xcode" but it is already installed</li>\n<li>and others</li>\n</ul>\n<p>There are a few steps you may want to take to troubleshoot these kinds of errors:</p>\n<ol>\n<li>Make sure Xcode is installed and open it to accept the license agreement if it prompts you. You can install it from the Mac App Store.</li>\n<li>Open Xcode's Preferences, the Locations tab, and make sure that the <code>Command Line Tools</code> menu option is set to something. Sometimes when the CLI tools are first installed by Homebrew this option is left blank, which can prevent Apple utilities from finding the simulator. Make sure to re-run <code>npm/yarn run ios</code> after doing so.</li>\n<li>If that doesn't work, open the Simulator, and under the app menu select <code>Reset Contents and Settings...</code>. After that has finished, quit the Simulator, and re-run <code>npm/yarn run ios</code>.</li>\n</ol>\n<h3>QR Code does not scan</h3>\n<p>If you're not able to scan the QR code, make sure your phone's camera is focusing correctly, and also make sure that the contrast on the two colors in your terminal is high enough. For example, WebStorm's default themes may <a href=\"https://github.com/react-community/create-react-native-app/issues/49\">not have enough contrast</a> for terminal QR codes to be scannable with the system barcode scanners that the Expo app uses.</p>\n<p>If this causes problems for you, you may want to try changing your terminal's color theme to have more contrast, or running Create React Native App from a different terminal. You can also manually enter the URL printed by the packager script in the Expo app's search bar to load it manually.</p>\n"
},
{
"component": "footer",
"links": [
{
"href": "https://github.com/fabriceclementz/HackerNewsApp",
"text": "GitHub"
},
{
"href": "https://github.com/fabriceclementz",
"text": "fabriceclementz"
}
]
}
]
}