Hola muchachos estoy obligado a usar laravel como backend y enviar notificaciones ente laravel y react-native, básicamente es un chat entre laravel(web) a react-native(móvil) alguien hizo algo así alguna vez? Hay alguna herramienta q me recomienden integrar? Muchas gracias de antemano y saludos!
Tag: reactnative
What made it necessary to separate ReactJs from React-Native?
I as far as I know, ReactJs runs on a browser whereas React Native runs as a standalone app using native drivers and many cores… But why can’t you build your ReactJs app so it uses more resources?
react-native run-android nao roda de jeito nehum de cara ele ja me da esse erro
react-native info Microsoft Windows [versão 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Todos os direitos reservados.
C:\Users\Marco\Desktop\taxi>react-native info info React Native Environment Info: System: OS: Windows 7 CPU: (2) x64 Pentium(R) Dual-Core CPU E5300 @ 2.60GHz Memory: 212.95 MB / 2.00 GB Binaries: Yarn: 1.16.0 – C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.9.0 – C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156
package.json { “name”: “taxi”, “version”: “0.0.1”, “private”: true, “scripts”: { “start”: “node node_modules/react-native/local-cli/cli.js start”, “test”: “jest” }, “dependencies”: { “geolib”: “^3.0.4”, “react”: “16.8.3”, “react-native”: “^0.59.9”, “react-native-geocoding”: “^0.3.0”, “react-native-google-places-autocomplete”: “^1.3.9”, “react-native-maps”: “^0.24.2”, “react-native-maps-directions”: “^1.7.0”, “react-native-update-gradle”: “^1.2.0”, “styled-components”: “^4.3.2” }, “devDependencies”: { “@babel/core”: “^7.4.5”, “@babel/runtime”: “^7.4.5”, “babel-jest”: “^24.8.0”, “jest”: “^24.8.0”, “metro-react-native-babel-preset”: “^0.54.1”, “react-test-renderer”: “16.8.3” }, “jest”: { “preset”: “react-native” } }
Как правильно работать с формой в React-Native?
В Reat создал компонент, который отрисовывает простую форму (2 поля и кнопка). По клику на кнопку (onSubmit) – отправляю данные всей формы обработчику. Теперь, нужно реализовать аналогичную форму на React-Native, в связи с этим несколько вопросов:
- В HTML в большинстве своем принято писать структуру формы как: from->input. В React-Native не нашел компонента Form, пока вставил TextInput без формы. В React-Native вставляются input без form?
- Если form нет, то не понимаю, как правильно забирать данные из input. Попробовал сделал через ref, но “value” указанного поля не удалось получить в обработчике. Так как правильно это делать?
.
// отрисовываем форму return ( <View> <Text style={ styles.h1 }>Авторизация:</Text> <View> <Text style={ styles.bold }>Login (numeric):</Text> <TextInput keyboardType="numeric" style={ { height: 40, borderColor: "gray", borderWidth: 1 } } /> <Text style={ styles.bold }>Password (default):</Text> <TextInput ref={ refInputLogin } keyboardType="default" style={ { height: 40, borderColor: "gray", borderWidth: 1 } } /> <Button ref={ refInputPassword } color="#841584" onPress={ () => props.onFormSubmit(refInputLogin, refInputPassword) } title="GO" /> </View> </View> );
.
// обработчик формы handleFormSubmit = (login, password) => { console.log(login.current.value); console.log(password.current.value); };
Erro react-native-gesture-handler na versão react-native 0.60.0
Galera, tô com uma dificuldade com o React Navigation depois da última atualização do React-Native para versão 0.60.0
O react-native-gesture-handler não é compatível por causa de um autolink que a versão nova do React-Native tem.
Já procurei em tudo quanto é fórum e não vi ninguém com a solução, pra fazer rodar meu projeto depois que instala o react-native-gesture-handler.
Eu fiz o seguinte, pra ficar bem explicado:
Eu criei o projeto com: react-native init PROJETO;
Instalei o react-navigation: yarn add react-navigation (obs: tentei com NPM também);
Instalei o react-native-gesture-handler: yarn add react-native-gesture-handler (obs: também com NPM);
Linkei, conforme diz o manual: react-native link react-native-gesture-handler;
Fiz as alterações necessárias no MainActivity.java, também conforme o manual.
Mas quando rodo o projeto: react-native run-android
Dá o erro: error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
react-native-gesture-handler (to unlink run: “react-native unlink react-native-gesture-handler”) This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via “react-native unlink ” and it will be included in your app automatically. If a library isn’t compatible with autolinking, disregard this message and notify the library maintainers.
Minhas dependências estão assim:
“dependencies”: { “react”: “16.8.6”, “react-native”: “0.60.0”, “react-native-gesture-handler”: “^1.3.0”, “react-navigation”: “^3.11.0” }
Se alguém souber a solução, me ajuda, Vlw !!!
erro ao executar run-android com react-native
Bom, após conseguir executar o comando inicial e criar o projeto(react-native init ) e estando com meu emulador android rodando na maquina (Genymotion) porém ao executar run-android ele acusa esso erro :
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'. > Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_211 contains a valid JDK installation. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings BUILD FAILED in 3m 16s 12 actionable tasks: 1 executed, 11 up-to-date error Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: https://facebook.github.io/react-native/docs/getting-started.html error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.```
Error al generar APK de android en React-Native
Hola estoy trabajando un proyecto migrado en react-native, lo corro en mi emulador correctamente pero al crear la apk me da el siguiente error. Eh seguido varios hilos pero todos me dan la opcion de colocar android.enableAapt2=false
en mi codigo, tambien eh estado cambiando las versiones de gladle pero siempre me genera error. Estoy trabajando con : Linux Mint react-cli 2.0.1 Android 3.4 Emulador v9
El comando que estoy digitando es:
./gradlew clean assembleRelease
Error :
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processReleaseResources'. > Failed to process resources, see aapt output above for details. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10m 16s 139 actionable tasks: 138 executed, 1 up-to-date
grade.properties:
android.enableAapt2=false MYAPP_RELEASE_STORE_FILE=MiFile.keystore MYAPP_RELEASE_KEY_ALIAS=Mikey MYAPP_RELEASE_STORE_PASSWORD=123456 MYAPP_RELEASE_KEY_PASSWORD=123456 android.useDeprecatedNdk=true
build.gladre
subprojects { afterEvaluate {project -> if (project.hasProperty("android")) { android { compileSdkVersion 27 buildToolsVersion "27.0.3" } } } } buildscript { ext { buildToolsVersion = "27.0.3" minSdkVersion = 16 compileSdkVersion = 27 targetSdkVersion = 27 supportLibVersion = "27.1.1" googlePlayServicesVersion = "15.0.1" } repositories { jcenter() google() maven { url 'https://maven.google.com/' name 'Google' } } dependencies { classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.google.gms:google-services:4.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { mavenLocal() maven { url 'https://maven.google.com/' name 'Google' } google() jcenter() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url "$ rootDir/../node_modules/react-native/android" } maven { url "https://jitpack.io" } } }
Necesito poder generar la apk lo mas pronto, agradezco su colaboracion.
Геолокация react-native
Делаю приложение под ios и android на react-native, с использованием карт. Как я могу запросить у пользовать включение передачи геолокации на телефоне, как это в гугл картах?
Получение доступа на геолокацию сделал. Надо только контролировать включил пользователь ее на телефоне или нет
Como criar um select list options (combobox) em react-native com os dados de uma api?
Estou utilizando o pacote tcomb-form-native para criar um combobox da seguinte maneira:
import React, { Component } from 'react'; import { View, StyleSheet, TouchableHighlight, Text } from 'react-native'; import tcomb from 'tcomb-form-native'; const Form = tcomb.form.Form; var CategoriaProduto = tcomb.enums({ 1: 'Buzina', 2: 'Freios' }); var UnidadeMedida = tcomb.enums({ 1: 'Cento', 2: 'CJ', 3: 'KG', 4: 'KIT', 5: 'MIL', 6: 'PC', 7: 'PR', 8: 'ROLO', 9: 'UN', }); var UnidadeMedidaFornecedor = tcomb.enums({ 1: 'Cento', 2: 'CJ', 3: 'KG', 4: 'KIT', 5: 'MIL', 6: 'PC', 7: 'PR', 8: 'ROLO', 9: 'UN', }); const Produto = tcomb.struct({ Ativo: tcomb.Boolean, CodigoProduto: tcomb.String, UnidadeDeMedida: UnidadeMedida, UnidadeMedidaFornecedor: UnidadeMedidaFornecedor, Nome: tcomb.String, Valor: tcomb.maybe(tcomb.Number), Categoria: CategoriaProduto, // enum }); const options = { fields: { Nome: { label: 'Nome do produto: ', error: 'Ops! você precisa informar um Nome para o produto.' }, Valor: { label: 'Valor do produto: ', error: 'Ops! você precisa informar um Valor para o produto.' }, Categoria: { label: 'Categoria do produto: ', error: 'Ops! você precisa informar uma Categoria para o produto.' } }, }; export default class AdicionarProduto extends Component { static navigationOptions = { title: 'Adicionar Produto', } onSubmit = () => { const value = this._form.getValue(); //use getValue() para recuperar os valores do formulário if (value) { // se a validacao falhar, valor vai ser null console.log(value) // o valor aqui é uma instancia de Produto this._form.setState({ value: null }); } }; render() { return ( <View style={styles.container} > <Form type={Produto} ref={c => this._form = c} options={options} /> <TouchableHighlight style={styles.button} onPress={this.onSubmit} underlayColor='#99d9f4'> <Text style={styles.buttonText}>Salvar</Text> </TouchableHighlight> </View> ); } }
A questão é, como eu substituo o trecho abaixo pelos dados da API ou um array, etc?
var UnidadeMedidaFornecedor = tcomb.enums({ 1: 'Cento', 2: 'CJ', 3: 'KG', 4: 'KIT', 5: 'MIL', 6: 'PC', 7: 'PR', 8: 'ROLO', 9: 'UN', });
NSFW классификатор изображений. tensorflow. react-native
Есть потребность запустить nsfw классификатор на ios и android устройствах. Приложение пишется на react-native.
Используя react-native-tensorflow пришел к вот такому результату (в изображении ниже). Предварительный поиск в google подсказывает, что модель тренировалась на версии tensorflow не совпадающей с версией в react-native-tensorflow. Используемый код:
const tfImageRecognition = new TfImageRecognition({ model:require('./assets/nsfw.299x299.pb'), labels: require('./assets/nsfw_labels.txt') }) const results = await tfImageRecognition.recognize({ image: this.image, inputName: "input_1", //Optional, defaults to "input" outputName: "dense_3/Softmax", //Optional, defaults to "output" }) const resultText = `Name: $ {results[0].name} - Confidence: $ {results[0].confidence}` this.setState({result: resultText})
Есть ли способ пересобрать модель для нужной версии?
Если у кого-то получалось запускать подобные классификаторы изображений на react-native поделитесь пожалуйста опытом. Рассматриваются все возможные варианты, например использование tensorflow/tfjs. У меня правда не получилось приспособить tensorflow/tfjs к мобильным устройствам, хотя в браузере все прекрасно работает.