Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow call's input to be a string on Android #198

Merged
merged 2 commits into from
Apr 25, 2019
Merged

Conversation

osdnk
Copy link
Contributor

@osdnk osdnk commented Feb 27, 2019

Motivation

On Android JSCall exception is thrown type of node's value was string

Changes

Added condition for checking if type of node is a string and then handle it properly.

@@ -19,12 +19,17 @@ public JSCallNode(int nodeID, ReadableMap config, NodesManager nodesManager) {
@Override
protected Double evaluate() {
WritableArray args = Arguments.createArray();
for (int i = 0; i < mInputIDs.length; i++) {
Node node = mNodesManager.findNodeById(mInputIDs[i], Node.class);
for (int mInputID : mInputIDs) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor tweak.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this actually allocates an iterator, so it is not merely a tweak

@@ -19,12 +19,17 @@ public JSCallNode(int nodeID, ReadableMap config, NodesManager nodesManager) {
@Override
protected Double evaluate() {
WritableArray args = Arguments.createArray();
for (int i = 0; i < mInputIDs.length; i++) {
Node node = mNodesManager.findNodeById(mInputIDs[i], Node.class);
for (int mInputID : mInputIDs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (int mInputID : mInputIDs) {
for (int i = 0; i < mInputIDs.length; i++) {

for (int i = 0; i < mInputIDs.length; i++) {
Node node = mNodesManager.findNodeById(mInputIDs[i], Node.class);
for (int mInputID : mInputIDs) {
Node node = mNodesManager.findNodeById(mInputID, Node.class);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Node node = mNodesManager.findNodeById(mInputID, Node.class);
Node node = mNodesManager.findNodeById(mInputIDs[i], Node.class);

@@ -19,12 +19,17 @@ public JSCallNode(int nodeID, ReadableMap config, NodesManager nodesManager) {
@Override
protected Double evaluate() {
WritableArray args = Arguments.createArray();
for (int i = 0; i < mInputIDs.length; i++) {
Node node = mNodesManager.findNodeById(mInputIDs[i], Node.class);
for (int mInputID : mInputIDs) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this actually allocates an iterator, so it is not merely a tweak

@osdnk osdnk changed the title Handle case if jscall's input node is string Allow call's input to be a string on Android Apr 25, 2019
Copy link
Contributor

@jkadamczyk jkadamczyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚡️

@osdnk osdnk merged commit 1ed19e5 into master Apr 25, 2019
@osdnk osdnk deleted the js-call-handle-string branch April 25, 2019 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants