1. <small id='UuK2j'></small><noframes id='UuK2j'>

    <legend id='UuK2j'><style id='UuK2j'><dir id='UuK2j'><q id='UuK2j'></q></dir></style></legend>

      <bdo id='UuK2j'></bdo><ul id='UuK2j'></ul>
  2. <tfoot id='UuK2j'></tfoot>
    <i id='UuK2j'><tr id='UuK2j'><dt id='UuK2j'><q id='UuK2j'><span id='UuK2j'><b id='UuK2j'><form id='UuK2j'><ins id='UuK2j'></ins><ul id='UuK2j'></ul><sub id='UuK2j'></sub></form><legend id='UuK2j'></legend><bdo id='UuK2j'><pre id='UuK2j'><center id='UuK2j'></center></pre></bdo></b><th id='UuK2j'></th></span></q></dt></tr></i><div id='UuK2j'><tfoot id='UuK2j'></tfoot><dl id='UuK2j'><fieldset id='UuK2j'></fieldset></dl></div>

    1. REACT NATIVE:有办法识别设备类型(智能手机、平板电脑、笔记本电脑)吗?

      REACT NATIVE : There is way to identify a device type (smartphone, tablet, laptop)?(REACT NATIVE:有办法识别设备类型(智能手机、平板电脑、笔记本电脑)吗?)

      <tfoot id='rfZjA'></tfoot>
        • <bdo id='rfZjA'></bdo><ul id='rfZjA'></ul>

                <tbody id='rfZjA'></tbody>
              <legend id='rfZjA'><style id='rfZjA'><dir id='rfZjA'><q id='rfZjA'></q></dir></style></legend>

            1. <i id='rfZjA'><tr id='rfZjA'><dt id='rfZjA'><q id='rfZjA'><span id='rfZjA'><b id='rfZjA'><form id='rfZjA'><ins id='rfZjA'></ins><ul id='rfZjA'></ul><sub id='rfZjA'></sub></form><legend id='rfZjA'></legend><bdo id='rfZjA'><pre id='rfZjA'><center id='rfZjA'></center></pre></bdo></b><th id='rfZjA'></th></span></q></dt></tr></i><div id='rfZjA'><tfoot id='rfZjA'></tfoot><dl id='rfZjA'><fieldset id='rfZjA'></fieldset></dl></div>

                <small id='rfZjA'></small><noframes id='rfZjA'>

                本文介绍了REACT NATIVE:有办法识别设备类型(智能手机、平板电脑、笔记本电脑)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                有办法识别设备类型(智能手机、平板电脑、笔记本电脑)吗?我需要将设备类型识别为:智能手机、平板电脑、笔记本电脑..我尝试使用 react-native-device-info" api 库,但不明白如何识别 3 种特定设备类型(智能手机、平板电脑、笔记本电脑).

                There is way to identify a device type (smartphone, tablet, laptop) ? I need to identify a device type as: smartphone, tablet, laptop .. i try to use the "react-native-device-info" api library but dont understand how to identify the 3 specific devices type (smartphone, tablet, laptop) .

                那么,如果它的Handset"=>,我怎么能做一些代码给我呢?智能手机,如果它的未知"=>笔记本电脑/计算机,它也会保存在我的异步存储中.

                So how can i do some code that will gives me if its "Handset"=> Smartphone , if its "unknown"=> Laptop/Computer and it will be saved as well in my async-storage.

                import DeviceInfo from 'react-native-device-info';
                import AsyncStorage from '@react-native-community/async-storage';
                
                // how can i do some code that will gives me if its "Handset"=> Smartphone , 
                //if its "unknown"=> Laptop/Computer 
                //and it will be saved as well in my async-storage.
                
                //this some example that i wanna get it works well coz now its not work good
                
                const funct1=  (type) => {
                let type = DeviceInfo.getDeviceType();
                
                if type==='Handset'{
                  AsyncStorage.setItem('PLATFORM-TYPE', 'Smartphone');
                }
                if type==='unknown'{
                  AsyncStorage.setItem('PLATFORM-TYPE', 'Laptop/Computer');
                }
                };
                

                推荐答案

                根据API DOC 您可以使用这些 API 来检测设备类型:

                According to API DOC you can use these APIs to detect the device types:

                • getDeviceType
                • isTablet
                • isEmulator
                • getModel

                有很多 API 可以获取设备名称或任何其他用例.阅读 API 文档 :) 据我所知,您无法检测到 laptop,React Native 不适用于 PC.

                There are so many APIs to get the device name or any other use-cases. Read the API doc :) Also you cannot detect the laptop as far as I know, React Native does not for on PC.

                这篇关于REACT NATIVE:有办法识别设备类型(智能手机、平板电脑、笔记本电脑)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                首先,我们需要在百度地图开放平台上申请一个开发者账号,并创建一个应用。在创建应用的过程中,我们会得到一个密钥(ak),这是调用API的凭证。 接下来,我们需要准备一个PHP文件,以便可以在网页中调用。首先,我们需要引入百度地图API的JS文件,代码如下
                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                <i id='kudLf'><tr id='kudLf'><dt id='kudLf'><q id='kudLf'><span id='kudLf'><b id='kudLf'><form id='kudLf'><ins id='kudLf'></ins><ul id='kudLf'></ul><sub id='kudLf'></sub></form><legend id='kudLf'></legend><bdo id='kudLf'><pre id='kudLf'><center id='kudLf'></center></pre></bdo></b><th id='kudLf'></th></span></q></dt></tr></i><div id='kudLf'><tfoot id='kudLf'></tfoot><dl id='kudLf'><fieldset id='kudLf'></fieldset></dl></div>

                <small id='kudLf'></small><noframes id='kudLf'>

                    <bdo id='kudLf'></bdo><ul id='kudLf'></ul>

                        <tfoot id='kudLf'></tfoot>

                          <tbody id='kudLf'></tbody>
                      • <legend id='kudLf'><style id='kudLf'><dir id='kudLf'><q id='kudLf'></q></dir></style></legend>