简体   繁体   中英

React Native: Test app in different resolutions

What I am doing now is closing and opening different instances of Android Emulator to see how it works in X resolution .

Is there a smarter way?

If your react-native app has a single root react-native-layout-tester is what you are looking for!

The setup is fairly straightforward and you will have to run it on the biggest device possible (a tablet)

 render() { return ( <LayoutTester> // here <Provider store={ store }> <Router initialRoute={ this._initialRoute } ref={ this._setRouter } /> </Provider> </LayoutTester> ); } 

In case your app navigation is handled via react-native-navigation , then the setup will be a little complex and you wont be able test the Navbar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM