facebook / react-native-website

The React Native website and docs
https://reactnative.dev
MIT License
1.91k stars 4.34k forks source link

Platform Version is listed as Android only and also iOS and Android #4144

Closed mjaggard closed 3 weeks ago

mjaggard commented 3 weeks ago

Description

The docs show a table of properties where Version is listed as Android only and then further down the page the same property is listed as a number on Android and a string on iOS.

Documentation version

next

cortinico commented 3 weeks ago

That's because Version is a constant on Android:

https://github.com/facebook/react-native/blob/14ccf6bc9c40a51e913bb89a67b114f035bf77cd/packages/react-native/Libraries/Utilities/Platform.android.js#L36

But it's also a property Version which works for both Android & iOS.

EDIT: Improved correctness

mjaggard commented 3 weeks ago

But the documentation doesn't say that. It has Version listed as a property in both places.

mjaggard commented 3 weeks ago

@cortinico

cortinico commented 3 weeks ago

But the documentation doesn't say that. It has Version listed as a property in both places.

Sorry I wasn't 100% exact. There is a Version property that works for both Android & iOS. Moreover, inside the constant property, you can access the Version property that is Android only.

The documentation is correct as it is:

Screenshot 2024-06-13 at 11 41 48

mjaggard commented 3 weeks ago

Oh I see. That's very confusing but I understand now. Thanks.