我刚刚疯了我的第一个React原生项目,我试图将屏幕方向锁定为横向。
https://github.com/yamill/react-native-orientation#configurationnpm install react-native link react-native-orientation
,现在我需要
在MainActivity.java中实现onChallengationChanged方法
所以这个代码
import android.content.Intent; // <--- import
import android.content.res.Configuration; // <--- import
public class MainActivity extends ReactActivity {
......
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Intent intent = new Intent("onConfigurationChanged");
intent.putExtra("newConfig", newConfig);
this.sendBroadcast(intent);
}
......
}
字符串
但我在哪里可以找到它?从我所看到的是,你可以在一个android studio项目中找到它。但我没有一个项目,我只是去AVD管理器运行我的虚拟设备。那么我应该在哪里添加这段代码?
2条答案
按热度按时间kpbwa7wx1#
expo
的全部目标是为您处理与android
或ios
相关的所有内容。因此,你将无法访问这两个文件夹**,除非**你从
expo
eject
你的应用程序,因为它的解释here on the official doc。但是,如果您的目标是处理屏幕方向,
expo
有一个built-in API for you that you may find here。或者更简单,你可以更新你的
app.json
并添加这一行:字符串
如果你想知道你可以用这个配置文件处理的所有事情,请查看官方文档。
brjng4g32#
尝试通过此目录查找:
字符串