react-native - 在 IOS 平台上恢复产品时出错
问题描述
我使用 react native expo,用于创建移动应用程序,担心在 android 上我尝试在 odoo 版本 12 上恢复的产品不会造成问题,但对于 IOS 平台,产品不会出现我设法通过两个平台连接到基地。
对于信息,我使用 react-native-odoo,将 Odoo 与我的应用程序链接起来。
这是我的代码:
import Odoo from 'react-native-odoo'
const odoo = new Odoo({
host: ' ',
port: , /* Defaults to 80 if not specified */
database: ' ',
username: ' ', /* Optional if using a stored session_id */
password: ' ', /* Optional if using a stored session_id */
sid: ' ', /* Optional if using username/password */
protocol: 'https' /* Defaults to http if not specified */
})
var foo = [];
for (var i = 3; i <= 2500; i++) {
foo.push(i);
}
const params = {
ids: foo,
fields: ['name', 'list_price', 'image', 'categ_id'],
limit: 3,
order: 'categ_id',
};
export class testOdoo extends Component {
state = {
products: [],
}
componentDidMount = async () => {
await odoo.connect(function (err, resp) {
if (err) { return console.log('error =' + JSON.stringify(err)); }
console.log('connected with Odoo bd = ' + JSON.stringify(resp))
});
let that = this
var product = await odoo.search_read('product.template', params, function (err, product) {
if (err) { return console.log('erreur stock = ' + JSON.stringify(err)); }
console.log('----------------------------------------------------')
let a = product
console.warn(a.length)
let element = []
for (var i = 0; i < a.length; i++) {
if(product[i]){
element.push(product[i])
}
}
that.setState({
products: element,
})
console.log('----------------------------------------------------')
});
console.log('----------------------------------------------------')
}
在 android 平台上生成的结果: 在 android 平台上
在IOS平台上: 在IOS平台上
预先感谢您的回答
解决方案
推荐阅读
- mysql - 如何在环回中包含关系的条件
- laravel - 运行任务调度,Laravel
- python - 为什么导入pydicom会上升AttributeError:模块'gdcm'没有属性'DataElement'
- javascript - 更新子路由时如何更新嵌套路由的父级?
- java - LiveObjectService#persist 返回空对象
- node.js - 写入原型的函数不等待,循环执行
- xquery - 如何在单行输出中获取 MarkLogic 中 XQuery 的输出?
- numpy - 如何摆脱contourplot contourf(平滑矩阵/二维数组)中的伪影?
- pandas - pandas groupby 并填补缺失的频率
- django - Azure 容器实例:从 Django+Nginx+Postgres 创建多容器组