|
@@ -51,7 +51,7 @@ public class BridgeUtils {
|
51
|
51
|
} else if (arrayList.get(0) instanceof HashMap) {
|
52
|
52
|
bundle.putParcelableArray(key, toBundleArray((ArrayList<HashMap>) arrayList));
|
53
|
53
|
} else if (arrayList.get(0) instanceof ArrayList) {
|
54
|
|
- Log.w("RNNNavigation", "Arrays of arrays passed in props are converted to dictionaries with indexes as keys");
|
|
54
|
+ Log.w("RNNavigation", "Arrays of arrays passed in props are converted to dictionaries with indexes as keys");
|
55
|
55
|
Bundle innerArray = new Bundle();
|
56
|
56
|
for (int i = 0; i < arrayList.size(); i++) {
|
57
|
57
|
putArray(String.valueOf(i), (ArrayList) arrayList.get(i), innerArray);
|
|
@@ -62,11 +62,10 @@ public class BridgeUtils {
|
62
|
62
|
}
|
63
|
63
|
|
64
|
64
|
private static void verifyArrayListIsSingleType(ArrayList arrayList) {
|
65
|
|
- int i = 1;
|
66
|
|
- while (i < arrayList.size()) {
|
67
|
|
- if (!arrayList.get(i - 1).getClass().isInstance(arrayList.get(i)))
|
|
65
|
+ for (int i = 1; i < arrayList.size(); i++) {
|
|
66
|
+ if (!arrayList.get(i - 1).getClass().isInstance(arrayList.get(i))) {
|
68
|
67
|
throw new IllegalArgumentException("Cannot pass array of multiple types via props");
|
69
|
|
- i++;
|
|
68
|
+ }
|
70
|
69
|
}
|
71
|
70
|
}
|
72
|
71
|
|
|
@@ -80,36 +79,41 @@ public class BridgeUtils {
|
80
|
79
|
|
81
|
80
|
private static int[] toIntArray(ArrayList<Integer> arrayList) {
|
82
|
81
|
int[] ret = new int[arrayList.size()];
|
83
|
|
- for (int i=0; i < ret.length; i++)
|
|
82
|
+ for (int i=0; i < ret.length; i++) {
|
84
|
83
|
ret[i] = arrayList.get(i);
|
|
84
|
+ }
|
85
|
85
|
return ret;
|
86
|
86
|
}
|
87
|
87
|
|
88
|
88
|
private static float[] toFloatArray(ArrayList<Float> arrayList) {
|
89
|
89
|
float[] ret = new float[arrayList.size()];
|
90
|
|
- for (int i=0; i < ret.length; i++)
|
|
90
|
+ for (int i=0; i < ret.length; i++) {
|
91
|
91
|
ret[i] = arrayList.get(i);
|
|
92
|
+ }
|
92
|
93
|
return ret;
|
93
|
94
|
}
|
94
|
95
|
|
95
|
96
|
private static double[] toDoubleArray(ArrayList<Double> arrayList) {
|
96
|
97
|
double[] ret = new double[arrayList.size()];
|
97
|
|
- for (int i=0; i < ret.length; i++)
|
|
98
|
+ for (int i=0; i < ret.length; i++) {
|
98
|
99
|
ret[i] = arrayList.get(i);
|
|
100
|
+ }
|
99
|
101
|
return ret;
|
100
|
102
|
}
|
101
|
103
|
|
102
|
104
|
private static boolean[] toBooleanArray(ArrayList<Boolean> arrayList) {
|
103
|
105
|
boolean[] ret = new boolean[arrayList.size()];
|
104
|
|
- for (int i=0; i < ret.length; i++)
|
|
106
|
+ for (int i=0; i < ret.length; i++) {
|
105
|
107
|
ret[i] = arrayList.get(i);
|
|
108
|
+ }
|
106
|
109
|
return ret;
|
107
|
110
|
}
|
108
|
111
|
|
109
|
112
|
private static String[] toStringArray(ArrayList<String> arrayList) {
|
110
|
113
|
String[] ret = new String[arrayList.size()];
|
111
|
|
- for (int i=0; i < ret.length; i++)
|
|
114
|
+ for (int i=0; i < ret.length; i++) {
|
112
|
115
|
ret[i] = arrayList.get(i);
|
|
116
|
+ }
|
113
|
117
|
return ret;
|
114
|
118
|
}
|
115
|
119
|
|