---
# System prepended metadata

title: 'Using a WebView for blogs, iOS build issues - Wed/Thurs 25th+26th September, 2020'
tags: [C+, blogs, webview, i386, architechures, programmingjournal, clang, arm64, '2020']

---

# Using a WebView for blogs, iOS build issues - Wed/Thurs 25th+26th September, 2020

Despite wanting to use [react-native-render-html](https://github.com/archriss/react-native-render-html) to parse the blog HTML and render native UI elements, there simply isn't the time to get it working, mainly due to the lack of specific CSS class names to work with.

Instead, I am simply going to display the blog content in a WebView for now, and handle specific in-app actions such as when the user presses on an "@mention" in a blog post. This is not ideal for accessibility reasons, but it is something I will return to when I have more time. 

I had trouble with WebView redirects, this solved it for me:

```typescript=
onShouldStartLoadWithRequest={(request) => {
    const { url, navigationType } = request

    try {
        if (navigationType === 'click' && url.includes(BLOG_PROFILE_LINK)) {
            const regexMatch = url.match('/profile/(.*)$')
            if (regexMatch) {
                navigateToUserProfile()
                return false
            }
        } else if (navigationType === 'click') {
            Linking.canOpenURL(url).then((canOpen) => {
                if (canOpen) {
                    Linking.openURL(url)
                }
            })

            return false
        }
    } catch (error) {
        // eslint-disable-next-line no-console
        console.error('Cannot open this url: ', error)
        return false
    }
    return true
    }}
```
My QA colleague also had problems building the C+ iOS version for writing Detox e2e tests. One of the issues he had was with the WebView library. Older versions were extending `UIWebview`, which has [been depreacted and removed](https://github.com/react-native-community/react-native-webview/releases/tag/v7.0.1).

Another error he had was:

> The linked library is missing one or more architectures required by this target: arm64, i386. 2020

After a lot of Googling, I followed [this](https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios) suggestion, and got it to build.

I am worried though, that by excluding certain architechtures, it is getting compiled without support for i386 or arm64, which might mean it will not run correctly, despite building OK?!

https://github.com/facebook/react-native/issues/29984

###### tags: `programmingjournal` `2020` `C+` `blogs` `webview` `architechures` `arm64` `clang` `i386`
