Questions tagged [react-native]
React Native is a JavaScript library used to build native mobile apps using React. The focus of React Native is on developer efficiency across all the platforms you care about - learn once, write anywhere.
react-native
141,761
questions
106
votes
19
answers
142k
views
TypeError: cli.init is not a function for react native
While running npx react-native init appName in MacBook air M1 chip
TypeError: cli.init is not a function
at run (/opt/homebrew/lib/node_modules/react-native-cli/index.js:302:7)
at createProject (/opt/...
106
votes
9
answers
181k
views
Creating CSS circles in react-native
I'm having some trouble creating CSS circles in react-native. The following works in iPhone 6 Plus but in all the other iPhones, they become diamonds.
circle: {
height: 30,
width: 30,
...
105
votes
9
answers
146k
views
React-native: How to control what keyboard pushes up
The structure of the app is fairly simple: A searchbar, a listview and react-native-tabs at the bottom. The problem: If I click on the searchbar on Android it pushes the whole app up, so I see the ...
105
votes
32
answers
171k
views
Invariant Violation: requireNativeComponent: "RNSScreen" was not found in the UIManager
I am getting RNSScreen error even though I have installed all related packages and followed react-navigation guide (https://reactnavigation.org/docs/getting-started#installation) but nothing worked ...
104
votes
37
answers
336k
views
react-native :app:installDebug FAILED
Install APK debug to my device failed.
jianglinghuadeMacBook-Pro:hello jianglinghua$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android &...
104
votes
40
answers
135k
views
React native: Android project not found. Maybe run react-native android first?
I had an issue in my React-Native project which was working fine earlier but suddenly it stopped working. Whenever I used the command:
react-native run-android
I was getting an error:
Android ...
104
votes
18
answers
53k
views
Get rid of "Remote debugger is in a background tab" warning in React Native
I've started a new React Native project and I keep getting the following warning:
Remote debugger is in a background tab which may cause apps to perform slowly. Fix this by foregrounding the tab (...
103
votes
22
answers
158k
views
Auto scale image height with React Native
In my React Native app, I am fetching images from an API with unknown dimensions. How do I auto scale the height if I know my desired width?
Example:
I set the width to Dimensions.get('window')....
102
votes
30
answers
175k
views
Unrecognized font family on iOS simulator with React Native
I've added Linux Biolinum fonts (http://www.dafont.com/linux-biolinum.font, LinBiolinum_R.ttf, LinBiolinum_RB.ttf) to my React Native project. Android version is OK. But on iOS I always see error "...
102
votes
21
answers
204k
views
React navigation goBack() and update parent state
I've a page that will render the user's name if s/he is logged in or "Create an account" or "Sign in" option if s/he not. Screen as below
They can navigate to "Sign in" or "Create an account" page. ...
102
votes
18
answers
168k
views
Maintain aspect ratio of image with full width in React Native
I have a query regarding tag. I want an image to take entire width of parent which I do using alignSelf:stretch, but I also want the height to be according to the aspect ratio of the image. How can I ...
102
votes
15
answers
201k
views
React-Native Button style not work
Import_this
import {AppRegistry, Text, View, Button, StyleSheet} from 'react-native';
This my React Button code But style not working Hare ...
<Button
onPress={this.onPress.bind(this)}
...
102
votes
28
answers
275k
views
Invariant Violation: "main" has not been registered
New to React Native:
I started a brand new project with Expo init and then I followed the instructions mentioned inhttps://reactnavigation.org/docs/hello-react-navigation
I run the project with expo ...
102
votes
7
answers
244k
views
How to use zIndex in react-native
I've want to achieve the following:
The following images are what I can do right now, but that's NOT what I want.
Sample of code I have right now:
renderA() {
return (
<View style={ ...
101
votes
16
answers
175k
views
React Native adb reverse ENOENT
I am trying to get React-Native to work with Android V4.2.2 (Genymotion) but I am unable to test the app on the Emulator. When I ran react-native run-android, I get this error Could not run adb ...
101
votes
2
answers
19k
views
How to get react-native run-ios to open in iTerm instead of Terminal on a macOS?
How can somebody configure react-native run-ios to execute in iTerm instead of Terminal on OSX? By default, it opens a new Terminal window, but Terminal doesn't work as well with my window manager as ...
101
votes
29
answers
189k
views
KeyboardAvoidingView not Working Properly
KeyboardAvoidingView not Working Properly
I am trying to use the KeyboardAvoidingView with behavior="padding".
For some reason, when I'm trying to enter any text in TextInput, there's a ...
101
votes
29
answers
166k
views
Close react native modal by clicking on overlay?
Is it possible to close react native modal by clicking on overlay when transparent option is true? Documentation doesn't provide anything about it. Is it possible?
101
votes
11
answers
181k
views
React-Native run-android on specific device
Is it possible to use the run-android command for one specific device only?
For example, if I have three devices (or emulators) connected and I want to use run-android on only one of them?
Maybe ...
100
votes
11
answers
141k
views
React Native init specific version
I upgraded my latest project to React Native 0.19 and instantly the video no longer works. How can I create a new project with a specific version? I want to init a new project at version 0.18.1. I did ...
99
votes
28
answers
216k
views
ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types
I am getting this warning in log :
ViewPropTypes will be removed from React Native. Migrate to
ViewPropTypes exported from 'deprecated-react-native-prop-types
even I haven't used ViewPropTypes ...
99
votes
11
answers
110k
views
Detect ScrollView has reached the end
I have a Text with long text inside a ScrollView and I want to detect when the user has scrolled to the end of the text so I can enable a button.
I've been debugging the event object from the ...
99
votes
13
answers
277k
views
Text vertical align in react native (using nativebase)
I was wondering there is a way I can align vertically in React Native. I'm trying to position on the bottom but I don't think I can find a good way to do it.
If anyone knows how to solve this issue, ...
98
votes
36
answers
131k
views
How can we center title of react-navigation header?
React-navigation docs are still young, and reading through the issues is not working quite much for me (changes on each version) does anyone have a working method to center title in Android using ...
98
votes
14
answers
166k
views
React Native - open links in browser
Hi i am using react native's webview to display some html,
i want that whenever a user clicks a link inside that html, it will open the user's browser with that link.
is that possible?
Edit 1:
I ended ...
98
votes
6
answers
145k
views
What is react-native link?
What is the purpose of the react-native link command?
97
votes
31
answers
115k
views
PhaseScriptExecution [CP-User] error in React Native
Nowadays everytime I create a new project react-native init ProjectName and after it is created I do npx pod-install and then react-native run-ios it gives me error. It happens with every project that ...
97
votes
5
answers
69k
views
Storing non-state variables in functional components
Below are two React Components that do almost the same thing. One is a function; the other is a class. Each Component has an Animated.Value with an async listener that updates _foo on change. I need ...
96
votes
15
answers
78k
views
Setting a timer for a long period of time, i.e. multiple minutes
I want to use firebase auth with react native for Login and Signup but I got a yellow error:
Setting a timer for a long period of time, i.e. multiple minutes, is a performance and correctness issue ...
96
votes
4
answers
118k
views
Subscribe to single property change in store in Redux
In Redux I can easily subscribe to store changes with
store.subscribe(() => my handler goes here)
But what if my store is full of different objects and in a particular place in my app I want to ...
96
votes
7
answers
89k
views
How can I declare a PropType corresponding to a nullable number?
I'm looking for a PropType that means
"this is required, and it will either be a number or be null"
In other words, what I have now is
PropTypes.number.isRequired
but that throws a warning if ...
95
votes
11
answers
66k
views
No template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
Just upgraded my Xcode to 15.0, and suddenly it started giving me the following error in RCT_Folly
No template named 'unary_function' in namespace 'std'; did you mean '__unary_function'?
this is the ...
94
votes
30
answers
68k
views
Error type 3. Activity class {com.awesome_project/ com.awesome_project.MainActivity} does not exist in react native (Android device)
I've created the project using the following command.
react-native init Awesome_Project
I've started the packager using the following command.
react-native start
I've connected my Android mobile ...
94
votes
6
answers
156k
views
What is an alternative of textarea in react-native?
Is there any built in text area component for react-native? I have tried to implement these ones:
https://github.com/buildo/react-autosize-textarea
https://github.com/andreypopp/react-textarea-...
94
votes
1
answer
99k
views
flex vs flexGrow vs flexShrink vs flexBasis in React Native?
I finally upgraded react native to 0.42 which includes the introduction of flexGrow, flexShrink, and flexBasis and the change (or fix) of how flex is rendered.
I keep getting errors like:
View ...
94
votes
1
answer
5k
views
React Native app stuck on blank white screen with remote debugging using Nuclide
Steps to Reproduce / Screenshots
Apply all operations from the instruction:
Create a blank React Native project with $ react-native init [project name].
From the command Palette (Cmd-Shift-P), ...
93
votes
22
answers
221k
views
How to set shadows in React Native for android?
Hi am trying to set a shadow for my fab but my attempts has failed so far i tried setting shadow props but that is for ios only so i tried to play with elevation property but it doesn't look right.
...
93
votes
15
answers
93k
views
"Invariant Violation: Application AwesomeProject has not been registered" When building for iOS device with static jsbundle
First off, I don't know react, but I figured deploying to an iOS device instead of the simulator wouldn't be too difficult to do with the docs. They were a bit sparse but I got somewhere and now I'm ...
93
votes
29
answers
220k
views
'react-native' is not recognized as an internal or external command, operable program or batch file
I recently started with react-native. I install it using the tutorial on the Facebook site and everything works well for a day or two until this message comes up:
'react-native' is not recognized as ...
93
votes
17
answers
135k
views
KeyboardAvoidingView with ScrollView
I am sort of new to react native and have one question that I did not find in react native documentation.
I am looking into this component KeyboardAvoidingView:
https://facebook.github.io/react-...
93
votes
4
answers
88k
views
What is StrictMode in React?
I heard that strict mode helps to write React code in best practices way by throwing warnings for life cycle methods removal. I read about it from this article on Medium.
Is my understanding correct? ...
93
votes
6
answers
71k
views
clang: error: SDK does not contain 'libarclite' at the path
After Updating to Xcode 15 I am getting the following error in my react-native app while it try to build it.
clang: error: SDK does not contain 'libarclite' at the path '/Applications/Xcode.app/...
93
votes
23
answers
160k
views
ERROR - VirtualizedLists should never be nested inside plain ScrollViews with the same orientation
I'm working on a react-native app and I have to put a list of object in a Scrollview, so I use the FlatList component to do it. This is the piece of code that generates the error:
<ScrollView ...
93
votes
1
answer
79k
views
Question mark before dot in javascript / react [duplicate]
I know what a ternary operator is in React.
When I'm developing a React Native app I encounter this kind of syntax that is covered by my ESLint as an unexpected token:
ESLint: Parsing error: ...
93
votes
5
answers
67k
views
Is it possible to show warnings instead of errors on ALL of eslint rules?
As the title says, would it be possible for eslint to show warnings instead of errors on ALL of the rules? I'm using Standard JS, if that information is relevant.
Thanks!
92
votes
10
answers
224k
views
how to make the blur effect with react-native?
how to make the blur effect with react-native ? like 'background-image'
and i want to switch the effect 'blur' and 'none','none' means no blur effect
92
votes
9
answers
225k
views
react-native - Fit Image in containing View, not the whole screen size
I'm trying to fit images in their containing views so that I can have a seamless grid of images. The problem is that resizeMode='contain' seems to fit to the width of the screen or at least some ...
92
votes
11
answers
284k
views
setTimeout in React Native
I'm trying to load a splash screen for an iOS app built in React Native. I'm trying to accomplish this through class states and then a setTimeout function as follows:
class CowtanApp extends ...
92
votes
14
answers
70k
views
How to solve: console.error: "redux-persist failed to create sync storage. falling back to "noop" storage
I'm trying to setup redux-persist in a react native app.
However I'm hitting this error:
console.error: "redux-persist failed to create sync storage. falling
back to "noop" storage
I'...
92
votes
14
answers
71k
views
How to auto-slide the window out from behind keyboard when TextInput has focus?
I've seen this hack for native apps to auto scroll the window, but wondering best way to do it in React Native... When a <TextInput> field gets focus and is positioned low in the view, the ...