Render HTML in React Native

Edit Jan 2021: The React Native docs currently recommend React Native WebView: <WebView originWhitelist={[‘*’]} source={{ html: ‘<p>Here I am</p>’ }} /> https://github.com/react-native-webview/react-native-webview If you don’t want to embed a WebView, there are also third party libraries to render HTML into native views: react-native-render-html react-native-htmlview Edit March 2017: the html prop has been deprecated. Use source … Read more

StackNavigator through Component gives undefined error

Since your Test component does not belong to navigation stack it doesn’t have the navigation prop. You can do couple of things. Simple one is to pass the navigation to the child component like the example below. return ( <View> <Text>Hello, Chat App!</Text> <Button onPress={() => navigate(‘Chat’, { user: userName })} title={“Chat with ” + … Read more

Setting environment variable in react-native?

Instead of hard-coding your app constants and doing a switch on the environment (I’ll explain how to do that in a moment), I suggest using the twelve factor suggestion of having your build process define your BASE_URL and your API_KEY. To answer how to expose your environment to react-native, I suggest using Babel’s babel-plugin-transform-inline-environment-variables. To … Read more

What is the difference between Expo and React Native?

When you write code in Expo you are writing React Native code. Expo has two main pieces: Expo CLI (expo-cli): a developer tool for creating projects, viewing logs, opening on your device, publishing, etc. Expo client: an app on your phone that lets you open your projects while you’re working on them, without needing to … Read more