React Native global styles

You may create a reusable stylesheet. Example: style.js ‘use strict’; import { StyleSheet } from ‘react-native’; module.exports = StyleSheet.create({ alwaysred: { backgroundColor: ‘red’, height: 100, width: 100, }, }); In your component: const s = require(‘./style’); …then: <View style={s.alwaysred} ></View>

How to launch and open email client React-native?

React Native Open Mail Function <Button onPress={() => Linking.openURL(‘mailto:support@example.com’) } title=”support@example.com” /> React Native Open Mail Function With Subject and Body <Button onPress={() => Linking.openURL(‘mailto:support@example.com?subject=SendMail&body=Description’) } title=”support@example.com” /> React Native Open URL <Button onPress={() => Linking.openURL(‘https://www.google.co.in/’) } title=”www.google.co.in” /> ##Don’t forget to import import { Linking } from ‘react-native’ Note: Not supported in iOS simulator, … Read more

React Native: Possible unhandled promise rejection

catch function in your api should either return some data which could be handled by Api call in React class or throw new error which should be caught using a catch function in your React class code. Latter approach should be something like: return fetch(url) .then(function(response){ return response.json(); }) .then(function(json){ return { city: json.name, temperature: … Read more

When to use TouchableNativeFeedback, TouchableHighlight or TouchableOpacity?

source: https://medium.com/differential/better-cross-platform-react-native-components-cb8aadeba472, by Nick Wientge TouchableHighlight • What it does: Darkens or lightens the background of the element when pressed. • When to use it: On iOS for touchable elements or buttons that have a solid shape or background, and on ListView items. TouchableOpacity • What it does: Lightens the opacity of the entire element … Read more

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle

TL;DR: You import module A into module B and module B into module A resulting in a cycle A → B → A → B → A …, which can result in errors. Resolve that by restructuring your modules, so that the cycle breaks. Detailed Answer In javascript if you import different modules into other … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)