Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use this? i can't understand #22

Open
haofeng123 opened this issue Sep 8, 2020 · 1 comment
Open

how to use this? i can't understand #22

haofeng123 opened this issue Sep 8, 2020 · 1 comment

Comments

@haofeng123
Copy link

import UserAgent from 'react-native-user-agent';

UserAgent.getUserAgent();

render() {
   var url = 'http://qun.hk/';
    return (
        <ScrollView
            automaticallyAdjustContentInsets={false}
            contentOffset={{top:20}}
            bounces={false}
            style={styles.container}>                             

            <StatusBar barStyle='light-content' backgroundColor='rgba(40,116,203,1)' translucent={true}></StatusBar>
            <WebView
                   nativeConfig={
                        {
                            props: {
                                backgroundColor: '#ffffff',
                                flex: 1,
                            }
                        }
                  }
                  ref={WEBVIEW_REF}
                  style={styles.webView}  
                  source={{uri:url,method: 'GET'}}  
                  javaScriptEnabled={true}  
                  domStorageEnabled={true}  
                  scalesPageToFit={false} 
                  mixedContentMode={'always'}
                  userAgent="Cordova-User-Agent"
                  // onMessage={(event) => {console.warn(event.nativeEvent.data);}}
                  onMessage={this.onMessage}
                  onNavigationStateChange={(e)=>this.onNavigationStateChange(e)}
                  />
        </ScrollView>
    );
}
@pankajgupta1
Copy link

I used in this way

import UAParser from 'ua-parser-js'
import UserAgent from 'react-native-user-agent'

const userAgent = UserAgent.getUserAgent()
const parser = new UAParser(userAgent).getResult()

const {device, os, browser} = parser
const {type, vendor, model} = device
const {name, version} = os
const {name, major} = browser

I used in this way. This is working good for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants