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 is an open-source framework created by Facebook that lets you build mobile apps using only and some basic and . It uses the same design as React, letting you compose a rich mobile UI from declarative components.

React Native apps are not "mobile web apps" or "hybrid apps". They are real cross-platform mobile apps that are indistinguishable from apps built using or . is often used to bring clarity in development.

The idea behind React Native can best be captured by the slogan "Learn once, write anywhere", enabling developers to use the same development approach for both desktop/browser and mobile apps.

Technically React Native runs the JavaScript code for a React app in a background thread. Updates to the virtual DOM are collected, and all changes are sent through an API into the native portion of the app. By doing this, React Native avoids slowing down the FPS rate of the app by not making the app wait for unfinished JavaScript operations.

Resources


Related tags

133828 questions
925
votes
45 answers

What is the difference between React Native and React?

I have started to learn React out of curiosity and wanted to know the difference between React and React Native - though could not find a satisfactory answer using Google. React and React Native seems to have the same format. Do they have completely…
shiva kumar
  • 11,294
  • 4
  • 23
  • 28
708
votes
8 answers

What is the difference between using constructor vs getInitialState in React / React Native?

I've seen both used interchangeably. What are the main use cases for both? Are there advantages / disadvantages? Is one a better practice?
Nader Dabit
  • 52,483
  • 13
  • 107
  • 91
685
votes
38 answers

Hide keyboard in react-native

If I tap onto a textinput, I want to be able to tap somewhere else in order to dismiss the keyboard again (not the return key though). I haven't found the slightest piece of information concerning this in all the tutorials and blog posts that I…
TurboFish
  • 7,789
  • 4
  • 18
  • 27
623
votes
39 answers

How can I insert a line break into a component in React Native?

I want to insert a new line (like \r\n,
) in a Text component in React Native. If I have:
Hi~
this is a test message.
Then React Native renders Hi~ this is a test message. Is it possible render text to add a…
Curtis
  • 6,242
  • 2
  • 10
  • 8
582
votes
35 answers

React Native android build failed. SDK location not found

I have error when i start running android What went wrong: A problem occurred evaluating project ':app'. > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Pyae Sone Nyein
  • 5,821
  • 3
  • 10
  • 3
563
votes
34 answers

React Native Error: ENOSPC: System limit for number of file watchers reached

I have setup a new blank react native app. After installing few node modules I got this error. Running application on PGN518. internal/fs/watchers.js:173 throw error; ^ Error: ENOSPC: System limit for number of file watchers reached, watch…
Badis Merabet
  • 13,970
  • 9
  • 40
  • 55
473
votes
37 answers

How to do logging in React Native

How can I log a variable in React Native, like using console.log when developing for web?
ljk321
  • 16,242
  • 7
  • 48
  • 60
467
votes
17 answers

Error Running React Native App From Terminal (iOS)

I am following the tutorial on the official React Native website. Using the following to build my project: react-native run-ios I get the error: Found Xcode project TestProject.xcodeproj xcrun: error: unable to find utility "instruments", not a…
JacobSiegel
  • 5,311
  • 2
  • 14
  • 17
416
votes
53 answers

Unable to load script from assets index.android.bundle on windows

I'm trying to run my first React Native project for first time on my device (Android 4.2.2). And I get: unable to load script from assets index.android.bundle Commands that I used: cd (project directory) react-native start react-native…
Goba
  • 4,305
  • 3
  • 11
  • 15
391
votes
8 answers

What is the difference between Hot Reloading and Live Reloading in React Native?

I'm a bit confused here. When I'm debugging a React Native Application, I usually enable both Hot Reloading and Live Reloading. I want to know what is the difference between them?
Raman Choudhary
  • 4,283
  • 2
  • 14
  • 25
358
votes
6 answers

What are my options for storing data when using React Native? (iOS and Android)

I am still new in the React Native world, and generally in the mobile/native world as well, and I am finding the documentation a bit lacking when it comes to data persistence. What are my options for storing data in React Native and the implications…
Sia
  • 8,894
  • 5
  • 31
  • 50
354
votes
17 answers

How to add icons to React Native app

I am making a React Native app. I would like to customize the app icon (meaning the icon that you click on to start the app). I have Googled this, but I keep finding different types of icons that refer to different things. How do I add these types…
Adam Katz
  • 6,999
  • 11
  • 42
  • 74
352
votes
16 answers

How to use comments in React

How can I use comments inside the render method in a React component? I have the following component: 'use strict'; var React = require('react'), Button = require('./button'), UnorderedList = require('./unordered-list'); class Dropdown…
user1177440
343
votes
38 answers

Hide header in stack navigator React navigation

I'm trying to switch screens using both stack and tab navigator. const MainNavigation = StackNavigator({ otp: { screen: OTPlogin }, otpverify: { screen: OTPverification}, userVerified: { screen: TabNavigator({ …
Avijit Dutta
  • 3,651
  • 3
  • 13
  • 16
337
votes
11 answers

What is the difference between Expo and React Native?

From the Expo website Expo lets web developers build truly native apps that work across both iOS and Android by writing them once in just JavaScript. Isn't this what React Native does? What's the difference?
Aurora
  • 3,395
  • 2
  • 10
  • 3
1
2 3
99 100