react-native-android

How to set 'hardwareBackPress' to another Stack

那年仲夏 提交于 2020-04-30 11:46:58
问题 //TermsPage.tsx const resetAction = StackActions.reset({ index: 0, actions: [NavigationActions.navigate({ routeName: 'BottomTabNav', params:{showTerms:false} }), ], }); componentWillUnmount() { BackHandler.addEventListener('hardwareBackPress',()=>{ this.props.navigation.dispatch(resetAction) return true }) } How to set 'hardwareBackPress' eventListenner to navigate to another StackNavigator. If I set like above. This backpress work in all Pages. I want to set this listener only for TermsPage.

FontFamily not working in Android Device in React-Native

≯℡__Kan透↙ 提交于 2020-04-16 08:03:12
问题 I have added many font-family and style into my asset folder in React-Native project. It's working fine in simulator, emulator, and iOS device. But some font won't work and not display in Android device. I have try with react-native link and check the asset folder in Android app directory, nothing missing. Anyone help please. 回答1: I might have a solution for this. I had the same problem, the fonts were visible in my emulator, the font files are located under 'android/src/main/assets/fonts'

FontFamily not working in Android Device in React-Native

跟風遠走 提交于 2020-04-16 08:00:12
问题 I have added many font-family and style into my asset folder in React-Native project. It's working fine in simulator, emulator, and iOS device. But some font won't work and not display in Android device. I have try with react-native link and check the asset folder in Android app directory, nothing missing. Anyone help please. 回答1: I might have a solution for this. I had the same problem, the fonts were visible in my emulator, the font files are located under 'android/src/main/assets/fonts'

FlatList ScrollView Error on any State Change - Invariant Violation: Changing onViewableItemsChanged on the fly is not supported

吃可爱长大的小学妹 提交于 2020-04-10 03:28:25
问题 onViewableItemsChanged does not seem to work when there is a state change in the app. Is this correct? Seems like it wouldn't be very useful if this were the case.... Otherwise, users will be forced to us onScroll in order to determine position or something similar... Steps to Reproduce Please refer to snack Repo has also been uploaded at github Any state change produces an error when using onViewableItemsChanged What does this error even mean? Note: Placing the onViewableItemsChanged

How to hide Tab conditionally in react-navigation?

筅森魡賤 提交于 2020-03-26 04:08:07
问题 I want to hide one of my tabs conditionally if user login, So I have 5 Tabs If user login\register I get a boolean from a redux store, if this user login i want to how a "Library tab" if not login, i don't want to show this tab "Library" with others and just keep 4 tabs in the App Code import {createAppContainer} from 'react-navigation'; import {createBottomTabNavigator} from 'react-navigation-tabs'; let {isLogin} = store.getState().user; const TabHome = createBottomTabNavigator( { Home: {

I'm getting below problem while running my React-native Application

喜欢而已 提交于 2020-03-24 19:02:03
问题 Failed to connect to development server using "adb reverse": spawnSync /home/sumit/Android/platform-tools/adb ENOENT I also Tried using $ adb reverse tcp:8081 tcp:8081 but no Luck. 回答1: Now I am updating my app from RN 0.58 to 0.61 and I was facing the same issue. I use to upgrade RN projects by copy-paste my src to a fresh bare RN project. According to new guidelines for MacOS users I had to remove CLI, upgrade node and switch to use npx react-native instead of previous RN CLI. I figured out

I'm getting below problem while running my React-native Application

断了今生、忘了曾经 提交于 2020-03-24 19:01:02
问题 Failed to connect to development server using "adb reverse": spawnSync /home/sumit/Android/platform-tools/adb ENOENT I also Tried using $ adb reverse tcp:8081 tcp:8081 but no Luck. 回答1: Now I am updating my app from RN 0.58 to 0.61 and I was facing the same issue. I use to upgrade RN projects by copy-paste my src to a fresh bare RN project. According to new guidelines for MacOS users I had to remove CLI, upgrade node and switch to use npx react-native instead of previous RN CLI. I figured out

How to fix webview has been removed from react native it can now be install and imported from react-native-webview instead of react native

我们两清 提交于 2020-03-23 11:58:17
问题 import React, { Component } from "react"; import { Text, Button, View, ScrollView } from "react-native"; import Chart from "react-native-f2chart"; import { WebView } from "react-native"; import { Container, Title } from "../components"; import { basePie, labelPie } from "./scripts"; type Props = {}; class PieChartScreen extends PureComponent { render() { return ( <ScrollView> <Container> <View> <Title title="基础饼图" /> <View style={{ height: 250 }}> <Chart initScript={basePie} webView={WebView}

Writing react native android module in Kotlin?

断了今生、忘了曾经 提交于 2020-03-22 03:47:47
问题 React native documentation provides a Toast Module example written in java. What does the same example look like in Kotin? Is there any special steps to configure the android project? 回答1: Writing plugin in java or kotlin doesn't have a big difference as both compile to bytecode. Mentioning the Github Sample that has created the same sample Taost moduel in kotlin . https://github.com/ios122/kotlin-module-sample-for-reactnative 回答2: Here is a sample with instructions of a react-native

Undefined is not an object (evaluating 'Sn[e]')

你。 提交于 2020-03-21 18:06:33
问题 I'm getting this error on Android: I have found that line of code 'Sn[e]' in 'index.android.bundle' which I have pasted below (ctrl/command + F): for (var An in Sn) xn[An] = Sn[An]; for (var Dn in wn) Pt(!Sn[Dn], "Event cannot be both direct and bubbling: %s", Dn), xn[Dn] = wn[Dn]; var kn = { eventTypes: En({}, Sn, wn), extractEvents: function(e, t, n, o) { var r = Sn[e], i = wn[e], a = Pn.getPooled(r || i, t, n, o); if (r) fn.accumulateTwoPhaseDispatches(a); else { if (!i) return null; fn