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 key to Info.plist Can you post an example? Thanks I am using … Read more

Is using async componentDidMount() good?

Is using componentDidMount() as an async function good practice in React Native or should I avoid it? I need to get some info from AsyncStorage when the component mounts, but the only way I know to make that possible is to make the componentDidMount() function async. async componentDidMount() { let auth = await this.getAuth(); if … Read more

Hide/Show components in react native

I’m really new to React Native and I’m wondering how can I hide/show a component. Here’s my test case: <TextInput onFocus={this.showCancel()} onChangeText={(text) => this.doSearch({input: text})} /> <TouchableHighlight onPress={this.hideCancel()}> <View> <Text style={styles.cancelButtonText}>Cancel</Text> </View> </TouchableHighlight> I have a TextInput component, what I want is to show the TouchableHighlight when the input gets the focus, then hide the … Read more

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 /usr/local/Cellar/watchman/4.4.0 3. brew info flow stable 0.24.1 /usr/local/Cellar/flow/0.24.1 4. brew info node stable 6.1.0 /usr/local/Cellar/node/6.1.0 5. npm -version 3.8.6 6. echo $PATH … Read more

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 ( <div> <p>You clicked {count} times</p> <button onClick={() => setCount(count + 1)}> Click me </button> </div> ); } Basically we use this.forceUpdate() method to force the component to re-render immediately in React class components like below … Read more

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 versions it works just fine. 33 Answers 33 A possible solution for this is that … Read more

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 code snippet and tried to run the project again and had the following … Read more