Closed piranna closed 6 years ago
Ok, at https://github.com/RealOrangeOne/react-native-mock/issues/17#issuecomment-234166764 provides a little bit more information about this topic.
Hi @piranna, Platform.__setOS()
was added before we forked from https://github.com/RealOrangeOne/react-native-mock and has not been updated since.
Unfortunately, I'm not familiar with its use and we don't use that particular helper method at Root (we use dependency injection to simulate different operating systems in our tests instead).
If you would like more help with it, you might be better off asking at https://github.com/RealOrangeOne/react-native-mock. Alternatively, if the feature is broken and you need it to work, you could open a PR and we could get it merged and published for you.
Feature is not broken, or at least don't seems so by reading source code. I'm going to continue improving my other tests before digging on this issue.
Closing this as stale.
When using components that has several implementations for different platforms (for example with
.android.js
or.web.js
extensions), ReactNative usesPlatform.OS
to identify the current platform.react-native-mock-render
is using by defaultios
, so my tests are failing. It adds a Platform.__setOS() private method to select the platform to be emulated, but I'm not able to use it on my code and there's no examples about how to do it. Could you be able to give me some advice about that?