我正在尝试为我的反应项目构建一个拖放列表。我正在使用react-beautiful-dnd 库。但我面临这个错误:
错误:不变失败:找不到所需的上下文
我发现是可拖动组件引发了此错误
<Draggable draggableId={props.id} index={props.index}>
{(provided, snapshot) => (
<div {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef}>
Some code goes in here....
</div>
)}
<Draggable/>
Run Code Online (Sandbox Code Playgroud)
然后我发现了这个github问题:https://github.com/atlassian/react-beautiful-dnd/issues/948 根据这里建议的解决方案,我添加了一个样式函数
const getStyle = (style, snapshot, backgroundColor) => {
return {
...style,
borderBottomColor: backgroundColor,
backgroundColor: `${backgroundColor}`,
};
};
Run Code Online (Sandbox Code Playgroud)
然后将样式添加到div中
<Draggable draggableId={props.id} index={props.index}>
{(provided, snapshot) => (
<div {...provided.draggableProps} {...provided.dragHandleProps} ref={provided.innerRef} style=
{getStyle(provided.draggableProps.style, snapshot)>
Some code goes in here....
</div>
)}
<Draggable/>
Run Code Online (Sandbox Code Playgroud)
但我仍然无法解决这个问题...我能做些什么来解决这个问题?
我正在尝试使用 expo 构建一个基本的 React Native 应用程序...我面临的问题是,当我尝试使用键盘时,所有组件都会被抬起。我在堆栈溢出上搜索了我的问题,并找到了这个答案建议改变
windowSoftInputMode="adjustResize"
Run Code Online (Sandbox Code Playgroud)
在 AndroidManifest.xml 中:
windowSoftInputMode="adjustPan"
Run Code Online (Sandbox Code Playgroud)
但问题是我在我的 expo React Native 应用程序中找不到 AndroidManifest.xml...我应该如何以及在哪里添加此文件?