react-native-android

How to customize TouchableOpacity and reuse in each component

耗尽温柔 提交于 2019-12-11 08:03:39
问题 I am trying to customize TouchableOpacity with below style <TouchableOpacity onPress={() => { navigate("EnableNotification"); }} > <View style={{ backgroundColor: "#FE434C", alignItems: "center", justifyContent: "center", borderRadius: 10, width: 240, marginTop: 30, height: 40 }} > <Text style={{ color: "white" }}>CONTINUE</Text> </View> </TouchableOpacity> I have this TouchableOpacity in each component. I want something like customize this view in one js file & reuse this. Wherever I want to

getting “Error: EINVAL: invalid argument, read” for “npm install --save-dev eslint --verbose”

时光怂恿深爱的人放手 提交于 2019-12-11 07:57:38
问题 Any ideas/assistance here re how to get "npm install --save-dev eslint --verbose" working. I keep getting: Error: EINVAL: invalid argument, read I've setup up a new react-native project: react-native init gcLists E:\gcLists>npm -v 5.5.1 E:\gcLists>yarn -v 1.2.1 E:\gcLists>react-native -v react-native-cli: 2.0.1 react-native: 0.49.5 npm install --save-dev eslint --verbose Last part of the log: npm http fetch GET 304 https://registry.npmjs.org/slice-ansi 104ms (from cache) npm verb correctMkdir

(0, _reactI18next.translate) is not a function

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 07:47:08
问题 Actually I am new to react native and here I am trying to change language to Arabic using 'react-i18next' but when executed the following error ocures ReactNativeJS ▶︎ (0, _reactI18next.translate) is not a function. (In '(0, _reactI18next.translate)('common', { bindI18n: 'languageChanged', bindStore: false })', '(0, _reactI18next.translate)' is undefined) this is my code import React from 'react'; import AppNavigator from './src/controller/AppNavigator'; import { translate } from 'react

Loading Old Bundle in React native . While running on Physical device

浪尽此生 提交于 2019-12-11 07:37:56
问题 While trying to run generated build apk or debugging on physical device , It is loading old bundle. and not reflecting any changes, it Happens only with physical device on same network. Following tricks are not working for me. 1. Run the command in a terminal: ps ax | grep react-native Kill all processes and run bundle script again. 2. rm -rf $TMPDIR/react-* 3. --resetCache true 4. --reset-cache 5. Permanent delete node_modules npm cache clean –force npm install npm start -- --reset-cache 回答1

React Native - TouchableOpacity causing app to crash on Android

蓝咒 提交于 2019-12-11 07:29:34
问题 I have a simple component that toggles between two sets of items - Hours & Happy Hours. The component works fine on iOS, but causes my app to crash (silently) on Android. I have a working example here: https://snack.expo.io/Sk92sIEmf. And here is the code used, for reference: import React, { Component } from 'react'; import { Dimensions, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; const { width } = Dimensions.get('window'); export default class App extends Component {

React Native - trigger scrolling of FlatList outside the FlatList

孤者浪人 提交于 2019-12-11 06:52:20
问题 I have a vertical FlatList component and two buttons as TouchableOpacity , how do I perform scrolling of the FlatList with the buttons, i.e. 'scrolling the FlatList towards bottom` and 'scroll the FlatList towards top'? Minimal Example: <View> <FlatList/> <TouchableOpacity> <Text>Scroll towards Top</>Text </TouchableOpacity> <TouchableOpacity> <Text>Scroll towards Bottom</>Text </TouchableOpacity> </View> 回答1: This is not difficult to accomplish, The <Flatlist/> component already have methods

Android onNotification never called in react-native-push-notification

送分小仙女□ 提交于 2019-12-11 06:47:28
问题 PushNotification.configure({ onNotification: function(notification) { console.log( 'NOTIFICATION:', notification); }, }) notification received form the server when i clicked on it app is opened but onNotification never called. i put this in componentDidMount() and constructor in App.js but it's never called.. help.. 回答1: Did you add the required code into the AndroidManifest.xml? For example : <!--more stuff above--> <service android:name="com.dieam.reactnativepushnotification.modules

react-native-orientation-listener Cannot read property 'getOrientation' of undefined

时光总嘲笑我的痴心妄想 提交于 2019-12-11 06:37:12
问题 package.json { "name": "MakeItCluster", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "react": "15.4.1", "react-native": "0.39.2", "react-native-orientation-listener": "0.0.4", "react-native-vector-icons": "^3.0.0" }, "devDependencies": { "babel-jest": "18.0.0", "babel-preset-react-native": "1.9.1", "jest": "18.1.0", "react-test-renderer": "15.4.1" }, "jest": { "preset": "react-native" }

Real time permission in React Native

纵饮孤独 提交于 2019-12-11 06:36:50
问题 I am new to react native . I want to ask real time permission for Location .Please help me how to take Real Time Permission in react native. 回答1: Best avoid libraries for permission check <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> Important - include the above code line in your manifest file import { PermissionsAndroid, Platform } from 'react-native'; componentDidMount() { if (Platform.OS === 'android') { this.requestLocationPermission(); // function call } }

com.android.build.api.transform.TransformException: Error while generating the main dex list

眉间皱痕 提交于 2019-12-11 06:18:08
问题 I'm implementing react-native-firebase notifications lib in a react native project. here is my android gradle.build buildscript { repositories { google() jcenter() maven { url 'https://maven.google.com/' name 'Google' } maven { url 'https://maven.fabric.io/public' } flatDir { dirs 'libs' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' 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