React-native-orientation: erorr on 0.31

Created on 25 Aug 2016  ·  14Comments  ·  Source: yamill/react-native-orientation

error on 0.31

Most helpful comment

@yamill could you update npm version to stable master?

All 14 comments

getCurrentActivity() or reactContext.getCurrentActivity()
all error.

yes, I may face the same problem, I am 0.31,too

Usage says, add this --> new OrientationPackage()
but, the compiler says:
错误: 无法将类 OrientationPackage中的构造器 OrientationPackage应用
到给定类型;
new OrientationPackage()
^
需要: Activity
找到: 没有参数
原因: 实际参数列表和形式参数列表长度不同
1 个错误
:app:compileDebugJavaWithJavac FAILED

I have same issue with react 0.31. Package require new OrientationPackage(Activity) on MainApplication.java but mentioned add without Activity instance as follow:
@Override
protected List getPackages() {
return Arrays.asList(
new MainReactPackage(),
new OrientationPackage() <------- Add this
);
}

what is the solution? Please help me out.

https://github.com/yamill/react-native-orientation/blob/master/android/src/main/java/com/github/yamill/orientation/OrientationModule.java

public OrientationModule(ReactApplicationContext reactContext) {
super(reactContext);
Activity activity=reactContext.getCurrentActivity();
}

Context "reactContext" do not have method getCurrentActivity(). Error at all

Hey, someone resolved this problem ? I'm on it too, I would handle this fast

Hey, I resolved it.

you can npm remove react-native-orientation --save

then download the latest source from github.com and unzip into your
node_modules

after that, react-native link react-native-orientation, then it will
automatically rewrite setting.gradle and bundle.gradle

last, update MainApplication.java and MainActivity.java, then you can use
it in your js files

2016-08-26 21:27 GMT+08:00 Pierre Monge [email protected]:

Hey, someone resolved this problem ? I'm on it too, I would handle this
fast


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yamill/react-native-orientation/issues/96#issuecomment-242734877,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANG18JW5UhVUmYZc3ggTh6RSpoose6pks5qjum3gaJpZM4JtOsv
.

Alex Xiong

Mobile: +86 18930034922

Hey, I resolved it too :)

Npm package was not updated with github ! 👍

greetings!

2016-08-26 22:35 GMT+08:00 Pierre Monge [email protected]:

Hey, I resolved it too :)

Npm package was not updated with github ! 👍


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/yamill/react-native-orientation/issues/96#issuecomment-242752866,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANG1y4OY6_9wbf_o2k5mOhjkuDO86Ivks5qjvnIgaJpZM4JtOsv
.

Alex Xiong

Mobile: +86 18930034922

@yamill could you update npm version to stable master?

@xiongzhend Is your solution the same as changing the app's package.json to point to github?

"react-native-orientation": "git+https://github.com/yamill/react-native-orientation",

I think this should be the same. However it is still not working for me on Android.

I will try your solution to download the latest source from github.com and unzip into my
node_modules

Exactly ! This is the best way to make this module works

I tried to change "react-native-orientation": git+https://[email protected]/yamill/react-native-orientation.git"
but still not working.../Users/luca/workspace/pillsy/android/app/src/main/java/com/pillsy/MainApplication.java:27: error: constructor OrientationPackage in class OrientationPackage cannot be applied to given types;
new OrientationPackage(this)
^
required: no arguments
found:
reason: actual and formal argument lists differ in length
1 error
:app:compileDebugJavaWithJavac FAILED

Please refer to updated documentation on README. NPM's version of the package is outdated. you should install it directly from GitHub.

Was this page helpful?
0 / 5 - 0 ratings