Skip to content

Platform.OS returns 'android' when running in iOS device #17518

@rash6795

Description

@rash6795

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.2
Node: 8.9.2
Yarn: Not Found
npm: 5.5.1
Watchman: Not Found
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4408382

Packages: (wanted => installed)
react: 16.0.0-beta.5 => 16.0.0-beta.5
react-native: 0.50.3 => 0.50.3

Target Platform: iOS (8.0)

Steps to Reproduce

  1. Paste below code in your index.js
componentDidMount() {
        if(Platform.OS === 'ios') {
	       console.log(" ios") 
        } else {
              console.log("android") 
       } 
}
  1. Enable Remote JS Debugging and check the Console for log

Expected Behavior

Console Log Output: ios

Actual Behavior

Console Log Output:

screen shot 2018-01-10 at 6 14 10 pm

Simulator Output:
screen shot 2018-01-10 at 6 15 34 pm

checkInitialPermissions is the function to be executed only on android. But its executed on iOS.

Reproducible Demo

Follow steps to reproduce

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions