Comandos Uteis ReactNative
Comandos Uteis ReactNative
https://classic.yarnpkg.com/lang/en/docs/install/#debian-stable
depois que instala isso tudo, baixa o projeto, entra na pasta app e da o comando
yarn
expo start
iniciar ambiante
npx expo start
############################################
########## CONTAIER MTC ##########
############################################
Entrar no Portainer: https://wstech.up2solucoes.net/portainer/#/home
Usuario: wstech
Senha: kqklpi123
LABELS:
traefik.http.routers.wstechserver.entrypoints -> traefik.http.routers.<NOME SISTEMA
NOVO>server.entrypoints
traefik.http.routers.wstechserver.rule -> traefik.http.routers.<NOME SISTEMA
NOVO>server.rule
traefik.http.routers.wstechserver.service -> traefik.http.routers.<NOME SISTEMA
NOVO>server.service = <NOME SISTEMA NOVO>server
traefik.http.routers.wstechserver.tls.certresolver -> traefik.http.routers.<NOME
SISTEMA NOVO>server.tls.certresolver
traefik.http.services.wstechserver.loadbalancer.server.port ->
traefik.http.services.<NOME SISTEMA NOVO>server.loadbalancer.server.port
############################################
########## Comandos úteis Node.js ##########
############################################
Iniciar o projeto:
{ Pasta onde o projeto está }
npx react-native start
Executar projeto
npx expo start
gerar apk
{ CMD como Admin }
--X--expo build:android -t apk--X--
--> (cmd admininstrador) eas build -p android
Iniciar ambiante
--> npx expo start
{Parar processos:
Ctrl + C
##################################################
############### Clipboard ###############
##################################################
Com o Expo
expo install react-native-screens react-native-safe-area-context
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(null);
} //dentro de MainActivity class
{ Instalar Tab }
npm install @react-navigation/bottom-tabs
{ Drawer - Sidemenu }
npm install @react-navigation/drawer
# Sem o Expo
npm install react-native-gesture-handler react-native-reanimated
# Com o Expo
expo install react-native-gesture-handler react-native-reanimated
###################################################
Para quem está está fazendo o projeto na nova versão do react-navigation, precisa
de algumas alterações para fazer funcionar:
package com.exercicio;
import com.facebook.react.ReactActivity;
+ import com.facebook.react.ReactActivityDelegate;
+ import com.facebook.react.ReactRootView;
+ import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "exercicio";
}
+ @Override
+ protected ReactActivityDelegate createReactActivityDelegate() {
+ return new ReactActivityDelegate(this, getMainComponentName()) {
+ @Override
+ protected ReactRootView createRootView() {
+ return new RNGestureHandlerEnabledRootView(MainActivity.this);
+ }
+ };
+ }
package com.exercicio;
import com.facebook.react.ReactActivity;
+ import com.facebook.react.ReactActivityDelegate;
+ import com.facebook.react.ReactRootView;
+ import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "exercicio";
}
+ @Override
+ protected ReactActivityDelegate createReactActivityDelegate() {
+ return new ReactActivityDelegate(this, getMainComponentName()) {
+ @Override
+ protected ReactRootView createRootView() {
+ return new RNGestureHandlerEnabledRootView(MainActivity.this);
+ }
+ };
+ }
###################################################
##################################################
############### Adicionando icones ###############
##################################################
https://github.com/oblador/react-native-vector-icons#android
Edite android/app/build.gradle
project.ext.vectoricons = [
iconFontNames: [ 'Ionicons.ttf', 'FontAwesome.ttf' ] // Name of the font files
you want to copy
]
##################################################
############### Native Elements ###############
##################################################
https://reactnativeelements.com/docs
Alternativa
npm install react-native-safe-area-context
##################################################
############## FlatList e ListItem ###############
##################################################
https://reactnativeelements.com/docs/listitem
Avatar
https://reactnativeelements.com/docs/avatar/