Página da disciplina de pos (Programação Orientada a Serviços) do curso técnico integrado de Informática para Internet.
desktop
online
códigos-fonte
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
nvm install lts/carbon
npm i -g create-react-native-app yarn
create-react-native-app CurrencyConverter
cd CurrencyConverter
yarn start
git init
.gitignore
(ver arquivo no final da página)git add '*'
git commit -m "Primeira versão do app CurrencyConverter"
git remote add origin https://github.com/tiipos/CurrencyConverter.git
git pull origin master
git push origin master
observação:
git pull
, seja sugerido pelo git realizar a mesclagem (merge).git add
) e depois registrar o versionamento (git commit
).vscode configurando
git registrando de fato a mudança
git add .vscode/settings.json
git commit -m "vscode configurado para projetos react native"
git push origin master
a organizção final será essa
passos
mkdir app/
cp App.js app/index.js
git registre o versionamento
git add App.js app/index.js
git commit -m "estruturando os diretórios do projeto"
git push origin master
eslint configurando
npm i -g eslint
eslint --init
, respondendo as perguntas da seguinte forma:
yarn --dev add babel-eslint eslint eslint-config-airbnb eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react prettier prettier-eslint
package.json
(ver scripts no final desta página)git registrando de fato a mudança
git add .eslintrc.json package.json
git commit -m "adicionando o eslint ao projeto"
git push origin master
modificando app/index.js o eslint irá avisar que tem alguns erros e warnings
git add app/index.js
git commit -m "corrigindo app/index com os erros encontrados por eslint"
git push origin master
cmd + opt + i
Debug Remote JS
cmd + m
ou ctrl + m
Debug Remote JS
.eslintrc.json
{
"extends": "airbnb", // EXISTING
"parser": "babel-eslint",
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
"react/jsx-filename-extension": [
2,
{
"extensions": [
".js",
".jsx"
]
}
],
"react/forbid-prop-types": [
0
],
"react/require-default-props": [
0
],
"global-require": [
0
]
}
}
.gitignore
# expo
.expo/
# node
/node_modules
package-lock.json
# misc
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
# OS X
.DS_Store
# Watchman
.watchmanconfig
.vscode/settings.json
{
"prettier.eslintIntegration": true,
"editor.formatOnSave": true
}
app/index.js v1
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Text>Meu primeiro App Mobile.</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
app/index.js v2
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
export default () => (
<View style={styles.container}>
<Text>Meu primeiro App Mobile.</Text>
</View>
);
App.js
import App from './app/index';
export default App;
package.json
{
"name": "CurrencyConverter",
"version": "0.0.1",
"private": true,
"devDependencies": {
"babel-eslint": "^8.2.2",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"jest-expo": "25.0.0",
"prettier": "^1.11.1",
"prettier-eslint": "^8.8.1",
"react-native-scripts": "1.11.1",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js",
"lint": "eslint app/",
"lint:fix": "eslint app/ --fix"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "0.52.0"
}
}