質問編集履歴

2

エラー内容を変更しました

2018/05/31 00:57

投稿

yamady
yamady

スコア176

test CHANGED
File without changes
test CHANGED
@@ -8,11 +8,7 @@
8
8
 
9
9
  ```
10
10
 
11
- JSON value '{
12
-
13
- uri = "file:///Users/sy/Library/Developer/CoreSimulator/Devices/2A298CC9-47DE-4E26-B236-F253373A575C/data/Containers/Data/Application/C9DA7950-01E1-4046-BF8E-BF1AFDF8F131/Documents/images/C11235A4-6529-4A01-A870-29315065C023.jpg";
14
-
15
- }' of type NSMutableDictionary cannot be converted to NSString
11
+ Warning: Failed prop type: Invalid prop `source` supplied to `Image`.
16
12
 
17
13
  ```
18
14
 
@@ -118,11 +114,13 @@
118
114
 
119
115
  let source = { uri: response.uri };
120
116
 
117
+ console.log('source', source);
118
+
121
119
 
122
120
 
123
121
  // Image Resizer で 画像をリサイズする
124
122
 
125
- ImageResizer.createResizedImage(source, 800, 600, 'JPEG', 80)
123
+ ImageResizer.createResizedImage(source.uri, 800, 600, 'JPEG', 80)
126
124
 
127
125
  .then(({uri}) => {
128
126
 

1

エラー内容を変更しました

2018/05/31 00:57

投稿

yamady
yamady

スコア176

test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,11 @@
8
8
 
9
9
  ```
10
10
 
11
- No suitable image URL loader found for (null)
11
+ JSON value '{
12
+
13
+ uri = "file:///Users/sy/Library/Developer/CoreSimulator/Devices/2A298CC9-47DE-4E26-B236-F253373A575C/data/Containers/Data/Application/C9DA7950-01E1-4046-BF8E-BF1AFDF8F131/Documents/images/C11235A4-6529-4A01-A870-29315065C023.jpg";
14
+
15
+ }' of type NSMutableDictionary cannot be converted to NSString
12
16
 
13
17
  ```
14
18
 
@@ -68,7 +72,7 @@
68
72
 
69
73
 
70
74
 
71
- selectPhotoTapped() {
75
+ pickImage() {
72
76
 
73
77
  const options = {
74
78
 
@@ -86,27 +90,7 @@
86
90
 
87
91
 
88
92
 
89
- ImageResizer.createResizedImage(this.state.ImageSource, 10, 10, 'PNG', 20)
90
-
91
- .then(({uri}) => {
92
-
93
- this.setState({
94
-
95
- resizedImageUri: uri,
93
+ // Image Picker で 画像を表示する
96
-
97
- });
98
-
99
- }).catch((err) => {
100
-
101
- console.log(err);
102
-
103
- return Alert.alert('Unable to resize the photo',
104
-
105
- 'Check the console for full the error message');
106
-
107
- });
108
-
109
-
110
94
 
111
95
  ImagePicker.showImagePicker(options, (response) => {
112
96
 
@@ -134,9 +118,27 @@
134
118
 
135
119
  let source = { uri: response.uri };
136
120
 
137
- this.setState({
138
121
 
122
+
123
+ // Image Resizer で 画像をリサイズする
124
+
125
+ ImageResizer.createResizedImage(source, 800, 600, 'JPEG', 80)
126
+
127
+ .then(({uri}) => {
128
+
129
+ this.setState({
130
+
139
- ImageSource: source,
131
+ ImageSource: uri,
132
+
133
+ });
134
+
135
+ }).catch((err) => {
136
+
137
+ console.log(err);
138
+
139
+ return Alert.alert('Unable to resize the photo',
140
+
141
+ 'Check the console for full the error message');
140
142
 
141
143
  });
142
144
 
@@ -160,7 +162,7 @@
160
162
 
161
163
  style={styles.frame}
162
164
 
163
- onPress={this.selectPhotoTapped.bind(this)}
165
+ onPress={this.pickPhoto.bind(this)}
164
166
 
165
167
  >
166
168