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
240
votes
24 answers

Setting environment variable in react-native?

I am using react-native to build a cross-platform app, but I do not know how to set the environment variable so that I can have different constants for different environments. Example: development: BASE_URL: '', API_KEY: '', staging: …
Damon Yuan
  • 3,683
  • 4
  • 23
  • 31
239
votes
9 answers

Get size of a View in React Native

Is it possible to get the size (width and height) of a certain view? For example, I have a view showing the progress: I need to know the actual width of the view…
Matthew
  • 4,935
  • 5
  • 21
  • 17
237
votes
4 answers

Axios get in url works but with second parameter as object it doesn't

I'm trying to send GET request as second parameter but it doesn't work while it does as url. This works, $_GET['naam'] returns test: export function saveScore(naam, score) { return function (dispatch) { …
Sinan Samet
  • 6,432
  • 12
  • 50
  • 93
230
votes
14 answers

What is useState() in React?

I am currently learning hooks concept in React and trying to understand below example. import { useState } from 'react'; function Example() { // Declare a new state variable, which we'll call "count" const [count, setCount] = useState(0); …
Hemadri Dasari
  • 32,666
  • 37
  • 119
  • 162
230
votes
10 answers

How can you float: right in React Native?

I have an element that I want to float right, for example Hello How can the Text be floated / aligned to the right? Also, why does the Text take up the full space…
Some Guy
  • 12,768
  • 22
  • 58
  • 86
220
votes
20 answers

How can I force a component to re-render with hooks in React?

Considering below hooks example import { useState } from 'react'; function Example() { const [count, setCount] = useState(0); return (

You clicked {count} times

Hemadri Dasari
  • 32,666
  • 37
  • 119
  • 162
220
votes
38 answers

React Native fetch() Network Request Failed

When I create a brand new project using react-native init (RN version 0.29.1) and put a fetch in the render method to the public facebook demo movie API, it throws a Network Request Failed. There is a very useless stack trace and I can't debug…
Alek Hurst
  • 4,527
  • 5
  • 19
  • 24
218
votes
17 answers

Build and Install unsigned apk on device without the development server?

As I am new in react-native so if there is anything wrong in steps let me know. I have build a react native android app using the command as per documentation react-native android while running on device the following command was…
kAy_4337270
  • 2,461
  • 3
  • 12
  • 16
216
votes
5 answers

Using an authorization header with Fetch in React Native

I'm trying to use fetch in React Native to grab information from the Product Hunt API. I've obtained the proper Access Token and have saved it to State, but don't seem to be able to pass it along within the Authorization header for a GET…
Richard Kho
  • 5,086
  • 4
  • 21
  • 35
212
votes
22 answers

react-native: command not found

I am getting -bash: react-native: command not found error while creating a react-native project. Below are the additional info 1. brew --version homebrew 0.9.9 2 brew info watchman watchman `enter code here`stable 4.50 …
Ashok R
  • 19,892
  • 8
  • 68
  • 68
212
votes
15 answers

Disabling buttons on react native

I'm making an android app using react native and I've used TouchableOpacity component to create buttons. I use a text input component to accept text from the user and the button should only be enabled once the text input matches a certain string. I…
Jeff P Chacko
  • 4,908
  • 4
  • 24
  • 32
210
votes
38 answers

error "Could not get BatchedBridge, make sure your bundle is packaged properly" on start of app

Trying to create a react-native project on Android 4.4.2 I get this error screen and couldn't find any way to resolve it. I tried restarting packager, reconnecting device, even reinstalling react native and starting new project. On 6.0.0 and later…
Zygro
  • 6,849
  • 11
  • 28
  • 43
208
votes
30 answers

React-Native: Application has not been registered error

I am currently going through the React-Native tutorials. I began with the Getting Started tutorial, where I made a new react native project and successfully managed to run the project on my device. I then started the Props tutorial, I copied the…
Adam
  • 2,418
  • 3
  • 17
  • 22
208
votes
26 answers

Android failed to load JS bundle

I'm trying to run AwesomeProject on my Nexus5 (android 5.1.1). I'm able to build the project and install it on the device. But when I run it, I got a red screen saying Unable to download JS bundle. Did you forget to start the development server or…
Matthew
  • 4,935
  • 5
  • 21
  • 17
207
votes
12 answers

NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll

Recently I started to get this error: NSPhotoLibraryUsageDescription key must be present in Info.plist to use camera roll. I am using React Native to build my app (I am not familiar with ios native development) and I don't know how to add this…
Murat Ozgul
  • 11,193
  • 6
  • 29
  • 32