反应本机 - 目标。价值不在移动上工作'

发布于 2025-02-01 20:25:16 字数 1192 浏览 1 评论 0 原文

问候人类,

我对这个小应用程序有一个小问题,该应用程序应该仅存储和显示数据:

当我在iPad上从PC上进行dircetally(我在CMD窗口中扫描QR代码)时,应用程序启动启动时,数据启动不错,但数据不适用在重新运行应用程序或将作业发送到另一个窗口时保存(右侧的“待办事项”按钮)在您检查作业后显示出来)。

当我从Expo运行它时,我会收到此错误: null不是对象(评估'obss.map'map'map'

不确定,我不知道该如何解决这个问题

所以我认为我在保存 /加载或实际编写地图时做错了什么,但我 帮我? 请谢谢你。

更新:未设置var temp1,因为此处的警报返回“未身份”,即使我只是在上一行中定义它。这仅在iOS和Android上发生,它在Web Sim上正常工作。谁能解释一下?

<TextInput
                  style={s.jobInput}
                  onChange={(e) => {
                    var temp1 = e.target.value;
                    alert(temp1)
                    setJobs((currentJobs) =>
                      produce(currentJobs, (v) => {
                        v[index].address = temp1;
                      })
                    );
                    saveItem();
                    
                  }}
                  value={j.address}
                  placeholder="Address"
                />

Greetings fellow humans,

I have a small problem with this little app that is just supposed to store and display data: https://snack.expo.dev/@vevlex/nullnotanobject

When I test this dircetly from my pc (I scan the QR code in my cmd window) on an ipad, the app boots fine but the data is not saved when re-running the app or when sending a job to another window (The "To Do" button on the right that shows up after you check a job).

When I run it from Expo, I get this error: null is not an object (evaluating 'jobs.map'

So I assume I'm doing something wrong with the saving / loading, or when actually writing the map, but I'm not sure, and I don't know how to approach this problem on my own.

Can anyone help me?
Please and thank you.

Update: var temp1 is not being set, as the alert here returns "Unidentified" even tho I just define it in the previous line. This only happens on iOS and android, it works fine on the web sim. Can anyone explain this?

<TextInput
                  style={s.jobInput}
                  onChange={(e) => {
                    var temp1 = e.target.value;
                    alert(temp1)
                    setJobs((currentJobs) =>
                      produce(currentJobs, (v) => {
                        v[index].address = temp1;
                      })
                    );
                    saveItem();
                    
                  }}
                  value={j.address}
                  placeholder="Address"
                />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吹梦到西洲 2025-02-08 20:25:16

好的,在发现我在更新中说明的内容后,我进行了更多搜索,并发现在移动设备上,您应该使用 onChangeText ,而不仅仅是 onChange

Ok after finding out what I stated in the update I searched a bit more and found out that on mobile you should use onChangeText rather than just onChange.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文