Nästa Coach React Native/Expo Integration
-
Install webview package:
-
npm:
npm install react-native-webview
-
yarn:
yarn add react-native-webview
-
expo:
expo install react-native-webview
-
Put the webview in your component:
import React from 'react'; import { View } from 'react-native'; import { WebView } from 'react-native-webview'; export default function App() { const token = "<your-token>" const clientId = "<your-client-id>" const language = "" /* If you leave it empty it's the system default language, but you can set with es for spanish, en for english and va for valencian */ const mainColor = "#4b858e" /* You can change the default values */ const mainActive = "#2c4e54" const mainDisabled = "#9db8bc" const secondary = "#a3d5cd" const secondaryDark = "#9ac6bf" const secondaryMiddle = "#c8e7e2" const secondaryLight = "#e8f6f3" const secondarySuperDark = "#7baaa3" const font = "'Montserrat', sans-serif" const maxWidth = "420px" const height = "500px" const htmlData = ` <html> <head> <style> :root { --nasta-main: ${mainColor}; --nasta-mainActive: ${mainActive}; --nasta-mainDisabled: ${mainDisabled}; --nasta-secondary: ${secondary}; --nasta-secondaryDark: ${secondaryDark}; --nasta-secondaryMiddle: ${secondaryMiddle}; --nasta-secondaryLight: ${secondaryLight}; --nasta-secondarySuperDark: ${secondarySuperDark}; --nasta-font: ${font}; --nasta-microMaxWidth: ${maxWidth}; --nasta-microHeight: ${height}; } </style> </head> <body> <recycling-app client-id="${clientId}" token="${token}" language="${language}" ></recycling-app> <script src="https://recycling.nastaeco.com/recycling.umd.js"></script> </body> </html> `; return ( <View style={styles.container}> <WebView originWhitelist={['*']} source={{ html: htmlData }} /> </View> ); }
To customize the font you need to add the import in your code too.
Remember to change the values of your-token to your token and your-client-id to your client id.