React Native: How to Determine if Device is iPhone or iPad

后端 未结 10 847
花落未央
花落未央 2021-02-01 16:32

I know with React Native that we have the ability to determine whether iOS or Android is being run using the Platform module, but how can we determine what device i

10条回答
  •  日久生厌
    2021-02-01 17:04

    I use this solution: https://stackoverflow.com/a/48709199/2400373

    My solution final is this:

    import { Platform } from "react-native";
    
    Dispositivo() {
        if (Platform.isPad == true) {
          return(
           test
          )
        }
    

    Then I call this function:

    {this.Dispositivo()}
    

提交回复
热议问题